Skip to content

Add Claude 4 Sonnet & Opus, DeepSeek R1, and fix Llama Vision model pricing configurations #11339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
5cbacab
fix: update model path for llama-v3p2-90b-vision-instruct in pricing …
colesmcintosh Jun 2, 2025
d8672d6
feat: add deepseek-r1-0528 model configuration to pricing JSON
colesmcintosh Jun 3, 2025
01930c0
feat: add configurations for new Claude 4 model alias to pricing JSON
colesmcintosh Jun 3, 2025
13a1a5a
Merge branch 'BerriAI:main' into add-claude4-sonnet-fireworks-deepsee…
colesmcintosh Jun 3, 2025
c0c9c39
undo prefix change
colesmcintosh Jun 3, 2025
7952562
fix: update supports_response_schema to false in pricing JSON for lit…
colesmcintosh Jun 3, 2025
a1e2961
update supports_tool_choice and supports_response_schema
colesmcintosh Jun 3, 2025
8a1372e
Merge branch 'BerriAI:main' into add-claude4-sonnet-fireworks-deepsee…
colesmcintosh Jun 3, 2025
4d25e71
Merge branch 'BerriAI:main' into add-claude4-sonnet-fireworks-deepsee…
colesmcintosh Jun 3, 2025
8e32478
Update model configuration to disable function calling and tool choic…
colesmcintosh Jun 3, 2025
58a81ec
Merge branch 'BerriAI:main' into add-claude4-sonnet-fireworks-deepsee…
colesmcintosh Jun 3, 2025
f8a5891
Merge branch 'BerriAI:main' into add-claude4-sonnet-fireworks-deepsee…
colesmcintosh Jun 3, 2025
5f6632b
Refactor FireworksAIConfig to use supports_function_calling from utils
colesmcintosh Jun 3, 2025
ecbdb76
Merge branch 'BerriAI:main' into add-claude4-sonnet-fireworks-deepsee…
colesmcintosh Jun 4, 2025
7acfed6
Merge branch 'BerriAI:main' into add-claude4-sonnet-fireworks-deepsee…
colesmcintosh Jun 4, 2025
0a57b73
Enhance FireworksAIConfig to conditionally support tool_choice based …
colesmcintosh Jun 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions litellm/llms/fireworks_ai/chat/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
ModelResponse,
ProviderSpecificModelInfo,
)
from litellm.utils import supports_function_calling, supports_tool_choice

from ...openai.chat.gpt_transformation import OpenAIGPTConfig
from ..common_utils import FireworksAIException
Expand Down Expand Up @@ -83,10 +84,9 @@ def get_config(cls):
return super().get_config()

def get_supported_openai_params(self, model: str):
return [
# Base parameters supported by all models
supported_params = [
"stream",
"tools",
"tool_choice",
"max_completion_tokens",
"max_tokens",
"temperature",
Expand All @@ -102,6 +102,16 @@ def get_supported_openai_params(self, model: str):
"prompt_truncate_length",
"context_length_exceeded_behavior",
]

# Only add tools for models that support function calling
if supports_function_calling(model=model, custom_llm_provider="fireworks_ai"):
supported_params.append("tools")

# Only add tool_choice for models that explicitly support it
if supports_tool_choice(model=model, custom_llm_provider="fireworks_ai"):
supported_params.append("tool_choice")

return supported_params

def map_openai_params(
self,
Expand Down
113 changes: 89 additions & 24 deletions model_prices_and_context_window.json
Original file line number Diff line number Diff line change
Expand Up @@ -5031,6 +5031,58 @@
"supports_reasoning": true,
"supports_computer_use": true
},
"claude-4-opus-20250514": {
"max_tokens": 32000,
"max_input_tokens": 200000,
"max_output_tokens": 32000,
"input_cost_per_token": 1.5e-05,
"output_cost_per_token": 7.5e-05,
"search_context_cost_per_query": {
"search_context_size_low": 0.01,
"search_context_size_medium": 0.01,
"search_context_size_high": 0.01
},
"cache_creation_input_token_cost": 1.875e-05,
"cache_read_input_token_cost": 1.5e-06,
"litellm_provider": "anthropic",
"mode": "chat",
"supports_function_calling": true,
"supports_vision": true,
"tool_use_system_prompt_tokens": 159,
"supports_assistant_prefill": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_computer_use": true
},
"claude-4-sonnet-20250514": {
"max_tokens": 64000,
"max_input_tokens": 200000,
"max_output_tokens": 64000,
"input_cost_per_token": 3e-06,
"output_cost_per_token": 1.5e-05,
"search_context_cost_per_query": {
"search_context_size_low": 0.01,
"search_context_size_medium": 0.01,
"search_context_size_high": 0.01
},
"cache_creation_input_token_cost": 3.75e-06,
"cache_read_input_token_cost": 3e-07,
"litellm_provider": "anthropic",
"mode": "chat",
"supports_function_calling": true,
"supports_vision": true,
"tool_use_system_prompt_tokens": 159,
"supports_assistant_prefill": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_computer_use": true
},
"claude-3-7-sonnet-latest": {
"supports_computer_use": true,
"max_tokens": 128000,
Expand Down Expand Up @@ -12689,10 +12741,10 @@
"output_cost_per_token": 1e-07,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_function_calling": false,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/llama-v3p2-3b-instruct": {
"max_tokens": 16384,
Expand All @@ -12702,10 +12754,10 @@
"output_cost_per_token": 1e-07,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_function_calling": false,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/llama-v3p1-8b-instruct": {
"max_tokens": 16384,
Expand All @@ -12715,10 +12767,10 @@
"output_cost_per_token": 1e-07,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_function_calling": false,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/llama-v3p2-11b-vision-instruct": {
"max_tokens": 16384,
Expand All @@ -12728,21 +12780,21 @@
"output_cost_per_token": 2e-07,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_function_calling": false,
"supports_vision": true,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"accounts/fireworks/models/llama-v3p2-90b-vision-instruct": {
"fireworks_ai/accounts/fireworks/models/llama-v3p2-90b-vision-instruct": {
"max_tokens": 16384,
"max_input_tokens": 16384,
"max_output_tokens": 16384,
"input_cost_per_token": 9e-07,
"output_cost_per_token": 9e-07,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_tool_choice": false,
"supports_vision": true,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing"
Expand Down Expand Up @@ -12781,10 +12833,10 @@
"output_cost_per_token": 9e-07,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_function_calling": false,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/qwen2p5-coder-32b-instruct": {
"max_tokens": 4096,
Expand All @@ -12794,10 +12846,10 @@
"output_cost_per_token": 9e-07,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_function_calling": false,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/yi-large": {
"max_tokens": 32768,
Expand All @@ -12807,10 +12859,10 @@
"output_cost_per_token": 3e-06,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_function_calling": false,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/deepseek-coder-v2-instruct": {
"max_tokens": 65536,
Expand All @@ -12820,10 +12872,10 @@
"output_cost_per_token": 1.2e-06,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"supports_function_calling": true,
"supports_function_calling": false,
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/deepseek-v3": {
"max_tokens": 8192,
Expand All @@ -12835,7 +12887,7 @@
"mode": "chat",
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/deepseek-r1": {
"max_tokens": 20480,
Expand All @@ -12847,7 +12899,7 @@
"mode": "chat",
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/deepseek-r1-basic": {
"max_tokens": 20480,
Expand All @@ -12859,7 +12911,19 @@
"mode": "chat",
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/deepseek-r1-0528": {
"max_tokens": 160000,
"max_input_tokens": 160000,
"max_output_tokens": 160000,
"input_cost_per_token": 3e-06,
"output_cost_per_token": 8e-06,
"litellm_provider": "fireworks_ai",
"mode": "chat",
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": false,
"supports_response_schema": true
},
"fireworks_ai/accounts/fireworks/models/llama-v3p1-405b-instruct": {
"max_tokens": 16384,
Expand All @@ -12871,7 +12935,8 @@
"mode": "chat",
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": true,
"supports_function_calling": true
},
"fireworks_ai/accounts/fireworks/models/llama4-maverick-instruct-basic": {
"max_tokens": 131072,
Expand All @@ -12883,7 +12948,7 @@
"mode": "chat",
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/accounts/fireworks/models/llama4-scout-instruct-basic": {
"max_tokens": 131072,
Expand All @@ -12895,7 +12960,7 @@
"mode": "chat",
"supports_response_schema": true,
"source": "https://fireworks.ai/pricing",
"supports_tool_choice": true
"supports_tool_choice": false
},
"fireworks_ai/nomic-ai/nomic-embed-text-v1.5": {
"max_tokens": 8192,
Expand Down
Loading