mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix(bedrock): correct max_output_tokens for moonshotai.kimi-k2.5 (#23334)
* fix(bedrock): correct max_output_tokens for moonshotai.kimi-k2.5 from 262144 to 65536 Fixes #22478. The max_output_tokens for all Bedrock moonshotai.kimi-k2.5 variants was incorrectly set to 262144 (the full context window size). Bedrock enforces input_tokens + max_tokens <= context_window, so sending max_tokens=262144 causes requests to fail. Corrected to 65536 (64K) for all 10 entries across both JSON files, and added a regression test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: improve assertion message per review feedback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add assertion for bare bedrock/moonshotai.kimi-k2.5 entry Closes coverage gap identified by Greptile review - the bare bedrock/moonshotai.kimi-k2.5 key (no region prefix) was fixed in the JSON but not covered by any test assertion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: RheagalFire <arishalam121@gmail.com>
This commit is contained in:
parent
d34daeeda0
commit
9c01c08df2
3 changed files with 76 additions and 43 deletions
|
|
@ -6634,8 +6634,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -6672,8 +6672,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.03e-06,
|
||||
"source": "https://platform.moonshot.ai/docs/guide/kimi-k2-5-quickstart",
|
||||
|
|
@ -6743,8 +6743,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -6796,8 +6796,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -6867,8 +6867,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -7211,8 +7211,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -7411,8 +7411,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -7475,8 +7475,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -7957,8 +7957,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -21900,8 +21900,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock_converse",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
|
|||
|
|
@ -6634,8 +6634,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -6672,8 +6672,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.03e-06,
|
||||
"source": "https://platform.moonshot.ai/docs/guide/kimi-k2-5-quickstart",
|
||||
|
|
@ -6743,8 +6743,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -6796,8 +6796,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -6867,8 +6867,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -7211,8 +7211,8 @@
|
|||
"input_cost_per_token": 7.2e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.6e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -7411,8 +7411,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -7475,8 +7475,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -7957,8 +7957,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
@ -21974,8 +21974,8 @@
|
|||
"input_cost_per_token": 6e-07,
|
||||
"litellm_provider": "bedrock_converse",
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"max_tokens": 262144,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3e-06,
|
||||
"supports_function_calling": true,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ MODEL_CONFIGS = [
|
|||
"us-west-2",
|
||||
],
|
||||
262144,
|
||||
262144,
|
||||
65536,
|
||||
),
|
||||
(
|
||||
"qwen.qwen3-coder-next",
|
||||
|
|
@ -158,10 +158,43 @@ class TestModelSpecificFeatures:
|
|||
assert model_info["max_output_tokens"] == 8192
|
||||
|
||||
def test_moonshotai_kimi_k2_5_context_window(self):
|
||||
"""Moonshot AI Kimi K2.5 has 256K context window"""
|
||||
"""Moonshot AI Kimi K2.5 has 256K input, 64K output"""
|
||||
model_info = get_model_info("bedrock/us-east-1/moonshotai.kimi-k2.5")
|
||||
assert model_info["max_input_tokens"] == 262144
|
||||
assert model_info["max_output_tokens"] == 262144
|
||||
assert model_info["max_output_tokens"] == 65536
|
||||
|
||||
def test_moonshotai_kimi_k2_5_output_less_than_context_window(self):
|
||||
"""Regression test for #22478: max_output_tokens must be < context window.
|
||||
|
||||
Bedrock enforces input_tokens + max_tokens <= context_window, so
|
||||
max_output_tokens cannot equal the full 262144 context window.
|
||||
"""
|
||||
for region in [
|
||||
"us-east-1",
|
||||
"us-east-2",
|
||||
"us-west-2",
|
||||
"ap-northeast-1",
|
||||
"ap-south-1",
|
||||
]:
|
||||
model_info = get_model_info(f"bedrock/{region}/moonshotai.kimi-k2.5")
|
||||
assert model_info["max_output_tokens"] == 65536, (
|
||||
f"bedrock/{region}/moonshotai.kimi-k2.5 max_output_tokens should be "
|
||||
f"65536, got {model_info['max_output_tokens']}"
|
||||
)
|
||||
assert model_info["max_output_tokens"] < model_info["max_input_tokens"], (
|
||||
f"max_output_tokens ({model_info['max_output_tokens']}) must be less "
|
||||
f"than max_input_tokens ({model_info['max_input_tokens']}) to satisfy "
|
||||
f"Bedrock constraint: input_tokens + max_tokens <= context_window"
|
||||
)
|
||||
|
||||
# Also check the bare model entries
|
||||
bare_bedrock_info = get_model_info("bedrock/moonshotai.kimi-k2.5")
|
||||
assert bare_bedrock_info["max_output_tokens"] == 65536
|
||||
assert bare_bedrock_info["max_input_tokens"] == 262144
|
||||
|
||||
bare_info = get_model_info("moonshotai.kimi-k2.5")
|
||||
assert bare_info["max_output_tokens"] == 65536
|
||||
assert bare_info["max_input_tokens"] == 262144
|
||||
|
||||
def test_qwen3_coder_next_context_window(self):
|
||||
"""Qwen3 Coder Next has 256K input, 8K output"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue