<?php
 namespace App\AI\SymfonyAiExtend\Gemini; use Symfony\AI\Platform\Bridge\Gemini\Gemini; use Symfony\AI\Platform\Bridge\Gemini\ModelCatalog as GeminiModelCatalog; use Symfony\AI\Platform\Capability; final class ModelCatalog { public static function create(): GeminiModelCatalog { return new GeminiModelCatalog([ 'gemini-3.5-flash' => [ 'class' => Gemini::class, 'capabilities' => [ Capability::INPUT_MESSAGES, Capability::INPUT_IMAGE, Capability::INPUT_AUDIO, Capability::INPUT_PDF, Capability::INPUT_VIDEO, Capability::OUTPUT_TEXT, Capability::OUTPUT_STREAMING, Capability::OUTPUT_STRUCTURED, Capability::TOOL_CALLING, Capability::THINKING, ], ], 'gemini-3.1-pro-preview' => [ 'class' => Gemini::class, 'capabilities' => [ Capability::INPUT_MESSAGES, Capability::INPUT_IMAGE, Capability::INPUT_AUDIO, Capability::INPUT_PDF, Capability::INPUT_VIDEO, Capability::OUTPUT_TEXT, Capability::OUTPUT_STREAMING, Capability::OUTPUT_STRUCTURED, Capability::TOOL_CALLING, Capability::THINKING, ], ], ]); } private const PRICING = [ 'gemini-3.5-flash' => [ 'input' => 1.50, 'output' => 9.00, 'cached' => 0.15, ], 'gemini-3.1-pro-preview' => [ 'input' => 2.00, 'output' => 12.00, 'cached' => 0.20, ], 'gemini-2.5-pro' => [ 'input' => 1.25, 'output' => 10.00, 'cached' => 0.125, ], 'gemini-2.5-flash' => [ 'input' => 0.30, 'output' => 2.50, 'cached' => 0.03, ], ]; 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); } }