From bf1b1c934b69469f64a01ca0d4a066953cd825cc Mon Sep 17 00:00:00 2001 From: rajitkhanna Date: Fri, 11 Sep 2026 13:15:13 -0700 Subject: [PATCH 1/6] feat(providers): add Prism provider --- litellm/constants.py | 2 + litellm/llms/openai_like/providers.json | 6 ++ ...odel_prices_and_context_window_backup.json | 22 +++++++ litellm/types/utils.py | 1 + model_prices_and_context_window.json | 22 +++++++ .../llms/openai_like/test_prism_provider.py | 60 +++++++++++++++++++ 6 files changed, 113 insertions(+) create mode 100644 tests/test_litellm/llms/openai_like/test_prism_provider.py diff --git a/litellm/constants.py b/litellm/constants.py index 6b984c2673c..11a9574b80a 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -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", diff --git a/litellm/llms/openai_like/providers.json b/litellm/llms/openai_like/providers.json index a458a209ea9..ddf63ae5829 100644 --- a/litellm/llms/openai_like/providers.json +++ b/litellm/llms/openai_like/providers.json @@ -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"] } } diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index ad992ff92eb..b9efc620a1d 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -64677,5 +64677,27 @@ "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" + ], + "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 } } diff --git a/litellm/types/utils.py b/litellm/types/utils.py index e3ea37dc0c8..d90233613e0 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -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" diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index ad992ff92eb..b9efc620a1d 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -64677,5 +64677,27 @@ "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" + ], + "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 } } diff --git a/tests/test_litellm/llms/openai_like/test_prism_provider.py b/tests/test_litellm/llms/openai_like/test_prism_provider.py new file mode 100644 index 00000000000..c308bd49aa1 --- /dev/null +++ b/tests/test_litellm/llms/openai_like/test_prism_provider.py @@ -0,0 +1,60 @@ +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 From 724004bb9f76c05bfbc2d10806fabfc97ed7b83b Mon Sep 17 00:00:00 2001 From: rajitkhanna Date: Fri, 11 Sep 2026 17:06:55 -0700 Subject: [PATCH 2/6] fix(providers): complete Prism registration --- .../provider_endpoints_support_backup.json | 17 +++++++++ .../provider_create_fields.json | 28 +++++++++++++++ provider_endpoints_support.json | 17 +++++++++ .../llms/openai_like/test_prism_provider.py | 36 +++++++++++++++++++ 4 files changed, 98 insertions(+) diff --git a/litellm/provider_endpoints_support_backup.json b/litellm/provider_endpoints_support_backup.json index dbeaccdda2d..fcbec074267 100644 --- a/litellm/provider_endpoints_support_backup.json +++ b/litellm/provider_endpoints_support_backup.json @@ -1925,6 +1925,23 @@ "interactions": true } }, + "prism": { + "display_name": "Prism (`prism`)", + "url": "https://docs.litellm.ai/docs/providers/prism", + "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 + } + }, "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 cd781abee26..4ad0e527ee5 100644 --- a/litellm/proxy/public_endpoints/provider_create_fields.json +++ b/litellm/proxy/public_endpoints/provider_create_fields.json @@ -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", diff --git a/provider_endpoints_support.json b/provider_endpoints_support.json index c71f4a82a4a..e4d4e3829df 100644 --- a/provider_endpoints_support.json +++ b/provider_endpoints_support.json @@ -2142,6 +2142,23 @@ "interactions": true } }, + "prism": { + "display_name": "Prism (`prism`)", + "url": "https://docs.litellm.ai/docs/providers/prism", + "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 + } + }, "recraft": { "display_name": "Recraft (`recraft`)", "url": "https://docs.litellm.ai/docs/providers/recraft", diff --git a/tests/test_litellm/llms/openai_like/test_prism_provider.py b/tests/test_litellm/llms/openai_like/test_prism_provider.py index c308bd49aa1..6652bdd84d1 100644 --- a/tests/test_litellm/llms/openai_like/test_prism_provider.py +++ b/tests/test_litellm/llms/openai_like/test_prism_provider.py @@ -1,3 +1,6 @@ +import json +from pathlib import Path + import pytest import litellm @@ -58,3 +61,36 @@ def test_prism_model_cost_and_capabilities(): 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": False, + "responses": False, + "embeddings": False, + "image_generations": False, + "audio_transcriptions": False, + "audio_speech": False, + "moderations": False, + "batches": False, + "rerank": False, + "a2a": False, + } From a85c5358577698281e6e0c8b993a0b6c1a04bc88 Mon Sep 17 00:00:00 2001 From: rajitkhanna Date: Fri, 11 Sep 2026 19:14:20 -0700 Subject: [PATCH 3/6] feat(providers): expose Prism responses and messages --- litellm/llms/openai_like/providers.json | 2 +- ...odel_prices_and_context_window_backup.json | 4 ++- .../provider_endpoints_support_backup.json | 4 +-- model_prices_and_context_window.json | 4 ++- provider_endpoints_support.json | 4 +-- .../llms/openai_like/test_prism_provider.py | 36 +++++++++++++++++-- 6 files changed, 45 insertions(+), 9 deletions(-) diff --git a/litellm/llms/openai_like/providers.json b/litellm/llms/openai_like/providers.json index ddf63ae5829..1958f6634ff 100644 --- a/litellm/llms/openai_like/providers.json +++ b/litellm/llms/openai_like/providers.json @@ -205,6 +205,6 @@ "base_url": "https://api.prisminference.com/v1", "api_key_env": "PRISM_API_KEY", "api_base_env": "PRISM_API_BASE", - "supported_endpoints": ["/v1/chat/completions"] + "supported_endpoints": ["/v1/chat/completions", "/v1/responses", "/v1/messages"] } } diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 8c147ec9a64..03eb89251a9 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -65075,7 +65075,9 @@ "output_cost_per_token": 2.8e-07, "source": "https://prisminference.com/pricing", "supported_endpoints": [ - "/v1/chat/completions" + "/v1/chat/completions", + "/v1/responses", + "/v1/messages" ], "supports_function_calling": true, "supports_native_streaming": true, diff --git a/litellm/provider_endpoints_support_backup.json b/litellm/provider_endpoints_support_backup.json index fcbec074267..35941d357d8 100644 --- a/litellm/provider_endpoints_support_backup.json +++ b/litellm/provider_endpoints_support_backup.json @@ -1930,8 +1930,8 @@ "url": "https://docs.litellm.ai/docs/providers/prism", "endpoints": { "chat_completions": true, - "messages": false, - "responses": false, + "messages": true, + "responses": true, "embeddings": false, "image_generations": false, "audio_transcriptions": false, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 8c147ec9a64..03eb89251a9 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -65075,7 +65075,9 @@ "output_cost_per_token": 2.8e-07, "source": "https://prisminference.com/pricing", "supported_endpoints": [ - "/v1/chat/completions" + "/v1/chat/completions", + "/v1/responses", + "/v1/messages" ], "supports_function_calling": true, "supports_native_streaming": true, diff --git a/provider_endpoints_support.json b/provider_endpoints_support.json index e4d4e3829df..f1cec19edbd 100644 --- a/provider_endpoints_support.json +++ b/provider_endpoints_support.json @@ -2147,8 +2147,8 @@ "url": "https://docs.litellm.ai/docs/providers/prism", "endpoints": { "chat_completions": true, - "messages": false, - "responses": false, + "messages": true, + "responses": true, "embeddings": false, "image_generations": false, "audio_transcriptions": false, diff --git a/tests/test_litellm/llms/openai_like/test_prism_provider.py b/tests/test_litellm/llms/openai_like/test_prism_provider.py index 6652bdd84d1..ca79947aa2d 100644 --- a/tests/test_litellm/llms/openai_like/test_prism_provider.py +++ b/tests/test_litellm/llms/openai_like/test_prism_provider.py @@ -83,8 +83,8 @@ def test_prism_supported_endpoints(): assert providers["prism"]["endpoints"] == { "chat_completions": True, - "messages": False, - "responses": False, + "messages": True, + "responses": True, "embeddings": False, "image_generations": False, "audio_transcriptions": False, @@ -94,3 +94,35 @@ def test_prism_supported_endpoints(): "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" + ) From 849a6524b812e47e12213638ee3f52f171baaddd Mon Sep 17 00:00:00 2001 From: rajitkhanna Date: Sat, 12 Sep 2026 16:02:00 -0700 Subject: [PATCH 4/6] feat(providers): add DeepSeek V4.1 Flash to Prism --- ...odel_prices_and_context_window_backup.json | 24 +++++++++++++++++ .../provider_create_fields.json | 2 +- model_prices_and_context_window.json | 24 +++++++++++++++++ .../llms/openai_like/test_prism_provider.py | 26 ++++++++++++++----- 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 03eb89251a9..e4df00a7b69 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -65064,6 +65064,30 @@ "supports_response_schema": true, "supports_vision": false }, + "prism/deepseek-v4.1-flash": { + "cache_read_input_token_cost": 7e-08, + "input_cost_per_token": 3e-07, + "litellm_provider": "prism", + "max_input_tokens": 1000000, + "max_output_tokens": 384000, + "max_tokens": 384000, + "mode": "chat", + "output_cost_per_token": 1.2e-06, + "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 + }, "prism/deepseek-v4-flash": { "cache_read_input_token_cost": 7e-08, "input_cost_per_token": 1.4e-07, diff --git a/litellm/proxy/public_endpoints/provider_create_fields.json b/litellm/proxy/public_endpoints/provider_create_fields.json index 4ad0e527ee5..fd7fe759926 100644 --- a/litellm/proxy/public_endpoints/provider_create_fields.json +++ b/litellm/proxy/public_endpoints/provider_create_fields.json @@ -2729,7 +2729,7 @@ "default_value": null } ], - "default_model_placeholder": "prism/deepseek-v4-flash" + "default_model_placeholder": "prism/deepseek-v4.1-flash" }, { "provider": "RECRAFT", diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 03eb89251a9..e4df00a7b69 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -65064,6 +65064,30 @@ "supports_response_schema": true, "supports_vision": false }, + "prism/deepseek-v4.1-flash": { + "cache_read_input_token_cost": 7e-08, + "input_cost_per_token": 3e-07, + "litellm_provider": "prism", + "max_input_tokens": 1000000, + "max_output_tokens": 384000, + "max_tokens": 384000, + "mode": "chat", + "output_cost_per_token": 1.2e-06, + "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 + }, "prism/deepseek-v4-flash": { "cache_read_input_token_cost": 7e-08, "input_cost_per_token": 1.4e-07, diff --git a/tests/test_litellm/llms/openai_like/test_prism_provider.py b/tests/test_litellm/llms/openai_like/test_prism_provider.py index ca79947aa2d..a09738eab1b 100644 --- a/tests/test_litellm/llms/openai_like/test_prism_provider.py +++ b/tests/test_litellm/llms/openai_like/test_prism_provider.py @@ -41,22 +41,34 @@ def test_prism_provider_keeps_explicit_credentials(monkeypatch: pytest.MonkeyPat assert api_base == "https://prism.internal.example/v1" -def test_prism_model_cost_and_capabilities(): +@pytest.mark.parametrize( + ("model", "input_cost", "output_cost", "max_output_tokens"), + [ + ("prism/deepseek-v4.1-flash", 0.30, 1.20, 384_000), + ("prism/deepseek-v4-flash", 0.14, 0.28, 393_216), + ], +) +def test_prism_model_cost_and_capabilities( + model: str, + input_cost: float, + output_cost: float, + max_output_tokens: int, +): from litellm.cost_calculator import cost_per_token prompt_cost, completion_cost = cost_per_token( - model="prism/deepseek-v4-flash", + model=model, prompt_tokens=1_000_000, completion_tokens=1_000_000, custom_llm_provider="prism", ) - model_info = litellm.get_model_info("prism/deepseek-v4-flash") + model_info = litellm.get_model_info(model) - assert prompt_cost == pytest.approx(0.14) - assert completion_cost == pytest.approx(0.28) + assert prompt_cost == pytest.approx(input_cost) + assert completion_cost == pytest.approx(output_cost) 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["max_output_tokens"] == max_output_tokens assert model_info["supports_function_calling"] is True assert model_info["supports_native_streaming"] is True assert model_info["supports_reasoning"] is True @@ -70,7 +82,7 @@ def test_prism_is_available_in_add_model_form(): assert prism["provider"] == "PRISM" assert prism["provider_display_name"] == "Prism" - assert prism["default_model_placeholder"] == "prism/deepseek-v4-flash" + 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, From a365f3c309772b99e6a385dd3a374bd7cbc72d4d Mon Sep 17 00:00:00 2001 From: rajitkhanna Date: Tue, 15 Sep 2026 11:59:42 -0700 Subject: [PATCH 5/6] test(providers): exercise Prism endpoint requests --- .../llms/openai_like/test_prism_provider.py | 121 ++++++++++++++---- 1 file changed, 94 insertions(+), 27 deletions(-) diff --git a/tests/test_litellm/llms/openai_like/test_prism_provider.py b/tests/test_litellm/llms/openai_like/test_prism_provider.py index a09738eab1b..f6b56612fd1 100644 --- a/tests/test_litellm/llms/openai_like/test_prism_provider.py +++ b/tests/test_litellm/llms/openai_like/test_prism_provider.py @@ -1,9 +1,19 @@ import json from pathlib import Path +import httpx import pytest import litellm +from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler + + +def _prism_client(requests: list[httpx.Request], response_body: dict[str, object]) -> HTTPHandler: + def respond(request: httpx.Request) -> httpx.Response: + requests.append(request) + return httpx.Response(200, json=response_body) + + return HTTPHandler(client=httpx.Client(transport=httpx.MockTransport(respond))) def test_prism_provider_resolution(monkeypatch: pytest.MonkeyPatch): @@ -108,33 +118,90 @@ def test_prism_supported_endpoints(): } -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", +def test_prism_responses_request(): + requests: list[httpx.Request] = [] + client = _prism_client( + requests, + { + "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, + }, + }, ) - 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" + response = litellm.responses( + model="prism/deepseek-v4-flash", + input="Say hello", + api_key="prism-test-key", + client=client, ) + + request = requests[0] + body = json.loads(request.content) + 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" + + +@pytest.mark.asyncio +async def test_prism_anthropic_messages_request(): + requests: list[httpx.Request] = [] + response_body: dict[str, object] = { + "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}, + } + + def respond(request: httpx.Request) -> httpx.Response: + requests.append(request) + return httpx.Response(200, json=response_body) + + client = AsyncHTTPHandler() + await client.close() + client.client = httpx.AsyncClient(transport=httpx.MockTransport(respond)) + + response = await litellm.anthropic.messages.acreate( + model="prism/deepseek-v4-flash", + messages=[{"role": "user", "content": "Say hello"}], + max_tokens=32, + api_key="prism-test-key", + client=client, + ) + + request = requests[0] + body = json.loads(request.content) + 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" From 7f9325430b1ee67b4c1d88637ce73045ae6ee41d Mon Sep 17 00:00:00 2001 From: rajitkhanna Date: Tue, 15 Sep 2026 12:29:59 -0700 Subject: [PATCH 6/6] test(vertex_ai): pin embedding spend assertions to bundled costs --- .../test_batch_embed_content_transformation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py b/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py index 86b3f0976ab..8c58ebbff7b 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py +++ b/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py @@ -299,10 +299,17 @@ class TestProcessResponse: ) +@pytest.mark.usefixtures("local_model_cost_map") class TestProcessEmbedContentResponseUsage: """Gemini Embedding 2 embedContent usageMetadata must drive spend. Regression for multimodal calls recording prompt_tokens=0 / spend=$0. + + The spend assertions read the ``gemini-embedding-2`` rates, so they must be + pinned to the bundled in-repo cost map: the default network-fetched ``main`` + copy is a different branch and already re-prices this model per modality + token (no ``input_cost_per_image`` / ``input_cost_per_*_per_second``), which + makes these cases fail for reasons unrelated to the transformation. """ MODEL = "gemini-embedding-2"