feat: expose aiand provider in admin UI

This commit is contained in:
Islomjon (Toji) 2026-08-31 18:08:57 +09:00
parent d56b224e01
commit cb1bb59d02
2 changed files with 71 additions and 10 deletions

View file

@ -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",

View file

@ -1,8 +1,11 @@
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.dynamic_config import create_config_class
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
from litellm.utils import ProviderConfigManager
@ -26,18 +29,48 @@ def test_aiand_chat_provider(monkeypatch: pytest.MonkeyPatch):
assert api_key == "test-key"
assert api_base == AIAND_API_BASE
config = create_config_class(provider_config)()
assert (
config.get_complete_url(
api_base=None,
api_key=None,
model=model,
optional_params={},
litellm_params={},
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,
},
},
)
== f"{AIAND_API_BASE}/chat/completions"
)
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(