mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
Merge 1ea086167e into 1c61c2606e
This commit is contained in:
commit
afce5e47d1
9 changed files with 247 additions and 0 deletions
|
|
@ -894,6 +894,7 @@ openai_compatible_endpoints: Final[list] = [
|
|||
"https://api.meta.ai/v1",
|
||||
"https://api.cognition.ai/v1",
|
||||
"https://api.scx.ai/v1",
|
||||
"https://api.prisminference.com/v1",
|
||||
"https://gigachat.devices.sberbank.ru/api/v1",
|
||||
]
|
||||
|
||||
|
|
@ -966,6 +967,7 @@ openai_compatible_providers: Final[list] = [
|
|||
"meta", # Meta Model API (Muse Spark) - JSON-configured provider
|
||||
"cognition",
|
||||
"scx-ai",
|
||||
"prism",
|
||||
]
|
||||
openai_text_completion_compatible_providers: Final[list] = [ # providers that support `/v1/completions`
|
||||
"together_ai",
|
||||
|
|
|
|||
|
|
@ -200,5 +200,11 @@
|
|||
"temperature_max": 1.99
|
||||
},
|
||||
"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"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65063,5 +65063,29 @@
|
|||
"supports_tool_choice": false,
|
||||
"supports_response_schema": true,
|
||||
"supports_vision": false
|
||||
},
|
||||
"prism/deepseek-v4-flash": {
|
||||
"cache_read_input_token_cost": 7e-08,
|
||||
"input_cost_per_token": 1.4e-07,
|
||||
"litellm_provider": "prism",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 393216,
|
||||
"max_tokens": 393216,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.8e-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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1925,6 +1925,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",
|
||||
|
|
|
|||
|
|
@ -2703,6 +2703,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-flash"
|
||||
},
|
||||
{
|
||||
"provider": "RECRAFT",
|
||||
"provider_display_name": "Recraft",
|
||||
|
|
|
|||
|
|
@ -4012,6 +4012,7 @@ class LlmProviders(str, Enum):
|
|||
PINSTRIPES = "pinstripes"
|
||||
COGNITION = "cognition"
|
||||
SCX_AI = "scx-ai"
|
||||
PRISM = "prism"
|
||||
DARKBLOOM = "darkbloom"
|
||||
META = "meta"
|
||||
LITELLM_AGENT = "litellm_agent"
|
||||
|
|
|
|||
|
|
@ -65063,5 +65063,29 @@
|
|||
"supports_tool_choice": false,
|
||||
"supports_response_schema": true,
|
||||
"supports_vision": false
|
||||
},
|
||||
"prism/deepseek-v4-flash": {
|
||||
"cache_read_input_token_cost": 7e-08,
|
||||
"input_cost_per_token": 1.4e-07,
|
||||
"litellm_provider": "prism",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 393216,
|
||||
"max_tokens": 393216,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.8e-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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2142,6 +2142,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",
|
||||
|
|
|
|||
128
tests/test_litellm/llms/openai_like/test_prism_provider.py
Normal file
128
tests/test_litellm/llms/openai_like/test_prism_provider.py
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
import litellm
|
||||
|
||||
|
||||
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"
|
||||
|
||||
|
||||
def test_prism_model_cost_and_capabilities():
|
||||
from litellm.cost_calculator import cost_per_token
|
||||
|
||||
prompt_cost, completion_cost = cost_per_token(
|
||||
model="prism/deepseek-v4-flash",
|
||||
prompt_tokens=1_000_000,
|
||||
completion_tokens=1_000_000,
|
||||
custom_llm_provider="prism",
|
||||
)
|
||||
model_info = litellm.get_model_info("prism/deepseek-v4-flash")
|
||||
|
||||
assert prompt_cost == pytest.approx(0.14)
|
||||
assert completion_cost == pytest.approx(0.28)
|
||||
assert model_info["cache_read_input_token_cost"] == pytest.approx(7e-08)
|
||||
assert model_info["max_input_tokens"] == 1_000_000
|
||||
assert model_info["max_output_tokens"] == 393_216
|
||||
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
|
||||
|
||||
|
||||
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-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_resolves_responses_and_messages_configs():
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
from litellm.llms.openai_like.messages.transformation import (
|
||||
JSONProviderAnthropicMessagesConfig,
|
||||
)
|
||||
from litellm.utils import ProviderConfigManager
|
||||
|
||||
assert JSONProviderRegistry.supports_responses_api("prism") is True
|
||||
responses_config = ProviderConfigManager.get_provider_responses_api_config(
|
||||
provider="prism",
|
||||
model="deepseek-v4-flash",
|
||||
)
|
||||
messages_config = ProviderConfigManager.get_provider_anthropic_messages_config(
|
||||
provider=litellm.LlmProviders.PRISM,
|
||||
model="deepseek-v4-flash",
|
||||
)
|
||||
|
||||
assert responses_config is not None
|
||||
assert responses_config.custom_llm_provider == "prism"
|
||||
assert isinstance(messages_config, JSONProviderAnthropicMessagesConfig)
|
||||
assert (
|
||||
messages_config.get_complete_url(
|
||||
api_base=None,
|
||||
api_key="prism-test-key",
|
||||
model="deepseek-v4-flash",
|
||||
optional_params={},
|
||||
litellm_params={},
|
||||
)
|
||||
== "https://api.prisminference.com/v1/messages"
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue