Skip to content

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]

feat(providers): add Prism provider (internal copy of #40914) (#41961)

devin-ai-integration[bot]5df502b360ce
diff --git a/litellm/constants.py b/litellm/constants.py
index fd9812e2cf5..10c943656f7 100644
--- a/litellm/constants.py
+++ b/litellm/constants.py
@@ -949,6 +949,7 @@ openai_compatible_endpoints: Final[list] = [
"https://api.sailresearch.com/v1",
"https://api.cognition.ai/v1",
"https://api.scx.ai/v1",
+ "https://api.prisminference.com/v1",
"https://gigachat.devices.sberbank.ru/api/v1",
]
@@ -1022,6 +1023,7 @@ openai_compatible_providers: Final[list] = [
"meta", # Meta Model API (Muse Spark) - JSON-configured provider
"cognition",
"scx-ai",
+ "prism",
"sail",
]
diff --git a/litellm/llms/openai_like/providers.json b/litellm/llms/openai_like/providers.json
index ae09b48bd1e..440e5490d71 100644
--- a/litellm/llms/openai_like/providers.json
+++ b/litellm/llms/openai_like/providers.json
@@ -201,6 +201,12 @@
},
"supported_endpoints": ["/v1/chat/completions"]
},
+ "prism": {
+ "base_url": "https://api.prisminference.com/v1",
+ "api_key_env": "PRISM_API_KEY",
+ "api_base_env": "PRISM_API_BASE",
+ "supported_endpoints": ["/v1/chat/completions", "/v1/responses", "/v1/messages"]
+ },
"sail": {
"base_url": "https://api.sailresearch.com/v1",
"api_key_env": "SAIL_API_KEY",
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 0c694b6bcf6..d5490f5df9e 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -78485,5 +78485,55 @@
"thinking_always_on": true,
"prompt_cache_min_tokens": 512,
"source": "https://cloud.google.com/gemini-enterprise-agent-platform/generative-ai/pricing"
+ },
+ "prism/deepseek-v4.1-flash": {
+ "cache_read_input_token_cost": 7e-08,
+ "input_cost_per_token": 1.7e-07,
+ "litellm_provider": "prism",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 384000,
+ "max_tokens": 384000,
+ "mode": "chat",
+ "output_cost_per_token": 6.3e-07,
+ "source": "https://prisminference.com/pricing",
+ "supported_endpoints": [
+ "/v1/chat/completions",
+ "/v1/responses",
+ "/v1/messages"
+ ],
+ "supports_function_calling": true,
+ "supports_native_streaming": true,
+ "supports_parallel_function_calling": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_system_messages": true,
+ "supports_tool_choice": true,
+ "supports_vision": true
+ },
+ "prism/deepseek-v4-flash": {
+ "cache_read_input_token_cost": 7e-08,
+ "input_cost_per_token": 1.7e-07,
+ "litellm_provider": "prism",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 384000,
+ "max_tokens": 384000,
+ "mode": "chat",
+ "output_cost_per_token": 2.1e-07,
+ "source": "https://prisminference.com/pricing",
+ "supported_endpoints": [
+ "/v1/chat/completions",
+ "/v1/responses",
+ "/v1/messages"
+ ],
+ "supports_function_calling": true,
+ "supports_native_streaming": true,
+ "supports_parallel_function_calling": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_system_messages": true,
+ "supports_tool_choice": true,
+ "supports_vision": false
}
}
diff --git a/litellm/provider_endpoints_support_backup.json b/litellm/provider_endpoints_support_backup.json
index 1fcb7600a5e..ad6e5857218 100644
--- a/litellm/provider_endpoints_support_backup.json
+++ b/litellm/provider_endpoints_support_backup.json
@@ -1943,6 +1943,23 @@
"interactions": true
}
},
+ "prism": {
+ "display_name": "Prism (`prism`)",
+ "url": "https://docs.litellm.ai/docs/providers/prism",
+ "endpoints": {
+ "chat_completions": true,
+ "messages": true,
+ "responses": true,
+ "embeddings": false,
+ "image_generations": false,
+ "audio_transcriptions": false,
+ "audio_speech": false,
+ "moderations": false,
+ "batches": false,
+ "rerank": false,
+ "a2a": false
+ }
+ },
"recraft": {
"display_name": "Recraft (`recraft`)",
"url": "https://docs.litellm.ai/docs/providers/recraft",
diff --git a/litellm/proxy/public_endpoints/provider_create_fields.json b/litellm/proxy/public_endpoints/provider_create_fields.json
index 8bd7ed81583..67a8c356a4a 100644
--- a/litellm/proxy/public_endpoints/provider_create_fields.json
+++ b/litellm/proxy/public_endpoints/provider_create_fields.json
@@ -2855,6 +2855,34 @@
],
"default_model_placeholder": "gpt-3.5-turbo"
},
+ {
+ "provider": "PRISM",
+ "provider_display_name": "Prism",
+ "litellm_provider": "prism",
+ "credential_fields": [
+ {
+ "key": "api_base",
+ "label": "API Base",
+ "placeholder": "https://api.prisminference.com/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": "prism/deepseek-v4.1-flash"
+ },
{
"provider": "RECRAFT",
"provider_display_name": "Recraft",
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 8862df9dc22..b9be8b6858e 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -4139,6 +4139,7 @@ class LlmProviders(str, Enum):
PINSTRIPES = "pinstripes"
COGNITION = "cognition"
SCX_AI = "scx-ai"
+ PRISM = "prism"
DARKBLOOM = "darkbloom"
META = "meta"
SAIL = "sail"
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index 0c694b6bcf6..d5490f5df9e 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -78485,5 +78485,55 @@
"thinking_always_on": true,
"prompt_cache_min_tokens": 512,
"source": "https://cloud.google.com/gemini-enterprise-agent-platform/generative-ai/pricing"
+ },
+ "prism/deepseek-v4.1-flash": {
+ "cache_read_input_token_cost": 7e-08,
+ "input_cost_per_token": 1.7e-07,
+ "litellm_provider": "prism",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 384000,
+ "max_tokens": 384000,
+ "mode": "chat",
+ "output_cost_per_token": 6.3e-07,
+ "source": "https://prisminference.com/pricing",
+ "supported_endpoints": [
+ "/v1/chat/completions",
+ "/v1/responses",
+ "/v1/messages"
+ ],
+ "supports_function_calling": true,
+ "supports_native_streaming": true,
+ "supports_parallel_function_calling": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_system_messages": true,
+ "supports_tool_choice": true,
+ "supports_vision": true
+ },
+ "prism/deepseek-v4-flash": {
+ "cache_read_input_token_cost": 7e-08,
+ "input_cost_per_token": 1.7e-07,
+ "litellm_provider": "prism",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 384000,
+ "max_tokens": 384000,
+ "mode": "chat",
+ "output_cost_per_token": 2.1e-07,
+ "source": "https://prisminference.com/pricing",
+ "supported_endpoints": [
+ "/v1/chat/completions",
+ "/v1/responses",
+ "/v1/messages"
+ ],
+ "supports_function_calling": true,
+ "supports_native_streaming": true,
+ "supports_parallel_function_calling": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_system_messages": true,
+ "supports_tool_choice": true,
+ "supports_vision": false
}
}
diff --git a/provider_endpoints_support.json b/provider_endpoints_support.json
index 790a050a878..44ef9363b64 100644
--- a/provider_endpoints_support.json
+++ b/provider_endpoints_support.json
@@ -2195,6 +2195,23 @@
"interactions": true
}
},
+ "prism": {
+ "display_name": "Prism (`prism`)",
+ "url": "https://docs.litellm.ai/docs/providers/prism",
+ "endpoints": {
+ "chat_completions": true,
+ "messages": true,
+ "responses": true,
+ "embeddings": false,
+ "image_generations": false,
+ "audio_transcriptions": false,
+ "audio_speech": false,
+ "moderations": false,
+ "batches": false,
+ "rerank": false,
+ "a2a": false
+ }
+ },
"recraft": {
"display_name": "Recraft (`recraft`)",
"url": "https://docs.litellm.ai/docs/providers/recraft",
diff --git a/tests/unit/llms/openai_like/test_prism_provider.py b/tests/unit/llms/openai_like/test_prism_provider.py
new file mode 100644
index 00000000000..c1775c63dc9
--- /dev/null
+++ b/tests/unit/llms/openai_like/test_prism_provider.py
@@ -0,0 +1,192 @@
+import json
+from pathlib import Path
+from typing import Final
+
+import pytest
+import respx
+
+import litellm
+from litellm.caching.llm_caching_handler import LLMClientCache
+
+
+def test_prism_provider_resolution(monkeypatch: pytest.MonkeyPatch):
+ from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
+
+ monkeypatch.setenv("PRISM_API_KEY", "prism-test-key")
+
+ model, provider, api_key, api_base = get_llm_provider(
+ model="prism/deepseek-v4-flash",
+ custom_llm_provider=None,
+ api_base=None,
+ api_key=None,
+ )
+
+ assert model == "deepseek-v4-flash"
+ assert provider == "prism"
+ assert api_key == "prism-test-key"
+ assert api_base == "https://api.prisminference.com/v1"
+
+
+def test_prism_provider_keeps_explicit_credentials(monkeypatch: pytest.MonkeyPatch):
+ from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
+
+ monkeypatch.setenv("PRISM_API_KEY", "prism-env-key")
+
+ _, provider, api_key, api_base = get_llm_provider(
+ model="prism/deepseek-v4-flash",
+ custom_llm_provider=None,
+ api_base="https://prism.internal.example/v1",
+ api_key="prism-explicit-key",
+ )
+
+ assert provider == "prism"
+ assert api_key == "prism-explicit-key"
+ assert api_base == "https://prism.internal.example/v1"
+
+
+PRISM_MODELS = tuple(sorted(name for name in litellm.model_cost if name.startswith("prism/")))
+
+
[email protected]("model", PRISM_MODELS)
+def test_prism_model_cost_and_capabilities(model: str):
+ from litellm.cost_calculator import cost_per_token
+
+ prompt_cost, completion_cost = cost_per_token(
+ model=model,
+ prompt_tokens=1_000_000,
+ completion_tokens=1_000_000,
+ custom_llm_provider="prism",
+ )
+ model_info = litellm.get_model_info(model)
+
+ assert prompt_cost == pytest.approx(model_info["input_cost_per_token"] * 1_000_000)
+ assert completion_cost == pytest.approx(model_info["output_cost_per_token"] * 1_000_000)
+ assert 0 < model_info["cache_read_input_token_cost"] < model_info["input_cost_per_token"]
+ assert model_info["output_cost_per_token"] > 0
+ assert model_info["max_tokens"] == model_info["max_output_tokens"] <= model_info["max_input_tokens"]
+ assert model_info["litellm_provider"] == "prism"
+ assert model_info["mode"] == "chat"
+ assert model_info["supports_function_calling"] is True
+ assert model_info["supports_native_streaming"] is True
+ assert model_info["supports_reasoning"] is True
+ assert model_info["supports_response_schema"] is True
+ assert litellm.supports_vision(model) is model_info["supports_vision"]
+
+
+def test_prism_backup_registry_mirrors_cost_map():
+ package_root = Path(litellm.__file__).parent
+ cost_map = json.loads((package_root.parent / "model_prices_and_context_window.json").read_text())
+ backup = json.loads((package_root / "model_prices_and_context_window_backup.json").read_text())
+ prism_entries = {name: entry for name, entry in cost_map.items() if name.startswith("prism/")}
+
+ assert tuple(sorted(prism_entries)) == PRISM_MODELS
+ assert prism_entries
+ assert all("supports_vision" in entry for entry in prism_entries.values())
+ assert prism_entries == {name: backup[name] for name in prism_entries}
+
+
+def test_prism_is_available_in_add_model_form():
+ fields_path = Path(litellm.__file__).parent / "proxy" / "public_endpoints" / "provider_create_fields.json"
+ providers = json.loads(fields_path.read_text())
+ prism = next(provider for provider in providers if provider["litellm_provider"] == "prism")
+
+ assert prism["provider"] == "PRISM"
+ assert prism["provider_display_name"] == "Prism"
+ assert prism["default_model_placeholder"] == "prism/deepseek-v4.1-flash"
+ assert {field["key"]: field["required"] for field in prism["credential_fields"]} == {
+ "api_base": False,
+ "api_key": True,
+ }
+
+
+def test_prism_supported_endpoints():
+ matrix_path = Path(litellm.__file__).parent / "provider_endpoints_support_backup.json"
+ providers = json.loads(matrix_path.read_text())["providers"]
+
+ assert providers["prism"]["endpoints"] == {
+ "chat_completions": True,
+ "messages": True,
+ "responses": True,
+ "embeddings": False,
+ "image_generations": False,
+ "audio_transcriptions": False,
+ "audio_speech": False,
+ "moderations": False,
+ "batches": False,
+ "rerank": False,
+ "a2a": False,
+ }
+
+
+def test_prism_responses_request():
+ with respx.mock() as upstream:
+ route: Final = upstream.post("https://api.prisminference.com/v1/responses").respond(
+ 200,
+ json={
+ "id": "resp_prism",
+ "object": "response",
+ "created_at": 1_789_550_000,
+ "model": "deepseek-v4-flash",
+ "status": "completed",
+ "output": [
+ {
+ "id": "msg_prism",
+ "type": "message",
+ "role": "assistant",
+ "status": "completed",
+ "content": [{"type": "output_text", "text": "Hello from Prism", "annotations": []}],
+ }
+ ],
+ "usage": {"input_tokens": 4, "output_tokens": 3, "total_tokens": 7},
+ },
+ )
+ response: Final = litellm.responses(
+ model="prism/deepseek-v4-flash",
+ input="Say hello",
+ api_key="prism-test-key",
+ )
+
+ request: Final = route.calls.last.request
+ body: Final = json.loads(request.content)
+ assert route.call_count == 1
+ assert str(request.url) == "https://api.prisminference.com/v1/responses"
+ assert request.headers["authorization"] == "Bearer prism-test-key"
+ assert body["model"] == "deepseek-v4-flash"
+ assert body["input"] == "Say hello"
+ assert response.output[0].content[0].text == "Hello from Prism"
+
+
+async def test_prism_anthropic_messages_request(monkeypatch: pytest.MonkeyPatch):
+ monkeypatch.setattr(litellm, "disable_aiohttp_transport", True)
+ monkeypatch.setattr(litellm, "in_memory_llm_clients_cache", LLMClientCache())
+ with respx.mock() as upstream:
+ route: Final = upstream.post("https://api.prisminference.com/v1/messages").respond(
+ 200,
+ json={
+ "id": "msg_prism",
+ "type": "message",
+ "role": "assistant",
+ "model": "deepseek-v4-flash",
+ "content": [{"type": "text", "text": "Hello from Prism"}],
+ "stop_reason": "end_turn",
+ "stop_sequence": None,
+ "usage": {"input_tokens": 4, "output_tokens": 3},
+ },
+ )
+ response: Final = await litellm.anthropic.messages.acreate(
+ model="prism/deepseek-v4-flash",
+ messages=[{"role": "user", "content": "Say hello"}],
+ max_tokens=32,
+ api_key="prism-test-key",
+ )
+
+ request: Final = route.calls.last.request
+ body: Final = json.loads(request.content)
+ assert route.call_count == 1
+ assert str(request.url) == "https://api.prisminference.com/v1/messages"
+ assert request.headers["authorization"] == "Bearer prism-test-key"
+ assert request.headers["anthropic-version"] == "2023-06-01"
+ assert body["model"] == "deepseek-v4-flash"
+ assert body["messages"] == [{"role": "user", "content": "Say hello"}]
+ assert response["content"][0]["text"] == "Hello from Prism"