Skip to content

Commit 197c608

Browse files
authored
[Feat] Add claude-4 model family (#11060)
* add new claude-sonnet-4-2025051 * feat: add bedrock claude-4 models * add bedrock claude-4 models * add vertx_ai/claude-sonnet-4 * fix provider=bedrock_converse * feat: ensure thinking is supported for claude-4 model family
1 parent 2c90ca0 commit 197c608

File tree

5 files changed

+532
-5
lines changed

5 files changed

+532
-5
lines changed

litellm/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ def identify(event_details):
354354
config_path = None
355355
vertex_ai_safety_settings: Optional[dict] = None
356356
BEDROCK_CONVERSE_MODELS = [
357+
"anthropic.claude-opus-4-20250514-v1:0",
358+
"anthropic.claude-sonnet-4-20250514-v1:0",
357359
"anthropic.claude-3-7-sonnet-20250219-v1:0",
358360
"anthropic.claude-3-5-haiku-20241022-v1:0",
359361
"anthropic.claude-3-5-sonnet-20241022-v2:0",

litellm/llms/anthropic/chat/transformation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Usage,
5050
add_dummy_tool,
5151
has_tool_call_blocks,
52+
supports_reasoning,
5253
token_counter,
5354
)
5455

@@ -121,7 +122,10 @@ def get_supported_openai_params(self, model: str):
121122
"web_search_options",
122123
]
123124

124-
if "claude-3-7-sonnet" in model:
125+
if "claude-3-7-sonnet" in model or supports_reasoning(
126+
model=model,
127+
custom_llm_provider=self.custom_llm_provider,
128+
):
125129
params.append("thinking")
126130

127131
return params

litellm/llms/bedrock/chat/converse_transformation.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
PromptTokensDetailsWrapper,
4646
Usage,
4747
)
48-
from litellm.utils import add_dummy_tool, has_tool_call_blocks
48+
from litellm.utils import add_dummy_tool, has_tool_call_blocks, supports_reasoning
4949

5050
from ..common_utils import BedrockError, BedrockModelInfo, get_bedrock_tool_name
5151

@@ -146,9 +146,10 @@ def get_supported_openai_params(self, model: str) -> List[str]:
146146
# only anthropic and mistral support tool choice config. otherwise (E.g. cohere) will fail the call - https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolChoice.html
147147
supported_params.append("tool_choice")
148148

149-
if (
150-
"claude-3-7" in model
151-
): # [TODO]: move to a 'supports_reasoning_content' param from model cost map
149+
if "claude-3-7" in model or supports_reasoning(
150+
model=model,
151+
custom_llm_provider=self.custom_llm_provider,
152+
):
152153
supported_params.append("thinking")
153154
supported_params.append("reasoning_effort")
154155
return supported_params

litellm/model_prices_and_context_window_backup.json

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4684,6 +4684,58 @@
46844684
"deprecation_date": "2025-06-01",
46854685
"supports_tool_choice": true
46864686
},
4687+
"claude-opus-4-20250514": {
4688+
"max_tokens": 128000,
4689+
"max_input_tokens": 200000,
4690+
"max_output_tokens": 128000,
4691+
"input_cost_per_token": 15e-6,
4692+
"output_cost_per_token": 75e-6,
4693+
"search_context_cost_per_query": {
4694+
"search_context_size_low": 1e-2,
4695+
"search_context_size_medium": 1e-2,
4696+
"search_context_size_high": 1e-2
4697+
},
4698+
"cache_creation_input_token_cost": 18.75e-6,
4699+
"cache_read_input_token_cost": 1.5e-6,
4700+
"litellm_provider": "anthropic",
4701+
"mode": "chat",
4702+
"supports_function_calling": true,
4703+
"supports_vision": true,
4704+
"tool_use_system_prompt_tokens": 159,
4705+
"supports_assistant_prefill": true,
4706+
"supports_pdf_input": true,
4707+
"supports_prompt_caching": true,
4708+
"supports_response_schema": true,
4709+
"supports_tool_choice": true,
4710+
"supports_reasoning": true,
4711+
"supports_computer_use": true
4712+
},
4713+
"claude-sonnet-4-20250514": {
4714+
"max_tokens": 128000,
4715+
"max_input_tokens": 200000,
4716+
"max_output_tokens": 128000,
4717+
"input_cost_per_token": 3e-6,
4718+
"output_cost_per_token": 15e-6,
4719+
"search_context_cost_per_query": {
4720+
"search_context_size_low": 1e-2,
4721+
"search_context_size_medium": 1e-2,
4722+
"search_context_size_high": 1e-2
4723+
},
4724+
"cache_creation_input_token_cost": 3.75e-6,
4725+
"cache_read_input_token_cost": 0.3e-6,
4726+
"litellm_provider": "anthropic",
4727+
"mode": "chat",
4728+
"supports_function_calling": true,
4729+
"supports_vision": true,
4730+
"tool_use_system_prompt_tokens": 159,
4731+
"supports_assistant_prefill": true,
4732+
"supports_pdf_input": true,
4733+
"supports_prompt_caching": true,
4734+
"supports_response_schema": true,
4735+
"supports_tool_choice": true,
4736+
"supports_reasoning": true,
4737+
"supports_computer_use": true
4738+
},
46874739
"claude-3-7-sonnet-latest": {
46884740
"supports_computer_use": true,
46894741
"max_tokens": 128000,
@@ -6753,6 +6805,58 @@
67536805
"supports_reasoning": true,
67546806
"supports_tool_choice": true
67556807
},
6808+
"vertex_ai/claude-opus-4@20250514": {
6809+
"max_tokens": 128000,
6810+
"max_input_tokens": 200000,
6811+
"max_output_tokens": 128000,
6812+
"input_cost_per_token": 15e-6,
6813+
"output_cost_per_token": 75e-6,
6814+
"search_context_cost_per_query": {
6815+
"search_context_size_low": 1e-2,
6816+
"search_context_size_medium": 1e-2,
6817+
"search_context_size_high": 1e-2
6818+
},
6819+
"cache_creation_input_token_cost": 18.75e-6,
6820+
"cache_read_input_token_cost": 1.5e-6,
6821+
"litellm_provider": "vertex_ai-anthropic_models",
6822+
"mode": "chat",
6823+
"supports_function_calling": true,
6824+
"supports_vision": true,
6825+
"tool_use_system_prompt_tokens": 159,
6826+
"supports_assistant_prefill": true,
6827+
"supports_pdf_input": true,
6828+
"supports_prompt_caching": true,
6829+
"supports_response_schema": true,
6830+
"supports_tool_choice": true,
6831+
"supports_reasoning": true,
6832+
"supports_computer_use": true
6833+
},
6834+
"vertex_ai/claude-sonnet-4@20250514": {
6835+
"max_tokens": 128000,
6836+
"max_input_tokens": 200000,
6837+
"max_output_tokens": 128000,
6838+
"input_cost_per_token": 3e-6,
6839+
"output_cost_per_token": 15e-6,
6840+
"search_context_cost_per_query": {
6841+
"search_context_size_low": 1e-2,
6842+
"search_context_size_medium": 1e-2,
6843+
"search_context_size_high": 1e-2
6844+
},
6845+
"cache_creation_input_token_cost": 3.75e-6,
6846+
"cache_read_input_token_cost": 0.3e-6,
6847+
"litellm_provider": "vertex_ai-anthropic_models",
6848+
"mode": "chat",
6849+
"supports_function_calling": true,
6850+
"supports_vision": true,
6851+
"tool_use_system_prompt_tokens": 159,
6852+
"supports_assistant_prefill": true,
6853+
"supports_pdf_input": true,
6854+
"supports_prompt_caching": true,
6855+
"supports_response_schema": true,
6856+
"supports_tool_choice": true,
6857+
"supports_reasoning": true,
6858+
"supports_computer_use": true
6859+
},
67566860
"vertex_ai/claude-3-haiku": {
67576861
"max_tokens": 4096,
67586862
"max_input_tokens": 200000,
@@ -9332,6 +9436,58 @@
93329436
"supports_pdf_input": true,
93339437
"supports_tool_choice": true
93349438
},
9439+
"anthropic.claude-opus-4-20250514-v1:0": {
9440+
"max_tokens": 128000,
9441+
"max_input_tokens": 200000,
9442+
"max_output_tokens": 128000,
9443+
"input_cost_per_token": 15e-6,
9444+
"output_cost_per_token": 75e-6,
9445+
"search_context_cost_per_query": {
9446+
"search_context_size_low": 1e-2,
9447+
"search_context_size_medium": 1e-2,
9448+
"search_context_size_high": 1e-2
9449+
},
9450+
"cache_creation_input_token_cost": 18.75e-6,
9451+
"cache_read_input_token_cost": 1.5e-6,
9452+
"litellm_provider": "bedrock_converse",
9453+
"mode": "chat",
9454+
"supports_function_calling": true,
9455+
"supports_vision": true,
9456+
"tool_use_system_prompt_tokens": 159,
9457+
"supports_assistant_prefill": true,
9458+
"supports_pdf_input": true,
9459+
"supports_prompt_caching": true,
9460+
"supports_response_schema": true,
9461+
"supports_tool_choice": true,
9462+
"supports_reasoning": true,
9463+
"supports_computer_use": true
9464+
},
9465+
"anthropic.claude-sonnet-4-20250514-v1:0": {
9466+
"max_tokens": 128000,
9467+
"max_input_tokens": 200000,
9468+
"max_output_tokens": 128000,
9469+
"input_cost_per_token": 3e-6,
9470+
"output_cost_per_token": 15e-6,
9471+
"search_context_cost_per_query": {
9472+
"search_context_size_low": 1e-2,
9473+
"search_context_size_medium": 1e-2,
9474+
"search_context_size_high": 1e-2
9475+
},
9476+
"cache_creation_input_token_cost": 3.75e-6,
9477+
"cache_read_input_token_cost": 0.3e-6,
9478+
"litellm_provider": "bedrock_converse",
9479+
"mode": "chat",
9480+
"supports_function_calling": true,
9481+
"supports_vision": true,
9482+
"tool_use_system_prompt_tokens": 159,
9483+
"supports_assistant_prefill": true,
9484+
"supports_pdf_input": true,
9485+
"supports_prompt_caching": true,
9486+
"supports_response_schema": true,
9487+
"supports_tool_choice": true,
9488+
"supports_reasoning": true,
9489+
"supports_computer_use": true
9490+
},
93359491
"anthropic.claude-3-7-sonnet-20250219-v1:0": {
93369492
"supports_computer_use": true,
93379493
"max_tokens": 8192,
@@ -9482,6 +9638,58 @@
94829638
"supports_tool_choice": true,
94839639
"supports_reasoning": true
94849640
},
9641+
"us.anthropic.claude-opus-4-20250514-v1:0": {
9642+
"max_tokens": 128000,
9643+
"max_input_tokens": 200000,
9644+
"max_output_tokens": 128000,
9645+
"input_cost_per_token": 15e-6,
9646+
"output_cost_per_token": 75e-6,
9647+
"search_context_cost_per_query": {
9648+
"search_context_size_low": 1e-2,
9649+
"search_context_size_medium": 1e-2,
9650+
"search_context_size_high": 1e-2
9651+
},
9652+
"cache_creation_input_token_cost": 18.75e-6,
9653+
"cache_read_input_token_cost": 1.5e-6,
9654+
"litellm_provider": "bedrock_converse",
9655+
"mode": "chat",
9656+
"supports_function_calling": true,
9657+
"supports_vision": true,
9658+
"tool_use_system_prompt_tokens": 159,
9659+
"supports_assistant_prefill": true,
9660+
"supports_pdf_input": true,
9661+
"supports_prompt_caching": true,
9662+
"supports_response_schema": true,
9663+
"supports_tool_choice": true,
9664+
"supports_reasoning": true,
9665+
"supports_computer_use": true
9666+
},
9667+
"us.anthropic.claude-sonnet-4-20250514-v1:0": {
9668+
"max_tokens": 128000,
9669+
"max_input_tokens": 200000,
9670+
"max_output_tokens": 128000,
9671+
"input_cost_per_token": 3e-6,
9672+
"output_cost_per_token": 15e-6,
9673+
"search_context_cost_per_query": {
9674+
"search_context_size_low": 1e-2,
9675+
"search_context_size_medium": 1e-2,
9676+
"search_context_size_high": 1e-2
9677+
},
9678+
"cache_creation_input_token_cost": 3.75e-6,
9679+
"cache_read_input_token_cost": 0.3e-6,
9680+
"litellm_provider": "bedrock_converse",
9681+
"mode": "chat",
9682+
"supports_function_calling": true,
9683+
"supports_vision": true,
9684+
"tool_use_system_prompt_tokens": 159,
9685+
"supports_assistant_prefill": true,
9686+
"supports_pdf_input": true,
9687+
"supports_prompt_caching": true,
9688+
"supports_response_schema": true,
9689+
"supports_tool_choice": true,
9690+
"supports_reasoning": true,
9691+
"supports_computer_use": true
9692+
},
94859693
"us.anthropic.claude-3-haiku-20240307-v1:0": {
94869694
"max_tokens": 4096,
94879695
"max_input_tokens": 200000,
@@ -9603,6 +9811,58 @@
96039811
"supports_pdf_input": true,
96049812
"supports_tool_choice": true
96059813
},
9814+
"eu.anthropic.claude-opus-4-20250514-v1:0": {
9815+
"max_tokens": 128000,
9816+
"max_input_tokens": 200000,
9817+
"max_output_tokens": 128000,
9818+
"input_cost_per_token": 15e-6,
9819+
"output_cost_per_token": 75e-6,
9820+
"search_context_cost_per_query": {
9821+
"search_context_size_low": 1e-2,
9822+
"search_context_size_medium": 1e-2,
9823+
"search_context_size_high": 1e-2
9824+
},
9825+
"cache_creation_input_token_cost": 18.75e-6,
9826+
"cache_read_input_token_cost": 1.5e-6,
9827+
"litellm_provider": "bedrock_converse",
9828+
"mode": "chat",
9829+
"supports_function_calling": true,
9830+
"supports_vision": true,
9831+
"tool_use_system_prompt_tokens": 159,
9832+
"supports_assistant_prefill": true,
9833+
"supports_pdf_input": true,
9834+
"supports_prompt_caching": true,
9835+
"supports_response_schema": true,
9836+
"supports_tool_choice": true,
9837+
"supports_reasoning": true,
9838+
"supports_computer_use": true
9839+
},
9840+
"eu.anthropic.claude-sonnet-4-20250514-v1:0": {
9841+
"max_tokens": 128000,
9842+
"max_input_tokens": 200000,
9843+
"max_output_tokens": 128000,
9844+
"input_cost_per_token": 3e-6,
9845+
"output_cost_per_token": 15e-6,
9846+
"search_context_cost_per_query": {
9847+
"search_context_size_low": 1e-2,
9848+
"search_context_size_medium": 1e-2,
9849+
"search_context_size_high": 1e-2
9850+
},
9851+
"cache_creation_input_token_cost": 3.75e-6,
9852+
"cache_read_input_token_cost": 0.3e-6,
9853+
"litellm_provider": "bedrock_converse",
9854+
"mode": "chat",
9855+
"supports_function_calling": true,
9856+
"supports_vision": true,
9857+
"tool_use_system_prompt_tokens": 159,
9858+
"supports_assistant_prefill": true,
9859+
"supports_pdf_input": true,
9860+
"supports_prompt_caching": true,
9861+
"supports_response_schema": true,
9862+
"supports_tool_choice": true,
9863+
"supports_reasoning": true,
9864+
"supports_computer_use": true
9865+
},
96069866
"eu.anthropic.claude-3-5-haiku-20241022-v1:0": {
96079867
"max_tokens": 8192,
96089868
"max_input_tokens": 200000,

0 commit comments

Comments
 (0)