fix(crusoe): remove trailing slashes from API base URLs and fix list indentation

Trailing slashes on custom API base examples cause double-slash in
get_complete_url. Also fixes inconsistent list indentation in
test_crusoe_models_configuration.
This commit is contained in:
Emmanuel Acheampong 2026-03-20 10:10:26 -07:00 committed by Sameer Kankute
parent 2805572e9b
commit 6e1e6244cf
No known key found for this signature in database
3 changed files with 19 additions and 19 deletions

View File

@ -153,14 +153,14 @@ import litellm
from litellm import completion
# Using environment variable
os.environ["CRUSOE_API_BASE"] = "https://custom.crusoecloud.com/v1/"
os.environ["CRUSOE_API_BASE"] = "https://custom.crusoecloud.com/v1"
os.environ["CRUSOE_API_KEY"] = "" # your API key
# Or pass directly
response = completion(
model="crusoe/meta-llama/Llama-3.3-70B-Instruct",
messages=[{"content": "Hello!", "role": "user"}],
api_base="https://custom.crusoecloud.com/v1/",
api_base="https://custom.crusoecloud.com/v1",
api_key="your-api-key"
)
```

View File

@ -39,11 +39,11 @@ def test_crusoe_get_openai_compatible_provider_info():
os.environ,
{
"CRUSOE_API_KEY": "test-key",
"CRUSOE_API_BASE": "https://custom.crusoecloud.com/v1/",
"CRUSOE_API_BASE": "https://custom.crusoecloud.com/v1",
},
):
api_base, api_key = config._get_openai_compatible_provider_info(None, None)
assert api_base == "https://custom.crusoecloud.com/v1/"
assert api_base == "https://custom.crusoecloud.com/v1"
assert api_key == "test-key"
# Test with explicit parameters (should override env vars)
@ -51,13 +51,13 @@ def test_crusoe_get_openai_compatible_provider_info():
os.environ,
{
"CRUSOE_API_KEY": "env-key",
"CRUSOE_API_BASE": "https://env.crusoecloud.com/v1/",
"CRUSOE_API_BASE": "https://env.crusoecloud.com/v1",
},
):
api_base, api_key = config._get_openai_compatible_provider_info(
"https://param.crusoecloud.com/v1/", "param-key"
"https://param.crusoecloud.com/v1", "param-key"
)
assert api_base == "https://param.crusoecloud.com/v1/"
assert api_base == "https://param.crusoecloud.com/v1"
assert api_key == "param-key"
@ -84,14 +84,14 @@ def test_crusoe_models_configuration():
litellm.model_cost = litellm.get_model_cost_map(url="")
crusoe_models = [
"crusoe/meta-llama/Llama-3.3-70B-Instruct",
"crusoe/deepseek-ai/DeepSeek-R1-0528",
"crusoe/deepseek-ai/DeepSeek-V3-0324",
"crusoe/Qwen/Qwen3-235B-A22B-Instruct-2507",
"crusoe/moonshotai/Kimi-K2-Thinking",
"crusoe/openai/gpt-oss-120b",
"crusoe/google/gemma-3-12b-it",
]
"crusoe/meta-llama/Llama-3.3-70B-Instruct",
"crusoe/deepseek-ai/DeepSeek-R1-0528",
"crusoe/deepseek-ai/DeepSeek-V3-0324",
"crusoe/Qwen/Qwen3-235B-A22B-Instruct-2507",
"crusoe/moonshotai/Kimi-K2-Thinking",
"crusoe/openai/gpt-oss-120b",
"crusoe/google/gemma-3-12b-it",
]
for model in crusoe_models:
model_info = get_model_info(model)

View File

@ -39,11 +39,11 @@ def test_crusoe_dynamic_config_env_vars():
with patch.dict(
os.environ,
{"CRUSOE_API_KEY": "test-key", "CRUSOE_API_BASE": "https://custom.crusoe.com/v1/"},
{"CRUSOE_API_KEY": "test-key", "CRUSOE_API_BASE": "https://custom.crusoe.com/v1"},
):
api_base, api_key = config._get_openai_compatible_provider_info(None, None)
assert api_base == "https://custom.crusoe.com/v1/"
assert api_base == "https://custom.crusoe.com/v1"
assert api_key == "test-key"
@ -56,10 +56,10 @@ def test_crusoe_dynamic_config_explicit_params():
with patch.dict(os.environ, {"CRUSOE_API_KEY": "env-key"}):
api_base, api_key = config._get_openai_compatible_provider_info(
"https://override.crusoe.com/v1/", "override-key"
"https://override.crusoe.com/v1", "override-key"
)
assert api_base == "https://override.crusoe.com/v1/"
assert api_base == "https://override.crusoe.com/v1"
assert api_key == "override-key"