mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
Merge 507b7ddb51 into dddbaa803d
This commit is contained in:
commit
3f88dbfcbe
7 changed files with 169 additions and 0 deletions
|
|
@ -1062,6 +1062,7 @@ openai_compatible_endpoints: Final[list[str]] = [
|
|||
"https://api.reka.ai/v1",
|
||||
"https://gigachat.devices.sberbank.ru/api/v1",
|
||||
"https://api.openinfer.ai/v1",
|
||||
"https://obscurify.ai/v1",
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -1132,6 +1133,7 @@ openai_compatible_providers: Final[list[str]] = [
|
|||
"ragflow",
|
||||
"pinstripes", # Pinstripes - JSON-configured provider
|
||||
"openinfer",
|
||||
"obscurify",
|
||||
"darkbloom",
|
||||
"meta", # Meta Model API (Muse Spark) - JSON-configured provider
|
||||
"cognition",
|
||||
|
|
|
|||
|
|
@ -249,5 +249,18 @@
|
|||
"/v1/responses",
|
||||
"/v1/messages"
|
||||
]
|
||||
},
|
||||
"obscurify": {
|
||||
"base_url": "https://obscurify.ai/v1",
|
||||
"api_key_env": "OBSCURIFY_API_KEY",
|
||||
"api_base_env": "OBSCURIFY_API_BASE",
|
||||
"param_mappings": {
|
||||
"max_completion_tokens": "max_tokens"
|
||||
},
|
||||
"provider_info": {
|
||||
"supports_function_calling": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"supported_endpoints": ["/v1/chat/completions", "/v1/responses"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2207,6 +2207,24 @@
|
|||
"interactions": false
|
||||
}
|
||||
},
|
||||
"obscurify": {
|
||||
"display_name": "Obscurify.ai (`obscurify`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/obscurify",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
"messages": false,
|
||||
"responses": true,
|
||||
"embeddings": false,
|
||||
"image_generations": false,
|
||||
"audio_transcriptions": false,
|
||||
"audio_speech": false,
|
||||
"moderations": false,
|
||||
"batches": false,
|
||||
"rerank": false,
|
||||
"a2a": false,
|
||||
"interactions": false
|
||||
}
|
||||
},
|
||||
"snowflake": {
|
||||
"display_name": "Snowflake (`snowflake`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/snowflake",
|
||||
|
|
|
|||
|
|
@ -3435,6 +3435,34 @@
|
|||
],
|
||||
"default_model_placeholder": "inferenceapis/deepseek-ai/DeepSeek-V4-Flash"
|
||||
},
|
||||
{
|
||||
"provider": "OBSCURIFY",
|
||||
"provider_display_name": "Obscurify.ai",
|
||||
"litellm_provider": "obscurify",
|
||||
"credential_fields": [
|
||||
{
|
||||
"key": "api_base",
|
||||
"label": "API Base",
|
||||
"placeholder": "https://obscurify.ai/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": "obscurify/deepseek/deepseek-v4-flash"
|
||||
},
|
||||
{
|
||||
"provider": "Snowflake",
|
||||
"provider_display_name": "Snowflake",
|
||||
|
|
|
|||
|
|
@ -4582,6 +4582,7 @@ class LlmProviders(str, Enum):
|
|||
PRISM = "prism"
|
||||
OPENINFER = "openinfer"
|
||||
INFERENCEAPIS = "inferenceapis"
|
||||
OBSCURIFY = "obscurify"
|
||||
DARKBLOOM = "darkbloom"
|
||||
META = "meta"
|
||||
SAIL = "sail"
|
||||
|
|
|
|||
|
|
@ -2479,6 +2479,24 @@
|
|||
"interactions": false
|
||||
}
|
||||
},
|
||||
"obscurify": {
|
||||
"display_name": "Obscurify.ai (`obscurify`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/obscurify",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
"messages": false,
|
||||
"responses": true,
|
||||
"embeddings": false,
|
||||
"image_generations": false,
|
||||
"audio_transcriptions": false,
|
||||
"audio_speech": false,
|
||||
"moderations": false,
|
||||
"batches": false,
|
||||
"rerank": false,
|
||||
"a2a": false,
|
||||
"interactions": false
|
||||
}
|
||||
},
|
||||
"snowflake": {
|
||||
"display_name": "Snowflake (`snowflake`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/snowflake",
|
||||
|
|
|
|||
89
tests/unit/llms/openai_like/test_obscurify_provider.py
Normal file
89
tests/unit/llms/openai_like/test_obscurify_provider.py
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
"""
|
||||
Unit tests for the Obscurify.ai OpenAI-like provider.
|
||||
"""
|
||||
|
||||
import litellm
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
from litellm.llms.openai_like.dynamic_config import create_config_class
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
|
||||
OBSCURIFY_BASE_URL = "https://obscurify.ai/v1"
|
||||
|
||||
|
||||
def _get_config():
|
||||
provider = JSONProviderRegistry.get("obscurify")
|
||||
assert provider is not None
|
||||
config_class = create_config_class(provider)
|
||||
return config_class()
|
||||
|
||||
|
||||
def test_obscurify_provider_registered():
|
||||
provider = JSONProviderRegistry.get("obscurify")
|
||||
assert provider is not None
|
||||
assert provider.base_url == OBSCURIFY_BASE_URL
|
||||
assert provider.api_key_env == "OBSCURIFY_API_KEY"
|
||||
assert provider.api_base_env == "OBSCURIFY_API_BASE"
|
||||
assert "obscurify" in litellm.provider_list
|
||||
|
||||
|
||||
def test_obscurify_keeps_tools_and_reasoning_effort():
|
||||
config = _get_config()
|
||||
supported = config.get_supported_openai_params(model="z-ai/glm-5.3")
|
||||
assert "tools" in supported
|
||||
assert "tool_choice" in supported
|
||||
assert "reasoning_effort" in supported
|
||||
|
||||
|
||||
def test_obscurify_resolves_model_with_slash():
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
model="obscurify/deepseek/deepseek-v4-flash",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
assert model == "deepseek/deepseek-v4-flash"
|
||||
assert provider == "obscurify"
|
||||
assert api_base == OBSCURIFY_BASE_URL
|
||||
|
||||
|
||||
def test_obscurify_resolves_env_api_key(monkeypatch):
|
||||
config = _get_config()
|
||||
monkeypatch.setenv("OBSCURIFY_API_KEY", "sk-obs1_test")
|
||||
api_base, api_key = config.get_openai_compatible_provider_info(None, None)
|
||||
assert api_base == OBSCURIFY_BASE_URL
|
||||
assert api_key == "sk-obs1_test"
|
||||
|
||||
|
||||
def test_obscurify_maps_max_completion_tokens():
|
||||
config = _get_config()
|
||||
params = config.map_openai_params(
|
||||
non_default_params={"max_completion_tokens": 256},
|
||||
optional_params={},
|
||||
model="obscurify/deepseek/deepseek-v4-flash",
|
||||
drop_params=False,
|
||||
)
|
||||
assert params.get("max_tokens") == 256
|
||||
assert "max_completion_tokens" not in params
|
||||
|
||||
|
||||
def test_obscurify_complete_url_appends_endpoint():
|
||||
config = _get_config()
|
||||
url = config.get_complete_url(
|
||||
api_base=OBSCURIFY_BASE_URL,
|
||||
api_key="sk-obs1_test",
|
||||
model="obscurify/deepseek/deepseek-v4-flash",
|
||||
optional_params={},
|
||||
litellm_params={},
|
||||
stream=False,
|
||||
)
|
||||
assert url == f"{OBSCURIFY_BASE_URL}/chat/completions"
|
||||
|
||||
|
||||
def test_obscurify_responses_api_config():
|
||||
from litellm.utils import ProviderConfigManager
|
||||
|
||||
config = ProviderConfigManager.get_provider_responses_api_config(
|
||||
provider=litellm.LlmProviders.OBSCURIFY,
|
||||
model="deepseek/deepseek-v4-flash",
|
||||
)
|
||||
assert config is not None
|
||||
Loading…
Add table
Reference in a new issue