mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
Merge bcb0bba9f3 into dddbaa803d
This commit is contained in:
commit
f74dac2f81
7 changed files with 128 additions and 0 deletions
|
|
@ -1060,6 +1060,7 @@ openai_compatible_endpoints: Final[list[str]] = [
|
|||
"https://api.scx.ai/v1",
|
||||
"https://api.prisminference.com/v1",
|
||||
"https://api.reka.ai/v1",
|
||||
"https://modelflare.dev/v1",
|
||||
"https://gigachat.devices.sberbank.ru/api/v1",
|
||||
"https://api.openinfer.ai/v1",
|
||||
]
|
||||
|
|
@ -1141,6 +1142,7 @@ openai_compatible_providers: Final[list[str]] = [
|
|||
"prism",
|
||||
"sail",
|
||||
"reka",
|
||||
"modelflare",
|
||||
]
|
||||
|
||||
OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS: Final = frozenset({"openai"} | frozenset(openai_compatible_providers))
|
||||
|
|
|
|||
|
|
@ -249,5 +249,11 @@
|
|||
"/v1/responses",
|
||||
"/v1/messages"
|
||||
]
|
||||
},
|
||||
"modelflare": {
|
||||
"base_url": "https://modelflare.dev/v1",
|
||||
"api_key_env": "MODELFLARE_API_KEY",
|
||||
"api_base_env": "MODELFLARE_API_BASE",
|
||||
"supported_endpoints": ["/v1/chat/completions", "/v1/responses"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2136,6 +2136,24 @@
|
|||
"interactions": true
|
||||
}
|
||||
},
|
||||
"modelflare": {
|
||||
"display_name": "Modelflare (`modelflare`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/modelflare",
|
||||
"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
|
||||
}
|
||||
},
|
||||
"reka": {
|
||||
"display_name": "Reka (`reka`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/reka",
|
||||
|
|
|
|||
|
|
@ -2445,6 +2445,34 @@
|
|||
],
|
||||
"default_model_placeholder": "gpt-3.5-turbo"
|
||||
},
|
||||
{
|
||||
"provider": "MODELFLARE",
|
||||
"provider_display_name": "Modelflare",
|
||||
"litellm_provider": "modelflare",
|
||||
"credential_fields": [
|
||||
{
|
||||
"key": "api_key",
|
||||
"label": "Modelflare API Key",
|
||||
"placeholder": null,
|
||||
"tooltip": null,
|
||||
"required": true,
|
||||
"field_type": "password",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
},
|
||||
{
|
||||
"key": "api_base",
|
||||
"label": "API Base",
|
||||
"placeholder": "https://modelflare.dev/v1",
|
||||
"tooltip": null,
|
||||
"required": false,
|
||||
"field_type": "text",
|
||||
"options": null,
|
||||
"default_value": "https://modelflare.dev/v1"
|
||||
}
|
||||
],
|
||||
"default_model_placeholder": "modelflare/<model-name>"
|
||||
},
|
||||
{
|
||||
"provider": "Nace",
|
||||
"provider_display_name": "Nace",
|
||||
|
|
|
|||
|
|
@ -4586,6 +4586,7 @@ class LlmProviders(str, Enum):
|
|||
META = "meta"
|
||||
SAIL = "sail"
|
||||
REKA = "reka"
|
||||
MODELFLARE = "modelflare"
|
||||
LITELLM_AGENT = "litellm_agent"
|
||||
CURSOR = "cursor"
|
||||
BEDROCK_MANTLE = "bedrock_mantle"
|
||||
|
|
|
|||
|
|
@ -3205,6 +3205,24 @@
|
|||
"rerank": false
|
||||
}
|
||||
},
|
||||
"modelflare": {
|
||||
"display_name": "Modelflare (`modelflare`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/modelflare",
|
||||
"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
|
||||
}
|
||||
},
|
||||
"reka": {
|
||||
"display_name": "Reka (`reka`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/reka",
|
||||
|
|
|
|||
55
tests/unit/llms/openai_like/test_modelflare_provider.py
Normal file
55
tests/unit/llms/openai_like/test_modelflare_provider.py
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
"""
|
||||
Unit tests for the Modelflare OpenAI-compatible provider (JSON-configured).
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
import litellm
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
|
||||
MODELFLARE_BASE_URL = "https://modelflare.dev/v1"
|
||||
|
||||
|
||||
def test_modelflare_is_a_registered_provider():
|
||||
assert litellm.LlmProviders.MODELFLARE.value == "modelflare"
|
||||
assert "modelflare" in litellm.provider_list
|
||||
assert "modelflare" in litellm.constants.openai_compatible_providers
|
||||
|
||||
provider = JSONProviderRegistry.get("modelflare")
|
||||
assert provider is not None
|
||||
assert provider.base_url == MODELFLARE_BASE_URL
|
||||
assert provider.api_key_env == "MODELFLARE_API_KEY"
|
||||
assert provider.api_base_env == "MODELFLARE_API_BASE"
|
||||
|
||||
|
||||
def test_modelflare_provider_resolution(monkeypatch: pytest.MonkeyPatch):
|
||||
monkeypatch.setenv("MODELFLARE_API_KEY", "modelflare-test-key")
|
||||
monkeypatch.delenv("MODELFLARE_API_BASE", raising=False)
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
model="modelflare/some-model",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert model == "some-model"
|
||||
assert provider == "modelflare"
|
||||
assert api_key == "modelflare-test-key"
|
||||
assert api_base == MODELFLARE_BASE_URL
|
||||
|
||||
|
||||
def test_modelflare_api_base_env_overrides_default(monkeypatch: pytest.MonkeyPatch):
|
||||
monkeypatch.setenv("MODELFLARE_API_KEY", "modelflare-test-key")
|
||||
monkeypatch.setenv("MODELFLARE_API_BASE", "https://modelflare.env.example/v1")
|
||||
|
||||
_, provider, _, api_base = get_llm_provider(
|
||||
model="modelflare/some-model",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert provider == "modelflare"
|
||||
assert api_base == "https://modelflare.env.example/v1"
|
||||
Loading…
Add table
Reference in a new issue