From b99dfe70d18ff6841b8c1045f05c0e9619c762c6 Mon Sep 17 00:00:00 2001 From: Emmanuel Acheampong Date: Fri, 20 Mar 2026 10:00:57 -0700 Subject: [PATCH] =?UTF-8?q?fix(crusoe):=20add=20param=5Fmappings=20for=20m?= =?UTF-8?q?ax=5Fcompletion=5Ftokens=20=E2=86=92=20max=5Ftokens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Crusoe's vLLM-based endpoint accepts max_tokens, not max_completion_tokens. Without this mapping, callers using the OpenAI-standard param would get errors. --- litellm/llms/openai_like/providers.json | 5 ++++- tests/test_litellm/llms/crusoe/test_crusoe.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/litellm/llms/openai_like/providers.json b/litellm/llms/openai_like/providers.json index 2f64553c50a..8c2f5fa4ffb 100644 --- a/litellm/llms/openai_like/providers.json +++ b/litellm/llms/openai_like/providers.json @@ -105,6 +105,9 @@ "crusoe": { "base_url": "https://managed-inference-api-proxy.crusoecloud.com/v1", "api_key_env": "CRUSOE_API_KEY", - "api_base_env": "CRUSOE_API_BASE" + "api_base_env": "CRUSOE_API_BASE", + "param_mappings": { + "max_completion_tokens": "max_tokens" + } } } diff --git a/tests/test_litellm/llms/crusoe/test_crusoe.py b/tests/test_litellm/llms/crusoe/test_crusoe.py index 70c538d915a..877d13451be 100644 --- a/tests/test_litellm/llms/crusoe/test_crusoe.py +++ b/tests/test_litellm/llms/crusoe/test_crusoe.py @@ -78,6 +78,24 @@ def test_crusoe_supported_params(): assert "stream" in params +def test_crusoe_param_mapping_max_completion_tokens(): + """Test max_completion_tokens is mapped to max_tokens for Crusoe""" + from litellm.llms.openai_like.dynamic_config import create_config_class + from litellm.llms.openai_like.json_loader import JSONProviderRegistry + + config = create_config_class(JSONProviderRegistry.get("crusoe"))() + optional_params = config.map_openai_params( + non_default_params={"max_completion_tokens": 1024}, + optional_params={}, + model="meta-llama/Llama-3.3-70B-Instruct", + drop_params=False, + ) + + assert "max_tokens" in optional_params, "max_completion_tokens should be mapped to max_tokens" + assert optional_params["max_tokens"] == 1024 + assert "max_completion_tokens" not in optional_params + + def test_crusoe_provider_detection_by_prefix(): """Test crusoe/model prefix is correctly routed""" from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider