The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
feat(providers): add SCX.ai as OpenAI-compatible provider
bhuvan2134686b5c59b67874c
diff --git a/litellm/constants.py b/litellm/constants.pyindex a9edf135731..cc6d9e2b1e0 100644--- a/litellm/constants.py+++ b/litellm/constants.py@@ -728,6 +728,7 @@ openai_compatible_endpoints: List = ["https://api.libertai.io/v1","https://pinstripes.io/v1","https://api.meta.ai/v1",+ "https://api.scx.ai/v1",]@@ -795,6 +796,7 @@ openai_compatible_providers: List = ["pinstripes", # Pinstripes - JSON-configured provider"darkbloom","meta", # Meta Model API (Muse Spark) - JSON-configured provider+ "scx-ai",]openai_text_completion_compatible_providers: List = [ # providers that support `/v1/completions`"together_ai",diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.pyindex 487a7b7e25f..52a4f866fbd 100644--- a/litellm/litellm_core_utils/get_llm_provider_logic.py+++ b/litellm/litellm_core_utils/get_llm_provider_logic.py@@ -349,6 +349,9 @@ def get_llm_provider(elif endpoint == "https://api.meta.ai/v1":custom_llm_provider = "meta"dynamic_api_key = get_secret_str("META_API_KEY")+ elif endpoint == "https://api.scx.ai/v1":+ custom_llm_provider = "scx-ai"+ dynamic_api_key = get_secret_str("SCX_API_KEY")if api_base is not None and not isinstance(api_base, str):raise Exception("api base needs to be a string. api_base={}".format(api_base))diff --git a/litellm/llms/openai_like/providers.json b/litellm/llms/openai_like/providers.jsonindex 164100d4194..d796d140878 100644--- a/litellm/llms/openai_like/providers.json+++ b/litellm/llms/openai_like/providers.json@@ -183,5 +183,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.0+ },+ "supported_endpoints": ["/v1/chat/completions"]}}diff --git a/litellm/types/utils.py b/litellm/types/utils.pyindex e4dfac48141..feafce9ace1 100644--- a/litellm/types/utils.py+++ b/litellm/types/utils.py@@ -3508,6 +3508,7 @@ class LlmProviders(str, Enum):TENSORMESH = "tensormesh"LIBERTAI = "libertai"PINSTRIPES = "pinstripes"+ SCX_AI = "scx-ai"DARKBLOOM = "darkbloom"META = "meta"LITELLM_AGENT = "litellm_agent"diff --git a/tests/test_litellm/llms/openai_like/test_scx_ai_provider.py b/tests/test_litellm/llms/openai_like/test_scx_ai_provider.pynew file mode 100644index 00000000000..bebd079646e--- /dev/null+++ b/tests/test_litellm/llms/openai_like/test_scx_ai_provider.py@@ -0,0 +1,130 @@+"""+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.0++ 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/gpt-oss-120b",+ custom_llm_provider=None,+ api_base=None,+ api_key=None,+ )++ assert model == "gpt-oss-120b"+ 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/gpt-oss-120b",+ 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="gpt-oss-120b",+ 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": 1.7},+ optional_params={},+ model="gpt-oss-120b",+ drop_params=False,+ )+ assert optional_params["temperature"] == 1.0++ optional_params = config.map_openai_params(+ non_default_params={"temperature": 0.4},+ optional_params={},+ model="gpt-oss-120b",+ 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="gpt-oss-120b",+ 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/gpt-oss-120b",+ "api_key": "test-key",+ },+ }+ ]+ )++ assert len(router.model_list) == 1+ assert router.model_list[0]["model_name"] == "scx-chat"