mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_add_gemini_3_1_flash_lite_image
This commit is contained in:
commit
ce11d39701
12 changed files with 377 additions and 0 deletions
|
|
@ -783,6 +783,7 @@ openai_compatible_endpoints: Final[list] = [
|
|||
"https://pinstripes.io/v1",
|
||||
"https://api.meta.ai/v1",
|
||||
"https://api.cognition.ai/v1",
|
||||
"https://api.scx.ai/v1",
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -851,6 +852,7 @@ openai_compatible_providers: Final[list] = [
|
|||
"darkbloom",
|
||||
"meta", # Meta Model API (Muse Spark) - JSON-configured provider
|
||||
"cognition",
|
||||
"scx-ai",
|
||||
]
|
||||
openai_text_completion_compatible_providers: Final[list] = [ # providers that support `/v1/completions`
|
||||
"together_ai",
|
||||
|
|
|
|||
|
|
@ -188,5 +188,17 @@
|
|||
"max_completion_tokens": "max_tokens"
|
||||
},
|
||||
"supported_endpoints": ["/v1/chat/completions", "/v1/responses", "/v1/embeddings"]
|
||||
},
|
||||
"scx-ai": {
|
||||
"base_url": "https://api.scx.ai/v1",
|
||||
"api_key_env": "SCX_API_KEY",
|
||||
"api_base_env": "SCX_API_BASE",
|
||||
"param_mappings": {
|
||||
"max_completion_tokens": "max_tokens"
|
||||
},
|
||||
"constraints": {
|
||||
"temperature_max": 1.99
|
||||
},
|
||||
"supported_endpoints": ["/v1/chat/completions"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36722,6 +36722,40 @@
|
|||
"supports_vision": true,
|
||||
"source": "https://cloud.sambanova.ai/plans/pricing"
|
||||
},
|
||||
"scx-ai/GLM-5.2": {
|
||||
"cache_read_input_token_cost": 2.2e-07,
|
||||
"input_cost_per_token": 6.1e-07,
|
||||
"litellm_provider": "scx-ai",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.98e-06,
|
||||
"source": "https://scx.ai/pricing",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": false
|
||||
},
|
||||
"scx-ai/Qwen3.8-Max": {
|
||||
"cache_read_input_token_cost": 2.1e-07,
|
||||
"input_cost_per_token": 1.65e-06,
|
||||
"litellm_provider": "scx-ai",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.99e-06,
|
||||
"source": "https://scx.ai/pricing",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"snowflake/claude-3-5-sonnet": {
|
||||
"litellm_provider": "snowflake",
|
||||
"max_input_tokens": 200000,
|
||||
|
|
|
|||
|
|
@ -2027,6 +2027,23 @@
|
|||
"interactions": true
|
||||
}
|
||||
},
|
||||
"scx-ai": {
|
||||
"display_name": "SCX.ai (`scx-ai`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/scx_ai",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
"messages": false,
|
||||
"responses": false,
|
||||
"embeddings": false,
|
||||
"image_generations": false,
|
||||
"audio_transcriptions": false,
|
||||
"audio_speech": false,
|
||||
"moderations": false,
|
||||
"batches": false,
|
||||
"rerank": false,
|
||||
"a2a": false
|
||||
}
|
||||
},
|
||||
"snowflake": {
|
||||
"display_name": "Snowflake (`snowflake`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/snowflake",
|
||||
|
|
|
|||
|
|
@ -2726,6 +2726,34 @@
|
|||
],
|
||||
"default_model_placeholder": "sap/gpt-4"
|
||||
},
|
||||
{
|
||||
"provider": "SCX_AI",
|
||||
"provider_display_name": "SCX.ai",
|
||||
"litellm_provider": "scx-ai",
|
||||
"credential_fields": [
|
||||
{
|
||||
"key": "api_base",
|
||||
"label": "API Base",
|
||||
"placeholder": "https://api.scx.ai/v1",
|
||||
"tooltip": null,
|
||||
"required": false,
|
||||
"field_type": "text",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
},
|
||||
{
|
||||
"key": "api_key",
|
||||
"label": "API Key",
|
||||
"placeholder": null,
|
||||
"tooltip": null,
|
||||
"required": true,
|
||||
"field_type": "password",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
}
|
||||
],
|
||||
"default_model_placeholder": "scx-ai/GLM-5.2"
|
||||
},
|
||||
{
|
||||
"provider": "Snowflake",
|
||||
"provider_display_name": "Snowflake",
|
||||
|
|
|
|||
|
|
@ -3790,6 +3790,7 @@ class LlmProviders(str, Enum):
|
|||
LIBERTAI = "libertai"
|
||||
PINSTRIPES = "pinstripes"
|
||||
COGNITION = "cognition"
|
||||
SCX_AI = "scx-ai"
|
||||
DARKBLOOM = "darkbloom"
|
||||
META = "meta"
|
||||
LITELLM_AGENT = "litellm_agent"
|
||||
|
|
|
|||
|
|
@ -36722,6 +36722,40 @@
|
|||
"supports_vision": true,
|
||||
"source": "https://cloud.sambanova.ai/plans/pricing"
|
||||
},
|
||||
"scx-ai/GLM-5.2": {
|
||||
"cache_read_input_token_cost": 2.2e-07,
|
||||
"input_cost_per_token": 6.1e-07,
|
||||
"litellm_provider": "scx-ai",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.98e-06,
|
||||
"source": "https://scx.ai/pricing",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": false
|
||||
},
|
||||
"scx-ai/Qwen3.8-Max": {
|
||||
"cache_read_input_token_cost": 2.1e-07,
|
||||
"input_cost_per_token": 1.65e-06,
|
||||
"litellm_provider": "scx-ai",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.99e-06,
|
||||
"source": "https://scx.ai/pricing",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"snowflake/claude-3-5-sonnet": {
|
||||
"litellm_provider": "snowflake",
|
||||
"max_input_tokens": 200000,
|
||||
|
|
|
|||
|
|
@ -2261,6 +2261,23 @@
|
|||
"interactions": true
|
||||
}
|
||||
},
|
||||
"scx-ai": {
|
||||
"display_name": "SCX.ai (`scx-ai`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/scx_ai",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
"messages": false,
|
||||
"responses": false,
|
||||
"embeddings": false,
|
||||
"image_generations": false,
|
||||
"audio_transcriptions": false,
|
||||
"audio_speech": false,
|
||||
"moderations": false,
|
||||
"batches": false,
|
||||
"rerank": false,
|
||||
"a2a": false
|
||||
}
|
||||
},
|
||||
"snowflake": {
|
||||
"display_name": "Snowflake (`snowflake`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/snowflake",
|
||||
|
|
|
|||
211
tests/test_litellm/llms/openai_like/test_scx_ai_provider.py
Normal file
211
tests/test_litellm/llms/openai_like/test_scx_ai_provider.py
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
"""
|
||||
Tests for SCX.ai provider configuration and integration.
|
||||
"""
|
||||
|
||||
import litellm
|
||||
|
||||
|
||||
class TestSCXAIProviderConfig:
|
||||
def test_scx_ai_in_provider_list(self):
|
||||
from litellm import LlmProviders
|
||||
|
||||
assert hasattr(LlmProviders, "SCX_AI")
|
||||
assert LlmProviders.SCX_AI.value == "scx-ai"
|
||||
assert "scx-ai" in litellm.provider_list
|
||||
|
||||
def test_scx_ai_json_config_exists(self):
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
|
||||
assert JSONProviderRegistry.exists("scx-ai")
|
||||
|
||||
scx = JSONProviderRegistry.get("scx-ai")
|
||||
assert scx is not None
|
||||
assert scx.base_url == "https://api.scx.ai/v1"
|
||||
assert scx.api_key_env == "SCX_API_KEY"
|
||||
assert scx.param_mappings.get("max_completion_tokens") == "max_tokens"
|
||||
assert scx.constraints.get("temperature_max") == 1.99
|
||||
|
||||
def test_scx_ai_in_openai_compatible_providers(self):
|
||||
from litellm.constants import openai_compatible_providers
|
||||
|
||||
assert "scx-ai" in openai_compatible_providers
|
||||
|
||||
def test_scx_ai_provider_resolution(self):
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
model="scx-ai/GLM-5.2",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert model == "GLM-5.2"
|
||||
assert provider == "scx-ai"
|
||||
assert api_base == "https://api.scx.ai/v1"
|
||||
|
||||
def test_scx_ai_api_base_override(self):
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
model="scx-ai/GLM-5.2",
|
||||
custom_llm_provider=None,
|
||||
api_base="https://custom.scx.ai/v1",
|
||||
api_key="sk-test",
|
||||
)
|
||||
|
||||
assert provider == "scx-ai"
|
||||
assert api_base == "https://custom.scx.ai/v1"
|
||||
assert api_key == "sk-test"
|
||||
|
||||
def test_scx_ai_url_autodetection(self):
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
model="GLM-5.2",
|
||||
custom_llm_provider=None,
|
||||
api_base="https://api.scx.ai/v1",
|
||||
api_key=None,
|
||||
)
|
||||
assert provider == "scx-ai"
|
||||
assert api_base == "https://api.scx.ai/v1"
|
||||
|
||||
def test_scx_ai_temperature_clamped_to_max(self):
|
||||
from litellm.llms.openai_like.dynamic_config import create_config_class
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
|
||||
provider = JSONProviderRegistry.get("scx-ai")
|
||||
assert provider is not None
|
||||
config = create_config_class(provider)()
|
||||
|
||||
optional_params = config.map_openai_params(
|
||||
non_default_params={"temperature": 2.5},
|
||||
optional_params={},
|
||||
model="GLM-5.2",
|
||||
drop_params=False,
|
||||
)
|
||||
assert optional_params["temperature"] == 1.99
|
||||
|
||||
optional_params = config.map_openai_params(
|
||||
non_default_params={"temperature": 1.7},
|
||||
optional_params={},
|
||||
model="GLM-5.2",
|
||||
drop_params=False,
|
||||
)
|
||||
assert optional_params["temperature"] == 1.7
|
||||
|
||||
optional_params = config.map_openai_params(
|
||||
non_default_params={"temperature": 0.4},
|
||||
optional_params={},
|
||||
model="GLM-5.2",
|
||||
drop_params=False,
|
||||
)
|
||||
assert optional_params["temperature"] == 0.4
|
||||
|
||||
def test_scx_ai_max_completion_tokens_mapped(self):
|
||||
from litellm.llms.openai_like.dynamic_config import create_config_class
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
|
||||
provider = JSONProviderRegistry.get("scx-ai")
|
||||
assert provider is not None
|
||||
config = create_config_class(provider)()
|
||||
|
||||
optional_params = config.map_openai_params(
|
||||
non_default_params={"max_completion_tokens": 256},
|
||||
optional_params={},
|
||||
model="GLM-5.2",
|
||||
drop_params=False,
|
||||
)
|
||||
assert optional_params["max_tokens"] == 256
|
||||
assert "max_completion_tokens" not in optional_params
|
||||
|
||||
def test_scx_ai_router_config(self):
|
||||
from litellm import Router
|
||||
|
||||
router = Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "scx-chat",
|
||||
"litellm_params": {
|
||||
"model": "scx-ai/GLM-5.2",
|
||||
"api_key": "test-key",
|
||||
},
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
assert len(router.model_list) == 1
|
||||
assert router.model_list[0]["model_name"] == "scx-chat"
|
||||
|
||||
|
||||
class TestSCXAIModelMetadata:
|
||||
SCX_MODELS = (
|
||||
"scx-ai/GLM-5.2",
|
||||
"scx-ai/Qwen3.8-Max",
|
||||
)
|
||||
VISION_MODELS = ("scx-ai/Qwen3.8-Max",)
|
||||
|
||||
@staticmethod
|
||||
def _load(path_parts):
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
json_path = Path(__file__).parents[4].joinpath(*path_parts)
|
||||
with open(json_path) as f:
|
||||
return json.load(f)
|
||||
|
||||
def test_scx_ai_models_registered_with_correct_metadata(self):
|
||||
model_cost = self._load(("model_prices_and_context_window.json",))
|
||||
for model in self.SCX_MODELS:
|
||||
info = model_cost.get(model)
|
||||
assert info is not None, f"{model} missing from model_prices_and_context_window.json"
|
||||
assert info["litellm_provider"] == "scx-ai"
|
||||
assert info["mode"] == "chat"
|
||||
assert info["input_cost_per_token"] > 0
|
||||
assert info["output_cost_per_token"] > 0
|
||||
assert info["supports_function_calling"] is True
|
||||
assert info["supports_tool_choice"] is True
|
||||
assert info["supports_reasoning"] is True
|
||||
assert info["supports_response_schema"] is True
|
||||
assert info.get("supports_vision", False) is (model in self.VISION_MODELS)
|
||||
|
||||
assert info["supports_prompt_caching"] is True
|
||||
assert 0 < info["cache_read_input_token_cost"] < info["input_cost_per_token"]
|
||||
|
||||
assert info["max_output_tokens"] == 131072
|
||||
assert info["max_tokens"] == info["max_output_tokens"]
|
||||
assert info["max_input_tokens"] >= 1_000_000
|
||||
|
||||
def test_scx_ai_models_synced_to_backup(self):
|
||||
model_cost = self._load(("model_prices_and_context_window.json",))
|
||||
backup = self._load(("litellm", "model_prices_and_context_window_backup.json"))
|
||||
for model in self.SCX_MODELS:
|
||||
assert model in backup, f"{model} missing from backup json"
|
||||
assert backup[model] == model_cost[model], f"{model} differs between root and backup json"
|
||||
|
||||
|
||||
class TestSCXAIDashboardRegistration:
|
||||
@staticmethod
|
||||
def _provider_create_fields():
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import litellm
|
||||
|
||||
path = Path(litellm.__file__).parent / "proxy" / "public_endpoints" / "provider_create_fields.json"
|
||||
with open(path) as f:
|
||||
return json.load(f)
|
||||
|
||||
def test_scx_ai_is_selectable_in_the_add_model_form(self):
|
||||
entries = [e for e in self._provider_create_fields() if e["litellm_provider"] == "scx-ai"]
|
||||
assert len(entries) == 1, "scx-ai must appear exactly once in provider_create_fields.json"
|
||||
|
||||
entry = entries[0]
|
||||
assert entry["provider"] == "SCX_AI"
|
||||
assert entry["provider_display_name"] == "SCX.ai"
|
||||
assert entry["default_model_placeholder"].startswith("scx-ai/")
|
||||
|
||||
fields = {f["key"]: f for f in entry["credential_fields"]}
|
||||
assert fields["api_key"]["required"] is True
|
||||
assert fields["api_key"]["field_type"] == "password"
|
||||
assert fields["api_base"]["required"] is False
|
||||
1
ui/litellm-dashboard/public/assets/logos/scx_ai.svg
Normal file
1
ui/litellm-dashboard/public/assets/logos/scx_ai.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.3 KiB |
|
|
@ -62,6 +62,17 @@ describe("provider_info_helpers", () => {
|
|||
expect(result.logo).toBe(providerLogoMap[Providers.Groq]);
|
||||
});
|
||||
|
||||
it("should map scx-ai slug and SCX_AI enum key to the SCX.ai display name and logo", () => {
|
||||
const fromSlug = getProviderLogoAndName("scx-ai");
|
||||
expect(fromSlug.displayName).toBe(Providers.SCX_AI);
|
||||
expect(fromSlug.logo).toBe(providerLogoMap[Providers.SCX_AI]);
|
||||
expect(fromSlug.logo).toBeTruthy();
|
||||
|
||||
const fromEnumKey = getProviderLogoAndName("SCX_AI");
|
||||
expect(fromEnumKey.displayName).toBe(Providers.SCX_AI);
|
||||
expect(fromEnumKey.logo).toBe(providerLogoMap[Providers.SCX_AI]);
|
||||
});
|
||||
|
||||
it("should map bedrock_mantle slug to Bedrock Mantle display name and logo", () => {
|
||||
const result = getProviderLogoAndName("bedrock_mantle");
|
||||
expect(result.displayName).toBe(Providers.BedrockMantle);
|
||||
|
|
@ -180,6 +191,10 @@ describe("provider_info_helpers", () => {
|
|||
expect(getPlaceholder(Providers.Vertex_AI)).toBe("gemini-pro");
|
||||
});
|
||||
|
||||
it("should return an scx-ai model placeholder for SCX_AI provider", () => {
|
||||
expect(getPlaceholder(Providers.SCX_AI)).toBe("scx-ai/GLM-5.2");
|
||||
});
|
||||
|
||||
it("should return claude-3-opus placeholder for Anthropic provider", () => {
|
||||
expect(getPlaceholder(Providers.Anthropic)).toBe("claude-3-opus");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import replicateLogo from "../../public/assets/logos/replicate.svg";
|
|||
import runwayLogo from "../../public/assets/logos/runway.png";
|
||||
import sambanovaLogo from "../../public/assets/logos/sambanova.svg";
|
||||
import sapLogo from "../../public/assets/logos/sap.png";
|
||||
import scxAiLogo from "../../public/assets/logos/scx_ai.svg";
|
||||
import snowflakeLogo from "../../public/assets/logos/snowflake.svg";
|
||||
import sonioxLogo from "../../public/assets/logos/soniox.svg";
|
||||
import togetheraiLogo from "../../public/assets/logos/togetherai.svg";
|
||||
|
|
@ -153,6 +154,7 @@ export enum Providers {
|
|||
SAGEMAKER_LEGACY = "Sagemaker",
|
||||
Sambanova = "Sambanova",
|
||||
SAP = "SAP Generative AI Hub",
|
||||
SCX_AI = "SCX.ai",
|
||||
Snowflake = "Snowflake",
|
||||
Soniox = "Soniox",
|
||||
TEXT_COMPLETION_CODESTRAL = "Text-Completion-Codestral",
|
||||
|
|
@ -264,6 +266,7 @@ export const provider_map: Record<string, string> = {
|
|||
SageMaker: "sagemaker_chat",
|
||||
Sambanova: "sambanova",
|
||||
SAP: "sap",
|
||||
SCX_AI: "scx-ai",
|
||||
Snowflake: "snowflake",
|
||||
Soniox: "soniox",
|
||||
TEXT_COMPLETION_CODESTRAL: "text-completion-codestral",
|
||||
|
|
@ -356,6 +359,7 @@ export const providerLogoMap: Partial<Record<Providers, string>> = {
|
|||
[Providers.SAGEMAKER_LEGACY]: bedrockLogo.src,
|
||||
[Providers.Sambanova]: sambanovaLogo.src,
|
||||
[Providers.SAP]: sapLogo.src,
|
||||
[Providers.SCX_AI]: scxAiLogo.src,
|
||||
[Providers.Snowflake]: snowflakeLogo.src,
|
||||
[Providers.Soniox]: sonioxLogo.src,
|
||||
[Providers.TEXT_COMPLETION_CODESTRAL]: mistralLogo.src,
|
||||
|
|
@ -421,6 +425,7 @@ const providerPlaceholderMap: Partial<Record<Providers, string>> = {
|
|||
[Providers.Oracle]: "oci/xai.grok-4",
|
||||
[Providers.RunwayML]: "runwayml/gen4_turbo",
|
||||
[Providers.SageMaker]: "sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b",
|
||||
[Providers.SCX_AI]: "scx-ai/GLM-5.2",
|
||||
[Providers.Snowflake]: "snowflake/mistral-7b",
|
||||
[Providers.Vertex_AI]: "gemini-pro",
|
||||
[Providers.VolcEngine]: "volcengine/<any-model-on-volcengine>",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue