<?php
 namespace App\AI\SymfonyAiExtend\OpenAi; use Symfony\AI\Platform\Bridge\OpenAi\Gpt; use Symfony\AI\Platform\Capability; final class ModelCatalog { public static function create(): \Symfony\AI\Platform\Bridge\OpenAi\ModelCatalog { return new \Symfony\AI\Platform\Bridge\OpenAi\ModelCatalog([ 'gpt-5.5' => [ 'class' => Gpt::class, 'capabilities' => [ Capability::INPUT_MESSAGES, Capability::OUTPUT_TEXT, Capability::OUTPUT_STREAMING, Capability::TOOL_CALLING, Capability::INPUT_IMAGE, Capability::INPUT_PDF, Capability::OUTPUT_STRUCTURED, ], ], 'gpt-5.1' => [ 'class' => Gpt::class, 'capabilities' => [ Capability::INPUT_MESSAGES, Capability::OUTPUT_TEXT, Capability::OUTPUT_STREAMING, Capability::TOOL_CALLING, Capability::INPUT_IMAGE, Capability::INPUT_PDF, Capability::OUTPUT_STRUCTURED, ], ], ]); } private const PRICING = [ 'gpt-5.5' => [ 'input' => 5.00, 'output' => 30.00, 'cached' => 0.50, ], 'gpt-5.4' => [ 'input' => 2.50, 'output' => 15.00, 'cached' => 0.25, ], 'gpt-5.4-mini' => [ 'input' => 0.75, 'output' => 4.50, 'cached' => 0.075, ], 'gpt-5.2' => [ 'input' => 1.75, 'output' => 14.00, 'cached' => 0.175, ], 'gpt-5.1' => [ 'input' => 1.25, 'output' => 10.00, 'cached' => 0.125, ], ]; public static function getPricing(string $model): ?array { return self::PRICING[$model] ?? null; } public static function calculateCost(string $model, int $inputTokens, int $outputTokens, int $cachedTokens): ?float { $pricing = self::getPricing($model); $cost = ($inputTokens / 1000000) * $pricing['input'] + ($outputTokens / 1000000) * $pricing['output'] + ($cachedTokens / 1000000) * $pricing['cached']; return round($cost, 3); } }