This commit is contained in:
Aditya Batra 2026-10-31 16:17:27 +00:00 • committed by GitHub
commit bf49fbe2a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 820 additions and 0 deletions

View file

@ -1084,6 +1084,7 @@ openai_compatible_endpoints: Final[list[str]] = [
"https://api.scx.ai/v1",
"https://api.prisminference.com/v1",
"https://api.reka.ai/v1",
"https://inference.runanywhere.ai/v1",
"https://gigachat.devices.sberbank.ru/api/v1",
"https://api.openinfer.ai/v1",
"https://vanchin.streamlake.ai/api/gateway/v1/endpoints",
@ -1171,6 +1172,7 @@ openai_compatible_providers: Final[list[str]] = [
"sail",
"reka",
"streamlake",
"wally",
]
OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS: Final = frozenset({"openai"} | frozenset(openai_compatible_providers))

View file

@ -302,5 +302,10 @@
"preserve_cache_control": true
},
"supported_endpoints": ["/v1/chat/completions"]
},
"wally": {
"base_url": "https://inference.runanywhere.ai/v1",
"api_key_env": "WALLY_API_KEY",
"api_base_env": "WALLY_API_BASE"
}
}

View file

@ -81444,5 +81444,251 @@
"supports_response_schema": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true
},
"wally/glm-5.3-flash": {
"cache_read_input_token_cost": 7.6e-08,
"input_cost_per_token": 2.72e-07,
"litellm_provider": "wally",
"max_input_tokens": 1048567,
"max_output_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 6.5e-07,
"reasoning_effort_levels": [
"minimal",
"low",
"medium",
"high",
"xhigh",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"wally/deepseek-v4.1-flash": {
"cache_read_input_token_cost": 6e-09,
"input_cost_per_token": 3e-07,
"litellm_provider": "wally",
"max_input_tokens": 1048569,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 1.2e-06,
"reasoning_effort_levels": [
"none",
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true
},
"wally/kimi-k3": {
"cache_read_input_token_cost": 3e-07,
"input_cost_per_token": 3e-06,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 1.5e-05,
"reasoning_effort_levels": [
"none",
"low",
"medium",
"high",
"xhigh",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true
},
"wally/deepseek-v4.1-flash-fast": {
"cache_read_input_token_cost": 1.4e-08,
"input_cost_per_token": 6e-07,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 2.4e-06,
"reasoning_effort_levels": [
"none",
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true
},
"wally/glm-5.3-fast": {
"cache_read_input_token_cost": 3.9e-07,
"input_cost_per_token": 2.1e-06,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 6.6e-06,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"wally/deepseek-v4-pro-fast": {
"cache_read_input_token_cost": 1.6e-07,
"input_cost_per_token": 1.91e-06,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 3.83e-06,
"reasoning_effort_levels": [
"none",
"minimal",
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"wally/deepseek-v4-flash-0731": {
"cache_read_input_token_cost": 1.4e-08,
"input_cost_per_token": 4.4e-07,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 1.32e-06,
"reasoning_effort_levels": [
"none",
"minimal",
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"wally/minimax-m3": {
"cache_read_input_token_cost": 6.6e-08,
"input_cost_per_token": 3.3e-07,
"litellm_provider": "wally",
"max_input_tokens": 524287,
"max_output_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 1.32e-06,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
}
}

View file

@ -5250,6 +5250,32 @@
"generateContent": false
}
},
"wally": {
"display_name": "Wally (`wally`)",
"url": "https://docs.litellm.ai/docs/providers/wally",
"endpoints": {
"chat_completions": true,
"responses": true,
"text_completion": true,
"embeddings": false,
"image_generations": false,
"image_edits": false,
"audio_transcriptions": false,
"audio_speech": false,
"rerank": false,
"ocr": false,
"search": false,
"moderations": false,
"realtime": false,
"video_generations": false,
"batches": false,
"messages": true,
"interactions": true,
"systemone": false,
"a2a": true,
"generateContent": true
}
},
"empiriolabs": {
"display_name": "EmpirioLabs (`empiriolabs`)",
"url": "https://docs.litellm.ai/docs/providers/empiriolabs",

View file

@ -3539,6 +3539,34 @@
],
"default_model_placeholder": "reka/reka-flash"
},
{
"provider": "WALLY",
"provider_display_name": "Wally",
"litellm_provider": "wally",
"credential_fields": [
{
"key": "api_base",
"label": "API Base",
"placeholder": "https://inference.runanywhere.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": "wally/glm-5.3-flash"
},
{
"provider": "Sail",
"provider_display_name": "Sail",

View file

@ -4696,6 +4696,7 @@ class LlmProviders(str, Enum):
SAIL = "sail"
REKA = "reka"
STREAMLAKE = "streamlake"
WALLY = "wally"
LITELLM_AGENT = "litellm_agent"
CURSOR = "cursor"
BEDROCK_MANTLE = "bedrock_mantle"

View file

@ -81444,5 +81444,251 @@
"supports_response_schema": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true
},
"wally/glm-5.3-flash": {
"cache_read_input_token_cost": 7.6e-08,
"input_cost_per_token": 2.72e-07,
"litellm_provider": "wally",
"max_input_tokens": 1048567,
"max_output_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 6.5e-07,
"reasoning_effort_levels": [
"minimal",
"low",
"medium",
"high",
"xhigh",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"wally/deepseek-v4.1-flash": {
"cache_read_input_token_cost": 6e-09,
"input_cost_per_token": 3e-07,
"litellm_provider": "wally",
"max_input_tokens": 1048569,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 1.2e-06,
"reasoning_effort_levels": [
"none",
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true
},
"wally/kimi-k3": {
"cache_read_input_token_cost": 3e-07,
"input_cost_per_token": 3e-06,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 1.5e-05,
"reasoning_effort_levels": [
"none",
"low",
"medium",
"high",
"xhigh",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true
},
"wally/deepseek-v4.1-flash-fast": {
"cache_read_input_token_cost": 1.4e-08,
"input_cost_per_token": 6e-07,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 2.4e-06,
"reasoning_effort_levels": [
"none",
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true
},
"wally/glm-5.3-fast": {
"cache_read_input_token_cost": 3.9e-07,
"input_cost_per_token": 2.1e-06,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 6.6e-06,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"wally/deepseek-v4-pro-fast": {
"cache_read_input_token_cost": 1.6e-07,
"input_cost_per_token": 1.91e-06,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 3.83e-06,
"reasoning_effort_levels": [
"none",
"minimal",
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"wally/deepseek-v4-flash-0731": {
"cache_read_input_token_cost": 1.4e-08,
"input_cost_per_token": 4.4e-07,
"litellm_provider": "wally",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"mode": "chat",
"output_cost_per_token": 1.32e-06,
"reasoning_effort_levels": [
"none",
"minimal",
"low",
"medium",
"high",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"wally/minimax-m3": {
"cache_read_input_token_cost": 6.6e-08,
"input_cost_per_token": 3.3e-07,
"litellm_provider": "wally",
"max_input_tokens": 524287,
"max_output_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 1.32e-06,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh",
"max"
],
"source": "https://www.runwally.com/pricing",
"supported_modalities": [
"text"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
}
}

View file

@ -5250,6 +5250,32 @@
"generateContent": false
}
},
"wally": {
"display_name": "Wally (`wally`)",
"url": "https://docs.litellm.ai/docs/providers/wally",
"endpoints": {
"chat_completions": true,
"responses": true,
"text_completion": true,
"embeddings": false,
"image_generations": false,
"image_edits": false,
"audio_transcriptions": false,
"audio_speech": false,
"rerank": false,
"ocr": false,
"search": false,
"moderations": false,
"realtime": false,
"video_generations": false,
"batches": false,
"messages": true,
"interactions": true,
"systemone": false,
"a2a": true,
"generateContent": true
}
},
"empiriolabs": {
"display_name": "EmpirioLabs (`empiriolabs`)",
"url": "https://docs.litellm.ai/docs/providers/empiriolabs",

View file

@ -0,0 +1,240 @@
import json
from pathlib import Path
from typing import Final
import pytest
import respx
import litellm
from litellm.caching.llm_caching_handler import LLMClientCache
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
_DEFAULT_API_BASE: Final = "https://inference.runanywhere.ai/v1"
_CHAT_COMPLETIONS_URL: Final = f"{_DEFAULT_API_BASE}/chat/completions"
_CHAT_COMPLETION: Final = {
"id": "chatcmpl_wally",
"object": "chat.completion",
"created": 1_790_000_000,
"model": "glm-5.3-flash",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "Hello from Wally", "reasoning_content": "Say hi"},
"finish_reason": "stop",
}
],
"usage": {"prompt_tokens": 4, "completion_tokens": 3, "total_tokens": 7},
}
_EXPECTED_ENDPOINTS: Final = {
"chat_completions": True,
"messages": True,
"responses": True,
"embeddings": False,
"image_generations": False,
"audio_transcriptions": False,
"audio_speech": False,
"moderations": False,
"batches": False,
"rerank": False,
}
WALLY_MODELS: Final = tuple(sorted(name for name in litellm.model_cost if name.startswith("wally/")))
def test_wally_is_a_registered_provider():
assert litellm.LlmProviders.WALLY.value == "wally"
assert "wally" in litellm.provider_list
assert "wally" in litellm.constants.openai_compatible_providers
assert _DEFAULT_API_BASE in litellm.constants.openai_compatible_endpoints
def test_wally_provider_resolution(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("WALLY_API_KEY", "wally-test-key")
monkeypatch.delenv("WALLY_API_BASE", raising=False)
model, provider, api_key, api_base = get_llm_provider(
model="wally/glm-5.3-flash",
custom_llm_provider=None,
api_base=None,
api_key=None,
)
assert model == "glm-5.3-flash"
assert provider == "wally"
assert api_key == "wally-test-key"
assert api_base == _DEFAULT_API_BASE
def test_wally_provider_keeps_explicit_credentials(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("WALLY_API_KEY", "wally-env-key")
monkeypatch.setenv("WALLY_API_BASE", "https://wally.env.example/v1")
_, provider, api_key, api_base = get_llm_provider(
model="wally/glm-5.3-flash",
custom_llm_provider=None,
api_base="https://wally.internal.example/v1",
api_key="wally-explicit-key",
)
assert provider == "wally"
assert api_key == "wally-explicit-key"
assert api_base == "https://wally.internal.example/v1"
def test_wally_api_base_env_overrides_default(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("WALLY_API_KEY", "wally-env-key")
monkeypatch.setenv("WALLY_API_BASE", "https://wally.env.example/v1")
_, provider, _, api_base = get_llm_provider(
model="wally/glm-5.3-flash",
custom_llm_provider=None,
api_base=None,
api_key=None,
)
assert provider == "wally"
assert api_base == "https://wally.env.example/v1"
def test_wally_api_base_autodetects_provider(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("WALLY_API_KEY", "wally-env-key")
model, provider, api_key, api_base = get_llm_provider(
model="glm-5.3-flash",
custom_llm_provider=None,
api_base=_DEFAULT_API_BASE,
api_key=None,
)
assert model == "glm-5.3-flash"
assert provider == "wally"
assert api_key == "wally-env-key"
assert api_base == _DEFAULT_API_BASE
@pytest.mark.parametrize("model", WALLY_MODELS)
def test_wally_model_cost_and_capabilities(model: str):
from litellm.cost_calculator import cost_per_token
prompt_cost, completion_cost = cost_per_token(
model=model,
prompt_tokens=1_000_000,
completion_tokens=1_000_000,
custom_llm_provider="wally",
)
model_info: Final = litellm.get_model_info(model)
assert prompt_cost == pytest.approx(model_info["input_cost_per_token"] * 1_000_000)
assert completion_cost == pytest.approx(model_info["output_cost_per_token"] * 1_000_000)
assert 0 < model_info["cache_read_input_token_cost"] < model_info["input_cost_per_token"]
assert model_info["input_cost_per_token"] < model_info["output_cost_per_token"]
assert model_info["max_tokens"] == model_info["max_output_tokens"] <= model_info["max_input_tokens"]
assert model_info["litellm_provider"] == "wally"
assert model_info["mode"] == "chat"
assert model_info["supports_function_calling"] is True
assert model_info["supports_tool_choice"] is True
assert model_info["supports_reasoning"] is True
assert model_info["supports_response_schema"] is True
assert litellm.supports_vision(model) is ("image" in litellm.model_cost[model]["supported_modalities"])
def test_wally_backup_registry_mirrors_cost_map():
package_root: Final = Path(litellm.__file__).parent
cost_map: Final = json.loads((package_root.parent / "model_prices_and_context_window.json").read_text())
backup: Final = json.loads((package_root / "model_prices_and_context_window_backup.json").read_text())
wally_entries: Final = {name: entry for name, entry in cost_map.items() if name.startswith("wally/")}
assert wally_entries
assert tuple(sorted(wally_entries)) == WALLY_MODELS
assert wally_entries == {name: backup[name] for name in wally_entries}
def test_wally_is_available_in_add_model_form():
fields_path: Final = Path(litellm.__file__).parent / "proxy" / "public_endpoints" / "provider_create_fields.json"
providers: Final = json.loads(fields_path.read_text())
wally: Final = next(provider for provider in providers if provider["litellm_provider"] == "wally")
assert wally["provider"] == "WALLY"
assert wally["provider_display_name"] == "Wally"
assert wally["default_model_placeholder"] in WALLY_MODELS
assert {field["key"]: field["required"] for field in wally["credential_fields"]} == {
"api_base": False,
"api_key": True,
}
def test_wally_supported_endpoints():
backup_path: Final = Path(litellm.__file__).parent / "provider_endpoints_support_backup.json"
root_path: Final = Path(litellm.__file__).parent.parent / "provider_endpoints_support.json"
backup: Final = json.loads(backup_path.read_text())["providers"]["wally"]["endpoints"]
root: Final = json.loads(root_path.read_text())["providers"]["wally"]["endpoints"]
assert backup == root
assert {endpoint: root[endpoint] for endpoint in _EXPECTED_ENDPOINTS} == _EXPECTED_ENDPOINTS
@pytest.mark.parametrize("reasoning_effort", ["none", "max"])
def test_wally_chat_completion_request(reasoning_effort: str):
with respx.mock() as upstream:
route: Final = upstream.post(_CHAT_COMPLETIONS_URL).respond(200, json=_CHAT_COMPLETION)
response: Final = litellm.completion(
model="wally/glm-5.3-flash",
messages=[{"role": "user", "content": "Say hello"}],
max_completion_tokens=64,
reasoning_effort=reasoning_effort,
api_key="wally-test-key",
)
request: Final = route.calls.last.request
body: Final = json.loads(request.content)
assert route.call_count == 1
assert str(request.url) == _CHAT_COMPLETIONS_URL
assert request.headers["authorization"] == "Bearer wally-test-key"
assert body["model"] == "glm-5.3-flash"
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
assert body["max_completion_tokens"] == 64
assert body["reasoning_effort"] == reasoning_effort
assert response.choices[0].message.content == "Hello from Wally"
assert response.choices[0].message.reasoning_content == "Say hi"
def test_wally_responses_request_is_bridged_to_chat_completions():
with respx.mock() as upstream:
route: Final = upstream.post(_CHAT_COMPLETIONS_URL).respond(200, json=_CHAT_COMPLETION)
response: Final = litellm.responses(
model="wally/glm-5.3-flash",
input="Say hello",
api_key="wally-test-key",
)
request: Final = route.calls.last.request
body: Final = json.loads(request.content)
assert route.call_count == 1
assert request.headers["authorization"] == "Bearer wally-test-key"
assert body["model"] == "glm-5.3-flash"
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
message_items: Final = [item for item in response.output if item.type == "message"]
assert message_items[0].content[0].text == "Hello from Wally"
@pytest.mark.asyncio
async def test_wally_anthropic_messages_request_is_bridged_to_chat_completions(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setattr(litellm, "disable_aiohttp_transport", True)
monkeypatch.setattr(litellm, "in_memory_llm_clients_cache", LLMClientCache())
with respx.mock() as upstream:
route: Final = upstream.post(_CHAT_COMPLETIONS_URL).respond(200, json=_CHAT_COMPLETION)
response: Final = await litellm.anthropic.messages.acreate(
model="wally/glm-5.3-flash",
messages=[{"role": "user", "content": "Say hello"}],
max_tokens=32,
api_key="wally-test-key",
)
request: Final = route.calls.last.request
body: Final = json.loads(request.content)
assert route.call_count == 1
assert request.headers["authorization"] == "Bearer wally-test-key"
assert body["model"] == "glm-5.3-flash"
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
assert body["max_tokens"] == 32
assert any(block.get("text") == "Hello from Wally" for block in response["content"])