From cb1bb59d02a4c8209e9815a14023af8cfc6cd0e5 Mon Sep 17 00:00:00 2001 From: "Islomjon (Toji)" Date: Mon, 31 Aug 2026 18:08:57 +0900 Subject: [PATCH] feat: expose aiand provider in admin UI --- .../provider_create_fields.json | 28 ++++++++++ .../llms/openai_like/test_aiand_provider.py | 53 +++++++++++++++---- 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/litellm/proxy/public_endpoints/provider_create_fields.json b/litellm/proxy/public_endpoints/provider_create_fields.json index 4652719a23b..b67c78ba4bb 100644 --- a/litellm/proxy/public_endpoints/provider_create_fields.json +++ b/litellm/proxy/public_endpoints/provider_create_fields.json @@ -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", diff --git a/tests/test_litellm/llms/openai_like/test_aiand_provider.py b/tests/test_litellm/llms/openai_like/test_aiand_provider.py index 0fd434e3e5c..f2d96d963d4 100644 --- a/tests/test_litellm/llms/openai_like/test_aiand_provider.py +++ b/tests/test_litellm/llms/openai_like/test_aiand_provider.py @@ -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(