From a00914cd3e3f9a60560b404cbaa4d4c02f990d21 Mon Sep 17 00:00:00 2001 From: mubashir1osmani Date: Mon, 24 Aug 2026 13:43:20 -0400 Subject: [PATCH 1/2] feat: add openai-compatible embedding providers --- litellm/constants.py | 9 +++++ litellm/main.py | 3 ++ litellm/types/utils.py | 3 ++ ...t_openai_compatible_embedding_providers.py | 34 +++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 tests/test_litellm/test_openai_compatible_embedding_providers.py diff --git a/litellm/constants.py b/litellm/constants.py index aaaddd063e7..a75e66b14ca 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -529,6 +529,9 @@ LITELLM_CHAT_PROVIDERS: Final = [ "gdc", "xai", "custom_openai", + "byteplus", + "digitalocean", + "siliconflow", "text-completion-openai", "cohere", "cohere_chat", @@ -847,6 +850,9 @@ openai_compatible_providers: Final[list] = [ "cometapi", "clarifai", "docker_model_runner", + "byteplus", + "digitalocean", + "siliconflow", "ragflow", "pinstripes", # Pinstripes - JSON-configured provider "darkbloom", @@ -876,6 +882,9 @@ openai_text_completion_compatible_providers: Final[list] = [ # providers that s "lambda_ai", "hyperbolic", "wandb", + "byteplus", + "digitalocean", + "siliconflow", ] _openai_like_providers: Final[list] = [ "predibase", diff --git a/litellm/main.py b/litellm/main.py index 2cf53833c5a..62c498a79c9 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -6222,6 +6222,9 @@ def embedding( or custom_llm_provider == "together_ai" or custom_llm_provider == "nvidia_nim" or custom_llm_provider == "litellm_proxy" + or custom_llm_provider == "byteplus" + or custom_llm_provider == "digitalocean" + or custom_llm_provider == "siliconflow" or (model in litellm.open_ai_embedding_models and custom_llm_provider is None) ): api_base = ( diff --git a/litellm/types/utils.py b/litellm/types/utils.py index 67eae2b4f21..8e79e240688 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -3664,6 +3664,9 @@ class LlmProviders(str, Enum): ANTHROPIC = "anthropic" ANTHROPIC_TEXT = "anthropic_text" BYTEZ = "bytez" + BYTEPLUS = "byteplus" + DIGITALOCEAN = "digitalocean" + SILICONFLOW = "siliconflow" REPLICATE = "replicate" REDUCTO = "reducto" RUNWAYML = "runwayml" diff --git a/tests/test_litellm/test_openai_compatible_embedding_providers.py b/tests/test_litellm/test_openai_compatible_embedding_providers.py new file mode 100644 index 00000000000..8980c191d92 --- /dev/null +++ b/tests/test_litellm/test_openai_compatible_embedding_providers.py @@ -0,0 +1,34 @@ +from unittest.mock import MagicMock, patch + +import pytest + +import litellm + + +@pytest.mark.parametrize("provider", ["byteplus", "digitalocean", "siliconflow"]) +def test_openai_compatible_provider_embedding_dispatch(provider): + mock_response = MagicMock() + mock_response.parse.return_value = MagicMock( + model_dump=lambda: { + "data": [{"embedding": [0.1, 0.2, 0.3], "index": 0}], + "model": "test-embedding", + "object": "list", + "usage": {"prompt_tokens": 1, "total_tokens": 1}, + } + ) + mock_response.headers = {} + + with patch("litellm.llms.openai.openai.OpenAIChatCompletion._get_openai_client") as mock_get_client: + mock_client = MagicMock() + mock_get_client.return_value = mock_client + mock_client.embeddings.with_raw_response.create.return_value = mock_response + + response = litellm.embedding( + model=f"{provider}/test-embedding", + input="Hello world", + api_key="test-key", + api_base="http://test.example/v1", + ) + + assert response.data[0]["embedding"] == [0.1, 0.2, 0.3] + assert mock_client.embeddings.with_raw_response.create.called From b49032fc8046951a027b6028e5d9555f27cf703b Mon Sep 17 00:00:00 2001 From: mubashir1osmani Date: Mon, 24 Aug 2026 14:01:33 -0400 Subject: [PATCH 2/2] feat: route additional providers to openai embeddings --- litellm/main.py | 3 +++ .../test_openai_compatible_embedding_providers.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/main.py b/litellm/main.py index 62c498a79c9..39ff2618ddf 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -6225,6 +6225,9 @@ def embedding( or custom_llm_provider == "byteplus" or custom_llm_provider == "digitalocean" or custom_llm_provider == "siliconflow" + or custom_llm_provider == "deepinfra" + or custom_llm_provider == "nscale" + or custom_llm_provider == "novita" or (model in litellm.open_ai_embedding_models and custom_llm_provider is None) ): api_base = ( diff --git a/tests/test_litellm/test_openai_compatible_embedding_providers.py b/tests/test_litellm/test_openai_compatible_embedding_providers.py index 8980c191d92..3f7fb7c9275 100644 --- a/tests/test_litellm/test_openai_compatible_embedding_providers.py +++ b/tests/test_litellm/test_openai_compatible_embedding_providers.py @@ -5,7 +5,10 @@ import pytest import litellm -@pytest.mark.parametrize("provider", ["byteplus", "digitalocean", "siliconflow"]) +@pytest.mark.parametrize( + "provider", + ["byteplus", "digitalocean", "siliconflow", "deepinfra", "nscale", "novita"], +) def test_openai_compatible_provider_embedding_dispatch(provider): mock_response = MagicMock() mock_response.parse.return_value = MagicMock(