mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
Merge cb1bb59d02 into e26a6450c8
This commit is contained in:
commit
c289f9d9d8
7 changed files with 154 additions and 0 deletions
|
|
@ -916,6 +916,7 @@ openai_compatible_endpoints: Final[list] = [
|
|||
"https://api-inference.modelscope.cn/v1",
|
||||
"https://api.moonshot.ai/v1",
|
||||
"https://api.publicai.co/v1",
|
||||
"https://api.aiand.com/v1",
|
||||
"https://api.synthetic.new/openai/v1",
|
||||
"https://serverless.tensormesh.ai/v1",
|
||||
"https://api.stima.tech/v1",
|
||||
|
|
@ -975,6 +976,7 @@ openai_compatible_providers: Final[list] = [
|
|||
"novita",
|
||||
"meta_llama",
|
||||
"publicai", # PublicAI - JSON-configured provider
|
||||
"aiand", # ai& - JSON-configured provider
|
||||
"synthetic", # Synthetic - JSON-configured provider
|
||||
"tensormesh", # Tensormesh - JSON-configured provider
|
||||
"apertis", # Apertis - JSON-configured provider
|
||||
|
|
|
|||
|
|
@ -107,6 +107,12 @@
|
|||
"api_key_env": "AIHUBMIX_API_KEY",
|
||||
"api_base_env": "AIHUBMIX_API_BASE"
|
||||
},
|
||||
"aiand": {
|
||||
"base_url": "https://api.aiand.com/v1",
|
||||
"api_key_env": "AIAND_API_KEY",
|
||||
"api_base_env": "AIAND_API_BASE",
|
||||
"supported_endpoints": ["/v1/chat/completions", "/v1/responses"]
|
||||
},
|
||||
"crusoe": {
|
||||
"base_url": "https://managed-inference-api-proxy.crusoecloud.com/v1",
|
||||
"api_key_env": "CRUSOE_API_KEY",
|
||||
|
|
|
|||
|
|
@ -120,6 +120,23 @@
|
|||
"interactions": true
|
||||
}
|
||||
},
|
||||
"aiand": {
|
||||
"display_name": "ai& (`aiand`)",
|
||||
"url": "https://docs.aiand.com/api/chat-completions/",
|
||||
"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
|
||||
}
|
||||
},
|
||||
"amazon_nova": {
|
||||
"display_name": "Amazon Nova (`amazon_nova`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/amazon_nova",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,32 @@
|
|||
[
|
||||
{
|
||||
"provider": "AIAND",
|
||||
"provider_display_name": "ai&",
|
||||
"litellm_provider": "aiand",
|
||||
"credential_fields": [
|
||||
{
|
||||
"key": "api_base",
|
||||
"label": "API Base",
|
||||
"placeholder": "https://api.aiand.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": "aiand/openai/gpt-oss-120b"
|
||||
},
|
||||
{
|
||||
"provider": "AIML",
|
||||
"provider_display_name": "AI/ML API",
|
||||
|
|
|
|||
|
|
@ -4289,6 +4289,7 @@ class LlmProviders(str, Enum):
|
|||
POE = "poe"
|
||||
CHUTES = "chutes"
|
||||
NEOSANTARA = "neosantara"
|
||||
AIAND = "aiand"
|
||||
PARASAIL = "parasail"
|
||||
XIAOMI_MIMO = "xiaomi_mimo"
|
||||
TENSORMESH = "tensormesh"
|
||||
|
|
|
|||
|
|
@ -120,6 +120,23 @@
|
|||
"interactions": true
|
||||
}
|
||||
},
|
||||
"aiand": {
|
||||
"display_name": "ai& (`aiand`)",
|
||||
"url": "https://docs.aiand.com/api/chat-completions/",
|
||||
"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
|
||||
}
|
||||
},
|
||||
"amazon_nova": {
|
||||
"display_name": "Amazon Nova (`amazon_nova`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/amazon_nova",
|
||||
|
|
|
|||
83
tests/test_litellm/llms/openai_like/test_aiand_provider.py
Normal file
83
tests/test_litellm/llms/openai_like/test_aiand_provider.py
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
import json
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
import respx
|
||||
|
||||
import litellm
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
from litellm.utils import ProviderConfigManager
|
||||
|
||||
AIAND_API_BASE = "https://api.aiand.com/v1"
|
||||
|
||||
|
||||
def test_aiand_chat_provider(monkeypatch: pytest.MonkeyPatch):
|
||||
monkeypatch.setenv("AIAND_API_KEY", "test-key")
|
||||
|
||||
provider_config = JSONProviderRegistry.get("aiand")
|
||||
assert provider_config is not None
|
||||
assert litellm.LlmProviders.AIAND.value == "aiand"
|
||||
assert "aiand" in litellm.openai_compatible_providers
|
||||
assert provider_config.base_url == AIAND_API_BASE
|
||||
assert provider_config.api_key_env == "AIAND_API_KEY"
|
||||
assert provider_config.api_base_env == "AIAND_API_BASE"
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider("aiand/openai/gpt-oss-120b")
|
||||
assert model == "openai/gpt-oss-120b"
|
||||
assert provider == "aiand"
|
||||
assert api_key == "test-key"
|
||||
assert api_base == AIAND_API_BASE
|
||||
|
||||
|
||||
|
||||
def test_aiand_completion_request(respx_mock: respx.MockRouter):
|
||||
messages = [{"role": "user", "content": "Hello"}]
|
||||
route = respx_mock.post(f"{AIAND_API_BASE}/chat/completions").mock(
|
||||
return_value=httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"id": "chatcmpl-test",
|
||||
"object": "chat.completion",
|
||||
"created": 1,
|
||||
"model": "openai/gpt-oss-120b",
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
"message": {"role": "assistant", "content": "Hello"},
|
||||
"finish_reason": "stop",
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"prompt_tokens": 1,
|
||||
"completion_tokens": 1,
|
||||
"total_tokens": 2,
|
||||
},
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
litellm.completion(
|
||||
model="aiand/openai/gpt-oss-120b",
|
||||
api_key="test-key",
|
||||
messages=messages,
|
||||
)
|
||||
|
||||
assert route.called
|
||||
request = route.calls.last.request
|
||||
assert str(request.url) == f"{AIAND_API_BASE}/chat/completions"
|
||||
assert request.headers["Authorization"] == "Bearer test-key"
|
||||
request_body = json.loads(request.read())
|
||||
assert request_body["model"] == "openai/gpt-oss-120b"
|
||||
assert request_body["messages"] == messages
|
||||
|
||||
|
||||
def test_aiand_responses_provider():
|
||||
config = ProviderConfigManager.get_provider_responses_api_config(
|
||||
provider="aiand",
|
||||
model="aiand/openai/gpt-oss-120b",
|
||||
)
|
||||
|
||||
assert config is not None
|
||||
assert config.custom_llm_provider == "aiand"
|
||||
assert config.get_complete_url(api_base=None, litellm_params={}) == f"{AIAND_API_BASE}/responses"
|
||||
Loading…
Add table
Reference in a new issue