Merge pull request #38990 from BerriAI/devin_ai_1788201394-veo31-pricing-tiers

fix(registry): veo 3.1 pricing tiers + roll up open registry PRs (glm-5.2, Qwen3.8-Flash, gemma-4-31b, scribe_v2, fireworks/databricks deepseek v4) + deprecation dates
This commit is contained in:
Mateo Wang 2026-09-01 10:32:59 -07:00 committed by GitHub
commit ef7a984fbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 355 additions and 30 deletions

View file

@ -554,6 +554,7 @@
"supports_vision": true
},
"amazon.nova-sonic-v1:0": {
"deprecation_date": "2026-09-14",
"input_cost_per_audio_token": 3.4e-06,
"input_cost_per_token": 6e-08,
"litellm_provider": "bedrock",
@ -3045,6 +3046,7 @@
"prompt_cache_min_tokens": 2048
},
"azure_ai/claude-fable-5": {
"deprecation_date": "2027-12-05",
"supports_mid_conversation_system": true,
"input_cost_per_token": 1e-05,
"output_cost_per_token": 5e-05,
@ -3078,6 +3080,7 @@
"prompt_cache_min_tokens": 512
},
"azure_ai/claude-opus-5": {
"deprecation_date": "2027-07-08",
"supports_mid_conversation_system": true,
"supports_adaptive_thinking": true,
"input_cost_per_token": 5e-06,
@ -3110,6 +3113,7 @@
"prompt_cache_min_tokens": 512
},
"azure_ai/claude-opus-4-8": {
"deprecation_date": "2027-09-01",
"supports_mid_conversation_system": true,
"supports_adaptive_thinking": true,
"input_cost_per_token": 5e-06,
@ -3188,6 +3192,7 @@
"prompt_cache_min_tokens": 1024
},
"azure_ai/claude-sonnet-5": {
"deprecation_date": "2027-06-30",
"supports_mid_conversation_system": true,
"cache_creation_input_token_cost": 2.5e-06,
"cache_creation_input_token_cost_above_1hr": 4e-06,
@ -12287,6 +12292,7 @@
"supports_tool_choice": true
},
"cerebras/zai-glm-4.7": {
"deprecation_date": "2026-08-17",
"input_cost_per_token": 2.25e-06,
"litellm_provider": "cerebras",
"max_input_tokens": 128000,
@ -15101,6 +15107,62 @@
"supports_tool_choice": true,
"supports_vision": true
},
"databricks/databricks-deepseek-v4-flash-0731": {
"cache_creation_input_token_cost": 1.4e-07,
"cache_read_input_token_cost": 2.8e-08,
"input_cost_per_token": 1.4e-07,
"input_dbu_cost_per_token": 2e-06,
"litellm_provider": "databricks",
"max_input_tokens": 1000000,
"max_output_tokens": 393216,
"max_tokens": 393216,
"metadata": {
"notes": "Input/output cost per token is dbu cost * $0.070. Billing reads the per-token dollar fields; the '*_dbu_cost_per_token' fields are the published Databricks rates, kept for reference. Context/max output are the DeepSeek-published model limits (1M context, 384K max output)."
},
"mode": "chat",
"output_cost_per_token": 2.8e-07,
"output_dbu_cost_per_token": 4e-06,
"source": "https://www.databricks.com/product/pricing/foundation-model-serving",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true,
"supports_vision": false
},
"databricks/databricks-deepseek-v4-pro-0813": {
"cache_creation_input_token_cost": 1.31999e-06,
"cache_read_input_token_cost": 1.3202e-07,
"input_cost_per_token": 1.31999e-06,
"input_dbu_cost_per_token": 1.8857e-05,
"litellm_provider": "databricks",
"max_input_tokens": 1000000,
"max_output_tokens": 393216,
"max_tokens": 393216,
"metadata": {
"notes": "Input/output cost per token is dbu cost * $0.070. Billing reads the per-token dollar fields; the '*_dbu_cost_per_token' fields are the published Databricks rates, kept for reference. Context/max output are the DeepSeek-published model limits (1M context, 384K max output)."
},
"mode": "chat",
"output_cost_per_token": 3.95997e-06,
"output_dbu_cost_per_token": 5.6571e-05,
"source": "https://www.databricks.com/product/pricing/foundation-model-serving",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true,
"supports_vision": false
},
"databricks/databricks-gemini-2-5-flash": {
"cache_creation_input_token_cost": 3.0002e-07,
"cache_read_input_token_cost": 3.0002e-08,
@ -20631,6 +20693,7 @@
"supports_image_size": false
},
"gemini-live-2.5-flash-native-audio": {
"deprecation_date": "2026-12-13",
"input_cost_per_audio_token": 3e-06,
"input_cost_per_token": 5e-07,
"litellm_provider": "vertex_ai-language-models",
@ -23852,8 +23915,10 @@
"max_input_tokens": 1024,
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.15,
"source": "https://ai.google.dev/gemini-api/docs/video",
"output_cost_per_second": 0.1,
"output_cost_per_second_1080p": 0.12,
"output_cost_per_second_4k": 0.3,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_modalities": [
"text"
],
@ -23867,7 +23932,8 @@
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.4,
"source": "https://ai.google.dev/gemini-api/docs/video",
"output_cost_per_second_4k": 0.6,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_modalities": [
"text"
],
@ -23895,8 +23961,10 @@
"max_input_tokens": 1024,
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.15,
"source": "https://ai.google.dev/gemini-api/docs/video",
"output_cost_per_second": 0.1,
"output_cost_per_second_1080p": 0.12,
"output_cost_per_second_4k": 0.3,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_modalities": [
"text"
],
@ -23910,7 +23978,8 @@
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.4,
"source": "https://ai.google.dev/gemini-api/docs/video",
"output_cost_per_second_4k": 0.6,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_modalities": [
"text"
],
@ -43440,7 +43509,8 @@
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.4,
"source": "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/veo/3-1-generate",
"output_cost_per_second_4k": 0.6,
"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing",
"supported_modalities": [
"text"
],
@ -43453,8 +43523,10 @@
"max_input_tokens": 1024,
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.15,
"source": "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/veo/3-1-generate",
"output_cost_per_second": 0.1,
"output_cost_per_second_1080p": 0.12,
"output_cost_per_second_4k": 0.3,
"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing",
"supported_modalities": [
"text"
],
@ -43469,7 +43541,8 @@
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.4,
"source": "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/veo/3-1-generate",
"output_cost_per_second_4k": 0.6,
"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing",
"supported_modalities": [
"text"
],
@ -43483,8 +43556,10 @@
"max_input_tokens": 1024,
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.15,
"source": "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/veo/3-1-generate",
"output_cost_per_second": 0.1,
"output_cost_per_second_1080p": 0.12,
"output_cost_per_second_4k": 0.3,
"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing",
"supported_modalities": [
"text"
],
@ -52231,14 +52306,14 @@
"supports_vision": true
},
"fireworks_ai/deepseek-v4-flash-0731": {
"cache_read_input_token_cost": 2.8e-08,
"input_cost_per_token": 1.4e-07,
"cache_read_input_token_cost": 7e-09,
"input_cost_per_token": 2.2e-07,
"litellm_provider": "fireworks_ai",
"max_input_tokens": 1048576,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 2.8e-07,
"output_cost_per_token": 6.6e-07,
"source": "https://docs.fireworks.ai/serverless/pricing",
"supports_function_calling": true,
"supports_reasoning": true,
@ -55124,5 +55199,55 @@
"max_tokens": 40960,
"mode": "embedding",
"source": "https://docs.fireworks.ai/serverless/pricing"
},
"zai/glm-5.2": {
"cache_creation_input_token_cost": 0,
"cache_read_input_token_cost": 2.6e-07,
"input_cost_per_token": 1.4e-06,
"litellm_provider": "zai",
"max_input_tokens": 1000000,
"max_output_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 4.4e-06,
"source": "https://docs.z.ai/guides/overview/pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"together_ai/Qwen/Qwen3.8-Flash": {
"input_cost_per_token": 1.5e-07,
"litellm_provider": "together_ai",
"max_input_tokens": 1000000,
"max_tokens": 1000000,
"mode": "chat",
"output_cost_per_token": 4.7e-07,
"source": "https://docs.together.ai/docs/serverless-models"
},
"cerebras/gemma-4-31b": {
"input_cost_per_token": 9.9e-07,
"litellm_provider": "cerebras",
"max_input_tokens": 131072,
"max_output_tokens": 40960,
"max_tokens": 40960,
"mode": "chat",
"output_cost_per_token": 1.49e-06,
"source": "https://api.cerebras.ai/public/v1/models/gemma-4-31b",
"supports_function_calling": true,
"supports_parallel_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
},
"elevenlabs/scribe_v2": {
"input_cost_per_second": 6.11e-05,
"litellm_provider": "elevenlabs",
"mode": "audio_transcription",
"output_cost_per_second": 0.0,
"source": "https://elevenlabs.io/pricing/api",
"supported_endpoints": [
"/v1/audio/transcriptions"
]
}
}

View file

@ -554,6 +554,7 @@
"supports_vision": true
},
"amazon.nova-sonic-v1:0": {
"deprecation_date": "2026-09-14",
"input_cost_per_audio_token": 3.4e-06,
"input_cost_per_token": 6e-08,
"litellm_provider": "bedrock",
@ -3045,6 +3046,7 @@
"prompt_cache_min_tokens": 2048
},
"azure_ai/claude-fable-5": {
"deprecation_date": "2027-12-05",
"supports_mid_conversation_system": true,
"input_cost_per_token": 1e-05,
"output_cost_per_token": 5e-05,
@ -3078,6 +3080,7 @@
"prompt_cache_min_tokens": 512
},
"azure_ai/claude-opus-5": {
"deprecation_date": "2027-07-08",
"supports_mid_conversation_system": true,
"supports_adaptive_thinking": true,
"input_cost_per_token": 5e-06,
@ -3110,6 +3113,7 @@
"prompt_cache_min_tokens": 512
},
"azure_ai/claude-opus-4-8": {
"deprecation_date": "2027-09-01",
"supports_mid_conversation_system": true,
"supports_adaptive_thinking": true,
"input_cost_per_token": 5e-06,
@ -3188,6 +3192,7 @@
"prompt_cache_min_tokens": 1024
},
"azure_ai/claude-sonnet-5": {
"deprecation_date": "2027-06-30",
"supports_mid_conversation_system": true,
"cache_creation_input_token_cost": 2.5e-06,
"cache_creation_input_token_cost_above_1hr": 4e-06,
@ -12287,6 +12292,7 @@
"supports_tool_choice": true
},
"cerebras/zai-glm-4.7": {
"deprecation_date": "2026-08-17",
"input_cost_per_token": 2.25e-06,
"litellm_provider": "cerebras",
"max_input_tokens": 128000,
@ -15101,6 +15107,62 @@
"supports_tool_choice": true,
"supports_vision": true
},
"databricks/databricks-deepseek-v4-flash-0731": {
"cache_creation_input_token_cost": 1.4e-07,
"cache_read_input_token_cost": 2.8e-08,
"input_cost_per_token": 1.4e-07,
"input_dbu_cost_per_token": 2e-06,
"litellm_provider": "databricks",
"max_input_tokens": 1000000,
"max_output_tokens": 393216,
"max_tokens": 393216,
"metadata": {
"notes": "Input/output cost per token is dbu cost * $0.070. Billing reads the per-token dollar fields; the '*_dbu_cost_per_token' fields are the published Databricks rates, kept for reference. Context/max output are the DeepSeek-published model limits (1M context, 384K max output)."
},
"mode": "chat",
"output_cost_per_token": 2.8e-07,
"output_dbu_cost_per_token": 4e-06,
"source": "https://www.databricks.com/product/pricing/foundation-model-serving",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true,
"supports_vision": false
},
"databricks/databricks-deepseek-v4-pro-0813": {
"cache_creation_input_token_cost": 1.31999e-06,
"cache_read_input_token_cost": 1.3202e-07,
"input_cost_per_token": 1.31999e-06,
"input_dbu_cost_per_token": 1.8857e-05,
"litellm_provider": "databricks",
"max_input_tokens": 1000000,
"max_output_tokens": 393216,
"max_tokens": 393216,
"metadata": {
"notes": "Input/output cost per token is dbu cost * $0.070. Billing reads the per-token dollar fields; the '*_dbu_cost_per_token' fields are the published Databricks rates, kept for reference. Context/max output are the DeepSeek-published model limits (1M context, 384K max output)."
},
"mode": "chat",
"output_cost_per_token": 3.95997e-06,
"output_dbu_cost_per_token": 5.6571e-05,
"source": "https://www.databricks.com/product/pricing/foundation-model-serving",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true,
"supports_vision": false
},
"databricks/databricks-gemini-2-5-flash": {
"cache_creation_input_token_cost": 3.0002e-07,
"cache_read_input_token_cost": 3.0002e-08,
@ -20631,6 +20693,7 @@
"supports_image_size": false
},
"gemini-live-2.5-flash-native-audio": {
"deprecation_date": "2026-12-13",
"input_cost_per_audio_token": 3e-06,
"input_cost_per_token": 5e-07,
"litellm_provider": "vertex_ai-language-models",
@ -23852,8 +23915,10 @@
"max_input_tokens": 1024,
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.15,
"source": "https://ai.google.dev/gemini-api/docs/video",
"output_cost_per_second": 0.1,
"output_cost_per_second_1080p": 0.12,
"output_cost_per_second_4k": 0.3,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_modalities": [
"text"
],
@ -23867,7 +23932,8 @@
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.4,
"source": "https://ai.google.dev/gemini-api/docs/video",
"output_cost_per_second_4k": 0.6,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_modalities": [
"text"
],
@ -23895,8 +23961,10 @@
"max_input_tokens": 1024,
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.15,
"source": "https://ai.google.dev/gemini-api/docs/video",
"output_cost_per_second": 0.1,
"output_cost_per_second_1080p": 0.12,
"output_cost_per_second_4k": 0.3,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_modalities": [
"text"
],
@ -23910,7 +23978,8 @@
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.4,
"source": "https://ai.google.dev/gemini-api/docs/video",
"output_cost_per_second_4k": 0.6,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_modalities": [
"text"
],
@ -43440,7 +43509,8 @@
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.4,
"source": "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/veo/3-1-generate",
"output_cost_per_second_4k": 0.6,
"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing",
"supported_modalities": [
"text"
],
@ -43453,8 +43523,10 @@
"max_input_tokens": 1024,
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.15,
"source": "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/veo/3-1-generate",
"output_cost_per_second": 0.1,
"output_cost_per_second_1080p": 0.12,
"output_cost_per_second_4k": 0.3,
"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing",
"supported_modalities": [
"text"
],
@ -43469,7 +43541,8 @@
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.4,
"source": "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/veo/3-1-generate",
"output_cost_per_second_4k": 0.6,
"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing",
"supported_modalities": [
"text"
],
@ -43483,8 +43556,10 @@
"max_input_tokens": 1024,
"max_tokens": 1024,
"mode": "video_generation",
"output_cost_per_second": 0.15,
"source": "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/veo/3-1-generate",
"output_cost_per_second": 0.1,
"output_cost_per_second_1080p": 0.12,
"output_cost_per_second_4k": 0.3,
"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing",
"supported_modalities": [
"text"
],
@ -52231,14 +52306,14 @@
"supports_vision": true
},
"fireworks_ai/deepseek-v4-flash-0731": {
"cache_read_input_token_cost": 2.8e-08,
"input_cost_per_token": 1.4e-07,
"cache_read_input_token_cost": 7e-09,
"input_cost_per_token": 2.2e-07,
"litellm_provider": "fireworks_ai",
"max_input_tokens": 1048576,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 2.8e-07,
"output_cost_per_token": 6.6e-07,
"source": "https://docs.fireworks.ai/serverless/pricing",
"supports_function_calling": true,
"supports_reasoning": true,
@ -55124,5 +55199,55 @@
"max_tokens": 40960,
"mode": "embedding",
"source": "https://docs.fireworks.ai/serverless/pricing"
},
"zai/glm-5.2": {
"cache_creation_input_token_cost": 0,
"cache_read_input_token_cost": 2.6e-07,
"input_cost_per_token": 1.4e-06,
"litellm_provider": "zai",
"max_input_tokens": 1000000,
"max_output_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 4.4e-06,
"source": "https://docs.z.ai/guides/overview/pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"together_ai/Qwen/Qwen3.8-Flash": {
"input_cost_per_token": 1.5e-07,
"litellm_provider": "together_ai",
"max_input_tokens": 1000000,
"max_tokens": 1000000,
"mode": "chat",
"output_cost_per_token": 4.7e-07,
"source": "https://docs.together.ai/docs/serverless-models"
},
"cerebras/gemma-4-31b": {
"input_cost_per_token": 9.9e-07,
"litellm_provider": "cerebras",
"max_input_tokens": 131072,
"max_output_tokens": 40960,
"max_tokens": 40960,
"mode": "chat",
"output_cost_per_token": 1.49e-06,
"source": "https://api.cerebras.ai/public/v1/models/gemma-4-31b",
"supports_function_calling": true,
"supports_parallel_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
},
"elevenlabs/scribe_v2": {
"input_cost_per_second": 6.11e-05,
"litellm_provider": "elevenlabs",
"mode": "audio_transcription",
"output_cost_per_second": 0.0,
"source": "https://elevenlabs.io/pricing/api",
"supported_endpoints": [
"/v1/audio/transcriptions"
]
}
}

View file

@ -62,6 +62,8 @@ PUBLISHED_DBU_PER_MILLION: Final = {
"databricks/databricks-gemini-2-5-pro": ("22.321", "178.571", "22.321", "2.232"),
"databricks/databricks-gemini-2-5-flash": ("5.357", "44.643", "5.357", "0.536"),
"databricks/databricks-kimi-k3": ("42.857", "214.286", "42.857", "4.286"),
"databricks/databricks-deepseek-v4-flash-0731": ("2.000", "4.000", "2.000", "0.400"),
"databricks/databricks-deepseek-v4-pro-0813": ("18.857", "56.571", "18.857", "1.886"),
"databricks/databricks-glm-5-2": ("20.000", "62.857", "20.000", "3.714"),
}
PROMOTIONAL_DISCOUNT: Final = 0.80

View file

@ -84,3 +84,41 @@ def test_bare_fireworks_ids_resolve_through_prefixed_entries():
assert info["output_cost_per_token"] == pytest.approx(expected["output_cost_per_token"])
assert info["max_input_tokens"] == expected["max_input_tokens"]
assert info["max_output_tokens"] == expected["max_output_tokens"]
TWIN_PINNED_PRICES = {
"deepseek-v4-flash-0731": {
"input_cost_per_token": 2.2e-07,
"cache_read_input_token_cost": 7e-09,
"output_cost_per_token": 6.6e-07,
},
}
def test_deepseek_v4_flash_0731_twins_pin_published_pricing(model_data):
"""Both 0731 entries carry the price published at docs.fireworks.ai/serverless/pricing."""
for bare_suffix, expected in TWIN_PINNED_PRICES.items():
for key in (
f"fireworks_ai/{bare_suffix}",
f"fireworks_ai/accounts/fireworks/models/{bare_suffix}",
):
entry = model_data[key]
for field, value in expected.items():
assert entry[field] == pytest.approx(value), f"{key}.{field}"
def test_fireworks_account_prefixed_twins_agree_on_price(model_data):
"""Every accounts/fireworks/models/X entry prices identically to its bare fireworks_ai/X twin."""
prefix = "fireworks_ai/accounts/fireworks/models/"
pairs_checked = 0
for key, entry in model_data.items():
if not key.startswith(prefix):
continue
bare_key = f"fireworks_ai/{key[len(prefix):]}"
bare_entry = model_data.get(bare_key)
if bare_entry is None:
continue
pairs_checked += 1
for field in sorted({f for f in (*entry, *bare_entry) if "cost" in f}):
assert entry.get(field) == bare_entry.get(field), f"{key} vs {bare_key}: {field}"
assert pairs_checked >= 20

View file

@ -532,6 +532,41 @@ class TestVideoGeneration:
assert abs(cost_for("runwayml/seedance2_5", "480p", 8.0) - 1.6) < 0.001
assert abs(cost_for("runwayml/gen4.5", None, 8.0) - 0.96) < 0.001
def test_completion_cost_veo_31_tiers_pin_published_rates(self, monkeypatch):
"""The gemini and vertex_ai veo 3.1 entries bill Google's published per-second tier rates."""
from litellm.cost_calculator import completion_cost
local_map_path = os.path.join(
os.path.dirname(__file__), "..", "..", "model_prices_and_context_window.json"
)
with open(local_map_path, "r") as f:
monkeypatch.setattr(litellm, "model_cost", json.load(f))
def cost_for(model: str, provider: str, resolution: str | None, duration: float) -> float:
mock_response = MagicMock()
mock_response.usage = {
"duration_seconds": duration,
**({"video_resolution": resolution} if resolution else {}),
}
type(mock_response)._hidden_params = {}
return completion_cost(
completion_response=mock_response,
model=model,
call_type="create_video",
custom_llm_provider=provider,
)
for provider in ("gemini", "vertex_ai"):
for suffix in ("generate-preview", "generate-001"):
standard = f"{provider}/veo-3.1-{suffix}"
fast = f"{provider}/veo-3.1-fast-{suffix}"
assert abs(cost_for(standard, provider, None, 8.0) - 3.2) < 1e-6
assert abs(cost_for(standard, provider, "1080p", 8.0) - 3.2) < 1e-6
assert abs(cost_for(standard, provider, "4k", 8.0) - 4.8) < 1e-6
assert abs(cost_for(fast, provider, "720p", 8.0) - 0.8) < 1e-6
assert abs(cost_for(fast, provider, "1080p", 8.0) - 0.96) < 1e-6
assert abs(cost_for(fast, provider, "4k", 8.0) - 2.4) < 1e-6
def test_video_generation_with_files(self):
"""Test video generation with file uploads."""
config = OpenAIVideoConfig()