mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
update provider SDK, upgrade Qwen models, add Gemma 4 26B
This commit is contained in:
parent
cf77c636f7
commit
e2a4ba7ff3
4 changed files with 73 additions and 48 deletions
|
|
@ -3,7 +3,7 @@
|
|||
## Overview
|
||||
|
||||
| Property | Details |
|
||||
|-------|-------|
|
||||
| ------- | ------- |
|
||||
| Description | SaladCloud AI Gateway is an OpenAI-compatible LLM API service powered by distributed GPU infrastructure. |
|
||||
| Provider Route on LiteLLM | `salad_cloud/` |
|
||||
| Link to Provider Doc | [SaladCloud AI Gateway ↗](https://docs.salad.com/ai-gateway/explanation/overview) |
|
||||
|
|
@ -12,13 +12,11 @@
|
|||
## Required Variables
|
||||
|
||||
```python showLineNumbers title="Environment Variables"
|
||||
os.environ["SALAD_API_KEY"] = "" # your SaladCloud API key
|
||||
os.environ["SALAD_CLOUD_API_KEY"] = "" # your SaladCloud API key
|
||||
```
|
||||
|
||||
Get your SaladCloud API key by signing up at [portal.salad.com](https://portal.salad.com/)
|
||||
|
||||
While the service is in beta, sign up at [salad.com/ai-gateway](https://salad.com/ai-gateway).
|
||||
|
||||
## Usage - LiteLLM Python SDK
|
||||
|
||||
### Non-streaming
|
||||
|
|
@ -28,12 +26,12 @@ import os
|
|||
import litellm
|
||||
from litellm import completion
|
||||
|
||||
os.environ["SALAD_API_KEY"] = "" # your SaladCloud API key
|
||||
os.environ["SALAD_CLOUD_API_KEY"] = "" # your SaladCloud API key
|
||||
|
||||
messages = [{"content": "What is the capital of France?", "role": "user"}]
|
||||
|
||||
response = completion(
|
||||
model="salad_cloud/qwen3.5-35b-a3b",
|
||||
model="salad_cloud/qwen3.6-35b-a3b",
|
||||
messages=messages
|
||||
)
|
||||
|
||||
|
|
@ -47,12 +45,12 @@ import os
|
|||
import litellm
|
||||
from litellm import completion
|
||||
|
||||
os.environ["SALAD_API_KEY"] = "" # your SaladCloud API key
|
||||
os.environ["SALAD_CLOUD_API_KEY"] = "" # your SaladCloud API key
|
||||
|
||||
messages = [{"content": "Write a short poem about distributed computing.", "role": "user"}]
|
||||
|
||||
response = completion(
|
||||
model="salad_cloud/qwen3.5-35b-a3b",
|
||||
model="salad_cloud/qwen3.6-35b-a3b",
|
||||
messages=messages,
|
||||
stream=True
|
||||
)
|
||||
|
|
@ -66,34 +64,40 @@ for chunk in response:
|
|||
### 1. Save key in your environment
|
||||
|
||||
```bash
|
||||
export SALAD_API_KEY=""
|
||||
export SALAD_CLOUD_API_KEY=""
|
||||
```
|
||||
|
||||
### 2. Start the proxy
|
||||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: qwen3.5-35b
|
||||
- model_name: qwen3.6-35b
|
||||
litellm_params:
|
||||
model: salad_cloud/qwen3.5-35b-a3b
|
||||
api_key: os.environ/SALAD_API_KEY
|
||||
- model_name: qwen3.5-27b
|
||||
model: salad_cloud/qwen3.6-35b-a3b
|
||||
api_key: os.environ/SALAD_CLOUD_API_KEY
|
||||
- model_name: qwen3.6-27b
|
||||
litellm_params:
|
||||
model: salad_cloud/qwen3.5-27b
|
||||
api_key: os.environ/SALAD_API_KEY
|
||||
model: salad_cloud/qwen3.6-27b
|
||||
api_key: os.environ/SALAD_CLOUD_API_KEY
|
||||
- model_name: qwen3.5-9b
|
||||
litellm_params:
|
||||
model: salad_cloud/qwen3.5-9b
|
||||
api_key: os.environ/SALAD_API_KEY
|
||||
api_key: os.environ/SALAD_CLOUD_API_KEY
|
||||
- model_name: gemma-4-26b-a4b-instruct
|
||||
litellm_params:
|
||||
model: salad_cloud/gemma-4-26b-a4b-instruct
|
||||
api_key: os.environ/SALAD_CLOUD_API_KEY
|
||||
```
|
||||
|
||||
## Supported Models
|
||||
|
||||
`salad_cloud/qwen3.5-35b-a3b`
|
||||
`salad_cloud/qwen3.5-27b`
|
||||
`salad_cloud/qwen3.6-35b-a3b`
|
||||
`salad_cloud/qwen3.6-27b`
|
||||
`salad_cloud/qwen3.5-9b`
|
||||
`salad_cloud/gemma-4-26b-a4b-instruct`
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [SaladCloud AI Gateway Overview](https://docs.salad.com/ai-gateway/explanation/overview)
|
||||
- [SaladCloud Sign-up](https://salad.com/ai-gateway)
|
||||
- [SaladCloud Pricing](https://docs.salad.com/ai-gateway/reference/pricing)
|
||||
- [SaladCloud Sign-up](https://portal.salad.com/)
|
||||
|
|
|
|||
|
|
@ -104,6 +104,6 @@
|
|||
},
|
||||
"salad_cloud": {
|
||||
"base_url": "https://ai.salad.cloud/v1",
|
||||
"api_key_env": "SALAD_API_KEY"
|
||||
"api_key_env": "SALAD_CLOUD_API_KEY"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38108,40 +38108,60 @@
|
|||
"supports_native_structured_output": true,
|
||||
"supports_pdf_input": true
|
||||
},
|
||||
"salad_cloud/qwen3.5-35b-a3b": {
|
||||
"salad_cloud/qwen3.6-35b-a3b": {
|
||||
"litellm_provider": "salad_cloud",
|
||||
"mode": "chat",
|
||||
"max_tokens": 131072,
|
||||
"max_input_tokens": 131072,
|
||||
"max_output_tokens": 131072,
|
||||
"input_cost_per_token": 0.0,
|
||||
"output_cost_per_token": 0.0,
|
||||
"max_tokens": 262144,
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"input_cost_per_token": 9e-08,
|
||||
"output_cost_per_token": 6e-07,
|
||||
"supports_function_calling": true,
|
||||
"supports_tool_choice": true,
|
||||
"source": "https://docs.salad.com/ai-gateway/explanation/overview"
|
||||
"supports_vision": true,
|
||||
"supports_reasoning": true,
|
||||
"source": "https://docs.salad.com/ai-gateway/reference/pricing"
|
||||
},
|
||||
"salad_cloud/qwen3.5-27b": {
|
||||
"salad_cloud/qwen3.6-27b": {
|
||||
"litellm_provider": "salad_cloud",
|
||||
"mode": "chat",
|
||||
"max_tokens": 131072,
|
||||
"max_input_tokens": 131072,
|
||||
"max_output_tokens": 131072,
|
||||
"input_cost_per_token": 0.0,
|
||||
"output_cost_per_token": 0.0,
|
||||
"max_tokens": 262144,
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"input_cost_per_token": 3e-07,
|
||||
"output_cost_per_token": 1.2e-06,
|
||||
"supports_function_calling": true,
|
||||
"supports_tool_choice": true,
|
||||
"source": "https://docs.salad.com/ai-gateway/explanation/overview"
|
||||
"supports_vision": true,
|
||||
"supports_reasoning": true,
|
||||
"source": "https://docs.salad.com/ai-gateway/reference/pricing"
|
||||
},
|
||||
"salad_cloud/qwen3.5-9b": {
|
||||
"litellm_provider": "salad_cloud",
|
||||
"mode": "chat",
|
||||
"max_tokens": 131072,
|
||||
"max_input_tokens": 131072,
|
||||
"max_output_tokens": 131072,
|
||||
"input_cost_per_token": 0.0,
|
||||
"output_cost_per_token": 0.0,
|
||||
"max_tokens": 262144,
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"input_cost_per_token": 6e-08,
|
||||
"output_cost_per_token": 9e-08,
|
||||
"supports_function_calling": true,
|
||||
"supports_tool_choice": true,
|
||||
"source": "https://docs.salad.com/ai-gateway/explanation/overview"
|
||||
"supports_vision": true,
|
||||
"supports_reasoning": true,
|
||||
"source": "https://docs.salad.com/ai-gateway/reference/pricing"
|
||||
},
|
||||
"salad_cloud/gemma-4-26b-a4b-instruct": {
|
||||
"litellm_provider": "salad_cloud",
|
||||
"mode": "chat",
|
||||
"max_tokens": 262144,
|
||||
"max_input_tokens": 262144,
|
||||
"max_output_tokens": 262144,
|
||||
"input_cost_per_token": 4e-08,
|
||||
"output_cost_per_token": 2e-07,
|
||||
"supports_function_calling": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_reasoning": true,
|
||||
"source": "https://docs.salad.com/ai-gateway/reference/pricing"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,20 +35,20 @@ class TestSaladCloudProviderConfig:
|
|||
salad_cloud = JSONProviderRegistry.get("salad_cloud")
|
||||
assert salad_cloud is not None
|
||||
assert salad_cloud.base_url == "https://ai.salad.cloud/v1"
|
||||
assert salad_cloud.api_key_env == "SALAD_API_KEY"
|
||||
assert salad_cloud.api_key_env == "SALAD_CLOUD_API_KEY"
|
||||
|
||||
def test_salad_cloud_provider_resolution(self):
|
||||
"""Test that provider resolution correctly routes salad_cloud models"""
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
model="salad_cloud/qwen3.5-35b-a3b",
|
||||
model="salad_cloud/qwen3.6-35b-a3b",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert model == "qwen3.5-35b-a3b"
|
||||
assert model == "qwen3.6-35b-a3b"
|
||||
assert provider == "salad_cloud"
|
||||
assert api_base == "https://ai.salad.cloud/v1"
|
||||
|
||||
|
|
@ -59,9 +59,9 @@ class TestSaladCloudProviderConfig:
|
|||
router = Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "qwen3.5-35b",
|
||||
"model_name": "qwen3.6-35b",
|
||||
"litellm_params": {
|
||||
"model": "salad_cloud/qwen3.5-35b-a3b",
|
||||
"model": "salad_cloud/qwen3.6-35b-a3b",
|
||||
"api_key": "test-key",
|
||||
},
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ class TestSaladCloudProviderConfig:
|
|||
)
|
||||
|
||||
assert len(router.model_list) == 1
|
||||
assert router.model_list[0]["model_name"] == "qwen3.5-35b"
|
||||
assert router.model_list[0]["model_name"] == "qwen3.6-35b"
|
||||
|
||||
def test_salad_cloud_models_in_pricing(self):
|
||||
"""Test that all SaladCloud models are present in model_prices_and_context_window.json"""
|
||||
|
|
@ -84,9 +84,10 @@ class TestSaladCloudProviderConfig:
|
|||
model_cost = json.load(f)
|
||||
|
||||
expected_models = [
|
||||
"salad_cloud/qwen3.5-35b-a3b",
|
||||
"salad_cloud/qwen3.5-27b",
|
||||
"salad_cloud/qwen3.6-35b-a3b",
|
||||
"salad_cloud/qwen3.6-27b",
|
||||
"salad_cloud/qwen3.5-9b",
|
||||
"salad_cloud/gemma-4-26b-a4b-instruct",
|
||||
]
|
||||
|
||||
for model in expected_models:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue