mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
feat: add apimodels.app as an OpenAI-compatible provider
Registers apimodels as a JSON-configured OpenAI-compatible provider with APIMODELS_API_KEY and APIMODELS_API_BASE, defaulting to https://api.apimodels.app/v1. Adds it to LlmProviders, the openai-compatible provider and endpoint lists, the Admin UI Add Model form, the endpoint support matrix, and cost map rows for apimodels.app chat models. This is the earlier branch replayed onto current main as one commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7e4ad6eb33
commit
dfc68dbe93
9 changed files with 1627 additions and 0 deletions
|
|
@ -1094,6 +1094,7 @@ openai_compatible_endpoints: Final[list[str]] = [
|
|||
"https://api.prisminference.com/v1",
|
||||
"https://api.reka.ai/v1",
|
||||
"https://inference.runanywhere.ai/v1",
|
||||
"https://api.apimodels.app/v1",
|
||||
"https://gigachat.devices.sberbank.ru/api/v1",
|
||||
"https://api.openinfer.ai/v1",
|
||||
"https://vanchin.streamlake.ai/api/gateway/v1/endpoints",
|
||||
|
|
@ -1182,6 +1183,7 @@ openai_compatible_providers: Final[list[str]] = [
|
|||
"reka",
|
||||
"streamlake",
|
||||
"wally",
|
||||
"apimodels",
|
||||
]
|
||||
|
||||
OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS: Final = frozenset({"openai"} | frozenset(openai_compatible_providers))
|
||||
|
|
|
|||
|
|
@ -314,5 +314,10 @@
|
|||
"supports_function_calling": true,
|
||||
"supports_reasoning": true
|
||||
}
|
||||
},
|
||||
"apimodels": {
|
||||
"base_url": "https://api.apimodels.app/v1",
|
||||
"api_key_env": "APIMODELS_API_KEY",
|
||||
"api_base_env": "APIMODELS_API_BASE"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73944,6 +73944,646 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-fable-5-1": {
|
||||
"cache_creation_input_token_cost": 5.778e-06,
|
||||
"cache_read_input_token_cost": 2.2e-07,
|
||||
"input_cost_per_token": 5e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.5e-05,
|
||||
"source": "https://apimodels.app/models/claude-fable-5-1",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-fable-5": {
|
||||
"cache_creation_input_token_cost": 8.824e-06,
|
||||
"cache_read_input_token_cost": 8.82e-07,
|
||||
"input_cost_per_token": 5e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.5e-05,
|
||||
"source": "https://apimodels.app/models/claude-fable-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-5-5": {
|
||||
"cache_creation_input_token_cost": 3e-06,
|
||||
"cache_read_input_token_cost": 1.2e-07,
|
||||
"input_cost_per_token": 2.4e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.2e-05,
|
||||
"source": "https://apimodels.app/models/claude-opus-5-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-5": {
|
||||
"cache_creation_input_token_cost": 4.891e-06,
|
||||
"cache_read_input_token_cost": 3.91e-07,
|
||||
"input_cost_per_token": 3e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.5e-05,
|
||||
"source": "https://apimodels.app/models/claude-opus-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-4-8": {
|
||||
"cache_creation_input_token_cost": 1.765e-06,
|
||||
"cache_read_input_token_cost": 3e-07,
|
||||
"input_cost_per_token": 3e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.3e-05,
|
||||
"source": "https://apimodels.app/models/claude-opus-4-8",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-4-7": {
|
||||
"cache_creation_input_token_cost": 4.595e-06,
|
||||
"cache_read_input_token_cost": 3.676e-07,
|
||||
"input_cost_per_token": 3.676e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.8382e-05,
|
||||
"source": "https://apimodels.app/models/claude-opus-4-7",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-4-6": {
|
||||
"cache_creation_input_token_cost": 2.206e-06,
|
||||
"cache_read_input_token_cost": 1.765e-07,
|
||||
"input_cost_per_token": 1.765e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 8.824e-06,
|
||||
"source": "https://apimodels.app/models/claude-opus-4-6",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-4-5-20251101": {
|
||||
"cache_creation_input_token_cost": 2.206e-06,
|
||||
"cache_read_input_token_cost": 1.765e-07,
|
||||
"input_cost_per_token": 1.765e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 200000,
|
||||
"max_output_tokens": 64000,
|
||||
"max_tokens": 64000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 8.824e-06,
|
||||
"source": "https://apimodels.app/models/claude-opus-4-5-20251101",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-sonnet-5-5": {
|
||||
"cache_creation_input_token_cost": 1.5e-06,
|
||||
"cache_read_input_token_cost": 1.2e-07,
|
||||
"input_cost_per_token": 1.2e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 6e-06,
|
||||
"source": "https://apimodels.app/models/claude-sonnet-5-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-sonnet-5": {
|
||||
"cache_creation_input_token_cost": 1.4e-06,
|
||||
"cache_read_input_token_cost": 1e-07,
|
||||
"input_cost_per_token": 1.6e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 8e-06,
|
||||
"source": "https://apimodels.app/models/claude-sonnet-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-sonnet-4-6": {
|
||||
"cache_creation_input_token_cost": 1.324e-06,
|
||||
"cache_read_input_token_cost": 1.059e-07,
|
||||
"input_cost_per_token": 1.059e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5.295e-06,
|
||||
"source": "https://apimodels.app/models/claude-sonnet-4-6",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-haiku-5-5": {
|
||||
"cache_creation_input_token_cost": 1.125e-07,
|
||||
"cache_creation_input_token_cost_above_100k_tokens": 5.625e-07,
|
||||
"cache_read_input_token_cost": 9e-09,
|
||||
"cache_read_input_token_cost_above_100k_tokens": 4.5e-08,
|
||||
"input_cost_per_token": 9e-08,
|
||||
"input_cost_per_token_above_100k_tokens": 4.5e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.5e-07,
|
||||
"output_cost_per_token_above_100k_tokens": 2.25e-06,
|
||||
"source": "https://apimodels.app/models/claude-haiku-5-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-haiku-4-5-20251001": {
|
||||
"cache_creation_input_token_cost": 4.41e-07,
|
||||
"cache_read_input_token_cost": 3.53e-08,
|
||||
"input_cost_per_token": 3.53e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 200000,
|
||||
"max_output_tokens": 64000,
|
||||
"max_tokens": 64000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.765e-06,
|
||||
"source": "https://apimodels.app/models/claude-haiku-4-5-20251001",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gemini-3.8-flash": {
|
||||
"cache_read_input_token_cost": 1.72e-07,
|
||||
"input_cost_per_token": 4.5e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.25e-06,
|
||||
"source": "https://apimodels.app/models/gemini-3.8-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gemini-3.6-flash": {
|
||||
"cache_read_input_token_cost": 6.62e-08,
|
||||
"input_cost_per_token": 6.62e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.302e-06,
|
||||
"source": "https://apimodels.app/models/gemini-3.6-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gemini-3.5-flash": {
|
||||
"cache_read_input_token_cost": 6.62e-08,
|
||||
"input_cost_per_token": 6.62e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.971e-06,
|
||||
"source": "https://apimodels.app/models/gemini-3.5-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gemini-3.1-flash-lite": {
|
||||
"cache_read_input_token_cost": 2.5e-08,
|
||||
"input_cost_per_token": 3.75e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.25e-06,
|
||||
"source": "https://apimodels.app/models/gemini-3.1-flash-lite",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-6-astra": {
|
||||
"cache_read_input_token_cost": 3.4e-07,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 6.8e-07,
|
||||
"input_cost_per_token": 3.4e-06,
|
||||
"input_cost_per_token_above_272k_tokens": 6.8e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.7e-05,
|
||||
"output_cost_per_token_above_272k_tokens": 2.55e-05,
|
||||
"source": "https://apimodels.app/models/gpt-6-astra",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-6.1-sol": {
|
||||
"cache_read_input_token_cost": 5e-08,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 1e-07,
|
||||
"input_cost_per_token": 1e-06,
|
||||
"input_cost_per_token_above_272k_tokens": 2e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 7.5e-06,
|
||||
"source": "https://apimodels.app/models/gpt-6.1-sol",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-6-sol": {
|
||||
"cache_read_input_token_cost": 1e-07,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 2e-07,
|
||||
"input_cost_per_token": 1e-06,
|
||||
"input_cost_per_token_above_272k_tokens": 2e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 7.5e-06,
|
||||
"source": "https://apimodels.app/models/gpt-6-sol",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-6-luna": {
|
||||
"cache_read_input_token_cost": 9e-09,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 1.8e-08,
|
||||
"input_cost_per_token": 9e-08,
|
||||
"input_cost_per_token_above_272k_tokens": 1.8e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.5e-07,
|
||||
"output_cost_per_token_above_272k_tokens": 6.75e-07,
|
||||
"source": "https://apimodels.app/models/gpt-6-luna",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5.6-sol": {
|
||||
"cache_read_input_token_cost": 1.32e-07,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 2.64e-07,
|
||||
"input_cost_per_token": 1.324e-06,
|
||||
"input_cost_per_token_above_272k_tokens": 2.648e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 6.618e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 9.927e-06,
|
||||
"source": "https://apimodels.app/models/gpt-5-6-sol",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5.6-terra": {
|
||||
"cache_read_input_token_cost": 5.5e-08,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 1.1e-07,
|
||||
"input_cost_per_token": 5.51e-07,
|
||||
"input_cost_per_token_above_272k_tokens": 1.102e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.309e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 4.9635e-06,
|
||||
"source": "https://apimodels.app/models/gpt-5-6-terra",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5.6-luna": {
|
||||
"cache_read_input_token_cost": 1.8e-08,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 3.6e-08,
|
||||
"input_cost_per_token": 1.8e-07,
|
||||
"input_cost_per_token_above_272k_tokens": 3.6e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 9.6e-07,
|
||||
"output_cost_per_token_above_272k_tokens": 1.44e-06,
|
||||
"source": "https://apimodels.app/models/gpt-5-6-luna",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5-5": {
|
||||
"cache_read_input_token_cost": 5e-07,
|
||||
"input_cost_per_token": 3e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1050000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.8e-05,
|
||||
"source": "https://apimodels.app/models/gpt-5-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5-4": {
|
||||
"cache_read_input_token_cost": 2.5e-07,
|
||||
"input_cost_per_token": 1.8e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1050000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.08e-05,
|
||||
"source": "https://apimodels.app/models/gpt-5-4",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/grok-4.6": {
|
||||
"cache_read_input_token_cost": 3.75e-07,
|
||||
"input_cost_per_token": 1.5e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 500000,
|
||||
"max_output_tokens": 500000,
|
||||
"max_tokens": 500000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.5e-06,
|
||||
"source": "https://apimodels.app/models/grok-4.6",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/grok-4.5": {
|
||||
"cache_read_input_token_cost": 3e-07,
|
||||
"input_cost_per_token": 1.275e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 500000,
|
||||
"max_output_tokens": 500000,
|
||||
"max_tokens": 500000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.25e-06,
|
||||
"source": "https://apimodels.app/models/grok-4.5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/glm-5.3": {
|
||||
"cache_read_input_token_cost": 2.47e-07,
|
||||
"input_cost_per_token": 1.33e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.18e-06,
|
||||
"source": "https://apimodels.app/models/glm-5.3",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/glm-5.2": {
|
||||
"cache_read_input_token_cost": 2.6e-07,
|
||||
"input_cost_per_token": 1.26e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.96e-06,
|
||||
"source": "https://apimodels.app/models/glm-5.2",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/deepseek-v4.1-flash": {
|
||||
"cache_read_input_token_cost": 5.4e-09,
|
||||
"input_cost_per_token": 2.7e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"mode": "chat",
|
||||
"off_peak_pricing": {
|
||||
"cache_read_input_token_cost": 2.7e-09,
|
||||
"input_cost_per_token": 1.35e-07,
|
||||
"output_cost_per_token": 5.4e-07,
|
||||
"windows": [
|
||||
{
|
||||
"hours_utc": [
|
||||
"00:00-01:00",
|
||||
"04:00-06:00",
|
||||
"10:00-00:00"
|
||||
],
|
||||
"weekdays": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
{
|
||||
"hours_utc": "00:00-00:00",
|
||||
"weekdays": [
|
||||
6,
|
||||
7
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"output_cost_per_token": 1.08e-06,
|
||||
"source": "https://apimodels.app/models/deepseek-v4.1-flash"
|
||||
},
|
||||
"apimodels/deepseek-v4-flash": {
|
||||
"cache_read_input_token_cost": 5.4e-09,
|
||||
"input_cost_per_token": 2.7e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 393216,
|
||||
"max_tokens": 393216,
|
||||
"mode": "chat",
|
||||
"off_peak_pricing": {
|
||||
"cache_read_input_token_cost": 2.7e-09,
|
||||
"input_cost_per_token": 1.35e-07,
|
||||
"output_cost_per_token": 5.4e-07,
|
||||
"windows": [
|
||||
{
|
||||
"hours_utc": [
|
||||
"00:00-01:00",
|
||||
"04:00-06:00",
|
||||
"10:00-00:00"
|
||||
],
|
||||
"weekdays": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
{
|
||||
"hours_utc": "00:00-00:00",
|
||||
"weekdays": [
|
||||
6,
|
||||
7
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"output_cost_per_token": 1.08e-06,
|
||||
"source": "https://apimodels.app/models/deepseek-v4-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/qwen3.8-max": {
|
||||
"cache_read_input_token_cost": 2.5e-07,
|
||||
"input_cost_per_token": 2e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 991808,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 6e-06,
|
||||
"source": "https://apimodels.app/models/qwen3.8-max",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/qwen3.8-flash": {
|
||||
"cache_read_input_token_cost": 1.6e-08,
|
||||
"input_cost_per_token": 1.5e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 991808,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.7e-07,
|
||||
"source": "https://apimodels.app/models/qwen3.8-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/qwen3.7-max": {
|
||||
"cache_read_input_token_cost": 4.5e-07,
|
||||
"input_cost_per_token": 2.25e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 991808,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 6.75e-06,
|
||||
"source": "https://apimodels.app/models/qwen3.7-max",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/qwen3.7-plus": {
|
||||
"cache_read_input_token_cost": 7.2e-08,
|
||||
"input_cost_per_token": 3.6e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 991808,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.44e-06,
|
||||
"source": "https://apimodels.app/models/qwen3.7-plus",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"tiered_pricing": [
|
||||
{
|
||||
"cache_read_input_token_cost": 7.2e-08,
|
||||
"input_cost_per_token": 3.6e-07,
|
||||
"output_cost_per_token": 1.44e-06,
|
||||
"range": [
|
||||
0,
|
||||
262144
|
||||
]
|
||||
},
|
||||
{
|
||||
"cache_read_input_token_cost": 2.16e-07,
|
||||
"input_cost_per_token": 1.08e-06,
|
||||
"output_cost_per_token": 4.32e-06,
|
||||
"range": [
|
||||
262144,
|
||||
1000000
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"bespoke/nimble-latest": {
|
||||
"input_cost_per_token": 0.0,
|
||||
"litellm_provider": "bespoke",
|
||||
|
|
|
|||
|
|
@ -347,6 +347,24 @@
|
|||
"generateContent": true
|
||||
}
|
||||
},
|
||||
"apimodels": {
|
||||
"display_name": "apimodels.app (`apimodels`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/apimodels",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
"messages": true,
|
||||
"responses": true,
|
||||
"embeddings": false,
|
||||
"image_generations": false,
|
||||
"audio_transcriptions": false,
|
||||
"audio_speech": false,
|
||||
"moderations": false,
|
||||
"batches": false,
|
||||
"rerank": false,
|
||||
"a2a": false,
|
||||
"interactions": false
|
||||
}
|
||||
},
|
||||
"assemblyai": {
|
||||
"display_name": "AssemblyAI (`assemblyai`)",
|
||||
"url": "https://docs.litellm.ai/docs/pass_through/assembly_ai",
|
||||
|
|
|
|||
|
|
@ -3743,6 +3743,34 @@
|
|||
],
|
||||
"default_model_placeholder": "inferenceapis/deepseek-ai/DeepSeek-V4-Flash"
|
||||
},
|
||||
{
|
||||
"provider": "APIMODELS",
|
||||
"provider_display_name": "apimodels.app",
|
||||
"litellm_provider": "apimodels",
|
||||
"credential_fields": [
|
||||
{
|
||||
"key": "api_base",
|
||||
"label": "API Base",
|
||||
"placeholder": "https://api.apimodels.app/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": "apimodels/claude-opus-5-5"
|
||||
},
|
||||
{
|
||||
"provider": "StreamLake",
|
||||
"provider_display_name": "StreamLake",
|
||||
|
|
|
|||
|
|
@ -4781,6 +4781,7 @@ class LlmProviders(str, Enum):
|
|||
REKA = "reka"
|
||||
STREAMLAKE = "streamlake"
|
||||
WALLY = "wally"
|
||||
APIMODELS = "apimodels"
|
||||
LITELLM_AGENT = "litellm_agent"
|
||||
CURSOR = "cursor"
|
||||
BEDROCK_MANTLE = "bedrock_mantle"
|
||||
|
|
|
|||
|
|
@ -73944,6 +73944,646 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-fable-5-1": {
|
||||
"cache_creation_input_token_cost": 5.778e-06,
|
||||
"cache_read_input_token_cost": 2.2e-07,
|
||||
"input_cost_per_token": 5e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.5e-05,
|
||||
"source": "https://apimodels.app/models/claude-fable-5-1",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-fable-5": {
|
||||
"cache_creation_input_token_cost": 8.824e-06,
|
||||
"cache_read_input_token_cost": 8.82e-07,
|
||||
"input_cost_per_token": 5e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.5e-05,
|
||||
"source": "https://apimodels.app/models/claude-fable-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-5-5": {
|
||||
"cache_creation_input_token_cost": 3e-06,
|
||||
"cache_read_input_token_cost": 1.2e-07,
|
||||
"input_cost_per_token": 2.4e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.2e-05,
|
||||
"source": "https://apimodels.app/models/claude-opus-5-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-5": {
|
||||
"cache_creation_input_token_cost": 4.891e-06,
|
||||
"cache_read_input_token_cost": 3.91e-07,
|
||||
"input_cost_per_token": 3e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.5e-05,
|
||||
"source": "https://apimodels.app/models/claude-opus-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-4-8": {
|
||||
"cache_creation_input_token_cost": 1.765e-06,
|
||||
"cache_read_input_token_cost": 3e-07,
|
||||
"input_cost_per_token": 3e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.3e-05,
|
||||
"source": "https://apimodels.app/models/claude-opus-4-8",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-4-7": {
|
||||
"cache_creation_input_token_cost": 4.595e-06,
|
||||
"cache_read_input_token_cost": 3.676e-07,
|
||||
"input_cost_per_token": 3.676e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.8382e-05,
|
||||
"source": "https://apimodels.app/models/claude-opus-4-7",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-4-6": {
|
||||
"cache_creation_input_token_cost": 2.206e-06,
|
||||
"cache_read_input_token_cost": 1.765e-07,
|
||||
"input_cost_per_token": 1.765e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 8.824e-06,
|
||||
"source": "https://apimodels.app/models/claude-opus-4-6",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-opus-4-5-20251101": {
|
||||
"cache_creation_input_token_cost": 2.206e-06,
|
||||
"cache_read_input_token_cost": 1.765e-07,
|
||||
"input_cost_per_token": 1.765e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 200000,
|
||||
"max_output_tokens": 64000,
|
||||
"max_tokens": 64000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 8.824e-06,
|
||||
"source": "https://apimodels.app/models/claude-opus-4-5-20251101",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-sonnet-5-5": {
|
||||
"cache_creation_input_token_cost": 1.5e-06,
|
||||
"cache_read_input_token_cost": 1.2e-07,
|
||||
"input_cost_per_token": 1.2e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 6e-06,
|
||||
"source": "https://apimodels.app/models/claude-sonnet-5-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-sonnet-5": {
|
||||
"cache_creation_input_token_cost": 1.4e-06,
|
||||
"cache_read_input_token_cost": 1e-07,
|
||||
"input_cost_per_token": 1.6e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 8e-06,
|
||||
"source": "https://apimodels.app/models/claude-sonnet-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-sonnet-4-6": {
|
||||
"cache_creation_input_token_cost": 1.324e-06,
|
||||
"cache_read_input_token_cost": 1.059e-07,
|
||||
"input_cost_per_token": 1.059e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5.295e-06,
|
||||
"source": "https://apimodels.app/models/claude-sonnet-4-6",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-haiku-5-5": {
|
||||
"cache_creation_input_token_cost": 1.125e-07,
|
||||
"cache_creation_input_token_cost_above_100k_tokens": 5.625e-07,
|
||||
"cache_read_input_token_cost": 9e-09,
|
||||
"cache_read_input_token_cost_above_100k_tokens": 4.5e-08,
|
||||
"input_cost_per_token": 9e-08,
|
||||
"input_cost_per_token_above_100k_tokens": 4.5e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.5e-07,
|
||||
"output_cost_per_token_above_100k_tokens": 2.25e-06,
|
||||
"source": "https://apimodels.app/models/claude-haiku-5-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/claude-haiku-4-5-20251001": {
|
||||
"cache_creation_input_token_cost": 4.41e-07,
|
||||
"cache_read_input_token_cost": 3.53e-08,
|
||||
"input_cost_per_token": 3.53e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 200000,
|
||||
"max_output_tokens": 64000,
|
||||
"max_tokens": 64000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.765e-06,
|
||||
"source": "https://apimodels.app/models/claude-haiku-4-5-20251001",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gemini-3.8-flash": {
|
||||
"cache_read_input_token_cost": 1.72e-07,
|
||||
"input_cost_per_token": 4.5e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.25e-06,
|
||||
"source": "https://apimodels.app/models/gemini-3.8-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gemini-3.6-flash": {
|
||||
"cache_read_input_token_cost": 6.62e-08,
|
||||
"input_cost_per_token": 6.62e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.302e-06,
|
||||
"source": "https://apimodels.app/models/gemini-3.6-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gemini-3.5-flash": {
|
||||
"cache_read_input_token_cost": 6.62e-08,
|
||||
"input_cost_per_token": 6.62e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.971e-06,
|
||||
"source": "https://apimodels.app/models/gemini-3.5-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gemini-3.1-flash-lite": {
|
||||
"cache_read_input_token_cost": 2.5e-08,
|
||||
"input_cost_per_token": 3.75e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.25e-06,
|
||||
"source": "https://apimodels.app/models/gemini-3.1-flash-lite",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-6-astra": {
|
||||
"cache_read_input_token_cost": 3.4e-07,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 6.8e-07,
|
||||
"input_cost_per_token": 3.4e-06,
|
||||
"input_cost_per_token_above_272k_tokens": 6.8e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.7e-05,
|
||||
"output_cost_per_token_above_272k_tokens": 2.55e-05,
|
||||
"source": "https://apimodels.app/models/gpt-6-astra",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-6.1-sol": {
|
||||
"cache_read_input_token_cost": 5e-08,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 1e-07,
|
||||
"input_cost_per_token": 1e-06,
|
||||
"input_cost_per_token_above_272k_tokens": 2e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 7.5e-06,
|
||||
"source": "https://apimodels.app/models/gpt-6.1-sol",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-6-sol": {
|
||||
"cache_read_input_token_cost": 1e-07,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 2e-07,
|
||||
"input_cost_per_token": 1e-06,
|
||||
"input_cost_per_token_above_272k_tokens": 2e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 7.5e-06,
|
||||
"source": "https://apimodels.app/models/gpt-6-sol",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-6-luna": {
|
||||
"cache_read_input_token_cost": 9e-09,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 1.8e-08,
|
||||
"input_cost_per_token": 9e-08,
|
||||
"input_cost_per_token_above_272k_tokens": 1.8e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.5e-07,
|
||||
"output_cost_per_token_above_272k_tokens": 6.75e-07,
|
||||
"source": "https://apimodels.app/models/gpt-6-luna",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5.6-sol": {
|
||||
"cache_read_input_token_cost": 1.32e-07,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 2.64e-07,
|
||||
"input_cost_per_token": 1.324e-06,
|
||||
"input_cost_per_token_above_272k_tokens": 2.648e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 6.618e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 9.927e-06,
|
||||
"source": "https://apimodels.app/models/gpt-5-6-sol",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5.6-terra": {
|
||||
"cache_read_input_token_cost": 5.5e-08,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 1.1e-07,
|
||||
"input_cost_per_token": 5.51e-07,
|
||||
"input_cost_per_token_above_272k_tokens": 1.102e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.309e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 4.9635e-06,
|
||||
"source": "https://apimodels.app/models/gpt-5-6-terra",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5.6-luna": {
|
||||
"cache_read_input_token_cost": 1.8e-08,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 3.6e-08,
|
||||
"input_cost_per_token": 1.8e-07,
|
||||
"input_cost_per_token_above_272k_tokens": 3.6e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 9.6e-07,
|
||||
"output_cost_per_token_above_272k_tokens": 1.44e-06,
|
||||
"source": "https://apimodels.app/models/gpt-5-6-luna",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5-5": {
|
||||
"cache_read_input_token_cost": 5e-07,
|
||||
"input_cost_per_token": 3e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1050000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.8e-05,
|
||||
"source": "https://apimodels.app/models/gpt-5-5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/gpt-5-4": {
|
||||
"cache_read_input_token_cost": 2.5e-07,
|
||||
"input_cost_per_token": 1.8e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1050000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.08e-05,
|
||||
"source": "https://apimodels.app/models/gpt-5-4",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/grok-4.6": {
|
||||
"cache_read_input_token_cost": 3.75e-07,
|
||||
"input_cost_per_token": 1.5e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 500000,
|
||||
"max_output_tokens": 500000,
|
||||
"max_tokens": 500000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.5e-06,
|
||||
"source": "https://apimodels.app/models/grok-4.6",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/grok-4.5": {
|
||||
"cache_read_input_token_cost": 3e-07,
|
||||
"input_cost_per_token": 1.275e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 500000,
|
||||
"max_output_tokens": 500000,
|
||||
"max_tokens": 500000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.25e-06,
|
||||
"source": "https://apimodels.app/models/grok-4.5",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"apimodels/glm-5.3": {
|
||||
"cache_read_input_token_cost": 2.47e-07,
|
||||
"input_cost_per_token": 1.33e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.18e-06,
|
||||
"source": "https://apimodels.app/models/glm-5.3",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/glm-5.2": {
|
||||
"cache_read_input_token_cost": 2.6e-07,
|
||||
"input_cost_per_token": 1.26e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"max_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 3.96e-06,
|
||||
"source": "https://apimodels.app/models/glm-5.2",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/deepseek-v4.1-flash": {
|
||||
"cache_read_input_token_cost": 5.4e-09,
|
||||
"input_cost_per_token": 2.7e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"mode": "chat",
|
||||
"off_peak_pricing": {
|
||||
"cache_read_input_token_cost": 2.7e-09,
|
||||
"input_cost_per_token": 1.35e-07,
|
||||
"output_cost_per_token": 5.4e-07,
|
||||
"windows": [
|
||||
{
|
||||
"hours_utc": [
|
||||
"00:00-01:00",
|
||||
"04:00-06:00",
|
||||
"10:00-00:00"
|
||||
],
|
||||
"weekdays": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
{
|
||||
"hours_utc": "00:00-00:00",
|
||||
"weekdays": [
|
||||
6,
|
||||
7
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"output_cost_per_token": 1.08e-06,
|
||||
"source": "https://apimodels.app/models/deepseek-v4.1-flash"
|
||||
},
|
||||
"apimodels/deepseek-v4-flash": {
|
||||
"cache_read_input_token_cost": 5.4e-09,
|
||||
"input_cost_per_token": 2.7e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 393216,
|
||||
"max_tokens": 393216,
|
||||
"mode": "chat",
|
||||
"off_peak_pricing": {
|
||||
"cache_read_input_token_cost": 2.7e-09,
|
||||
"input_cost_per_token": 1.35e-07,
|
||||
"output_cost_per_token": 5.4e-07,
|
||||
"windows": [
|
||||
{
|
||||
"hours_utc": [
|
||||
"00:00-01:00",
|
||||
"04:00-06:00",
|
||||
"10:00-00:00"
|
||||
],
|
||||
"weekdays": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
{
|
||||
"hours_utc": "00:00-00:00",
|
||||
"weekdays": [
|
||||
6,
|
||||
7
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"output_cost_per_token": 1.08e-06,
|
||||
"source": "https://apimodels.app/models/deepseek-v4-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/qwen3.8-max": {
|
||||
"cache_read_input_token_cost": 2.5e-07,
|
||||
"input_cost_per_token": 2e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 991808,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 6e-06,
|
||||
"source": "https://apimodels.app/models/qwen3.8-max",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/qwen3.8-flash": {
|
||||
"cache_read_input_token_cost": 1.6e-08,
|
||||
"input_cost_per_token": 1.5e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 991808,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 4.7e-07,
|
||||
"source": "https://apimodels.app/models/qwen3.8-flash",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/qwen3.7-max": {
|
||||
"cache_read_input_token_cost": 4.5e-07,
|
||||
"input_cost_per_token": 2.25e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 991808,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 6.75e-06,
|
||||
"source": "https://apimodels.app/models/qwen3.7-max",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true
|
||||
},
|
||||
"apimodels/qwen3.7-plus": {
|
||||
"cache_read_input_token_cost": 7.2e-08,
|
||||
"input_cost_per_token": 3.6e-07,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 991808,
|
||||
"max_output_tokens": 65536,
|
||||
"max_tokens": 65536,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 1.44e-06,
|
||||
"source": "https://apimodels.app/models/qwen3.7-plus",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"tiered_pricing": [
|
||||
{
|
||||
"cache_read_input_token_cost": 7.2e-08,
|
||||
"input_cost_per_token": 3.6e-07,
|
||||
"output_cost_per_token": 1.44e-06,
|
||||
"range": [
|
||||
0,
|
||||
262144
|
||||
]
|
||||
},
|
||||
{
|
||||
"cache_read_input_token_cost": 2.16e-07,
|
||||
"input_cost_per_token": 1.08e-06,
|
||||
"output_cost_per_token": 4.32e-06,
|
||||
"range": [
|
||||
262144,
|
||||
1000000
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"bespoke/nimble-latest": {
|
||||
"input_cost_per_token": 0.0,
|
||||
"litellm_provider": "bespoke",
|
||||
|
|
|
|||
|
|
@ -321,6 +321,24 @@
|
|||
"generateContent": false
|
||||
}
|
||||
},
|
||||
"apimodels": {
|
||||
"display_name": "apimodels.app (`apimodels`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/apimodels",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
"messages": true,
|
||||
"responses": true,
|
||||
"embeddings": false,
|
||||
"image_generations": false,
|
||||
"audio_transcriptions": false,
|
||||
"audio_speech": false,
|
||||
"moderations": false,
|
||||
"batches": false,
|
||||
"rerank": false,
|
||||
"a2a": false,
|
||||
"interactions": false
|
||||
}
|
||||
},
|
||||
"aihubmix": {
|
||||
"display_name": "AIHubMix (`aihubmix`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/aihubmix",
|
||||
|
|
|
|||
275
tests/unit/llms/openai_like/test_apimodels_provider.py
Normal file
275
tests/unit/llms/openai_like/test_apimodels_provider.py
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
from typing import Final
|
||||
|
||||
import pytest
|
||||
import respx
|
||||
|
||||
import litellm
|
||||
from litellm.caching.llm_caching_handler import LLMClientCache
|
||||
|
||||
|
||||
def _chat_completion(model: str) -> dict:
|
||||
return {
|
||||
"id": "chatcmpl_apimodels",
|
||||
"object": "chat.completion",
|
||||
"created": 1_790_000_000,
|
||||
"model": model,
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
"message": {"role": "assistant", "content": "Hello from APIMODELS"},
|
||||
"finish_reason": "stop",
|
||||
}
|
||||
],
|
||||
"usage": {"prompt_tokens": 4, "completion_tokens": 3, "total_tokens": 7},
|
||||
}
|
||||
|
||||
|
||||
def test_apimodels_is_a_registered_provider():
|
||||
assert litellm.LlmProviders.APIMODELS.value == "apimodels"
|
||||
assert "apimodels" in litellm.provider_list
|
||||
assert "apimodels" in litellm.constants.openai_compatible_providers
|
||||
|
||||
|
||||
def test_apimodels_provider_resolution(monkeypatch: pytest.MonkeyPatch):
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
monkeypatch.setenv("APIMODELS_API_KEY", "apimodels-test-key")
|
||||
monkeypatch.delenv("APIMODELS_API_BASE", raising=False)
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
model="apimodels/gpt-5.6-luna",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert model == "gpt-5.6-luna"
|
||||
assert provider == "apimodels"
|
||||
assert api_key == "apimodels-test-key"
|
||||
assert api_base == "https://api.apimodels.app/v1"
|
||||
|
||||
|
||||
def test_apimodels_provider_keeps_explicit_credentials(monkeypatch: pytest.MonkeyPatch):
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
monkeypatch.setenv("APIMODELS_API_KEY", "apimodels-env-key")
|
||||
monkeypatch.setenv("APIMODELS_API_BASE", "https://apimodels.env.example/v1")
|
||||
|
||||
_, provider, api_key, api_base = get_llm_provider(
|
||||
model="apimodels/gpt-5.6-luna",
|
||||
custom_llm_provider=None,
|
||||
api_base="https://apimodels.internal.example/v1",
|
||||
api_key="apimodels-explicit-key",
|
||||
)
|
||||
|
||||
assert provider == "apimodels"
|
||||
assert api_key == "apimodels-explicit-key"
|
||||
assert api_base == "https://apimodels.internal.example/v1"
|
||||
|
||||
|
||||
def test_apimodels_api_base_env_overrides_default(monkeypatch: pytest.MonkeyPatch):
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
monkeypatch.setenv("APIMODELS_API_KEY", "apimodels-env-key")
|
||||
monkeypatch.setenv("APIMODELS_API_BASE", "https://apimodels.env.example/v1")
|
||||
|
||||
_, provider, _, api_base = get_llm_provider(
|
||||
model="apimodels/gpt-5.6-luna",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert provider == "apimodels"
|
||||
assert api_base == "https://apimodels.env.example/v1"
|
||||
|
||||
|
||||
def test_apimodels_api_base_autodetects_provider(monkeypatch: pytest.MonkeyPatch):
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
monkeypatch.setenv("APIMODELS_API_KEY", "apimodels-env-key")
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
model="gpt-5.6-luna",
|
||||
custom_llm_provider=None,
|
||||
api_base="https://api.apimodels.app/v1",
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert model == "gpt-5.6-luna"
|
||||
assert provider == "apimodels"
|
||||
assert api_key == "apimodels-env-key"
|
||||
assert api_base == "https://api.apimodels.app/v1"
|
||||
|
||||
|
||||
def test_apimodels_is_available_in_add_model_form():
|
||||
fields_path = Path(litellm.__file__).parent / "proxy" / "public_endpoints" / "provider_create_fields.json"
|
||||
providers = json.loads(fields_path.read_text())
|
||||
apimodels = next(provider for provider in providers if provider["litellm_provider"] == "apimodels")
|
||||
|
||||
assert apimodels["provider"] == "APIMODELS"
|
||||
assert apimodels["provider_display_name"] == "apimodels.app"
|
||||
assert apimodels["default_model_placeholder"] == "apimodels/claude-opus-5-5"
|
||||
assert {field["key"]: field["required"] for field in apimodels["credential_fields"]} == {
|
||||
"api_base": False,
|
||||
"api_key": True,
|
||||
}
|
||||
|
||||
|
||||
def test_apimodels_supported_endpoints():
|
||||
expected: 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,
|
||||
"a2a": False,
|
||||
"interactions": False,
|
||||
}
|
||||
backup_path = Path(litellm.__file__).parent / "provider_endpoints_support_backup.json"
|
||||
root_path = Path(litellm.__file__).parent.parent / "provider_endpoints_support.json"
|
||||
|
||||
assert json.loads(backup_path.read_text())["providers"]["apimodels"]["endpoints"] == expected
|
||||
assert json.loads(root_path.read_text())["providers"]["apimodels"]["endpoints"] == expected
|
||||
|
||||
|
||||
def test_apimodels_chat_completion_request_uses_env_api_key(monkeypatch: pytest.MonkeyPatch):
|
||||
monkeypatch.setenv("APIMODELS_API_KEY", "apimodels-env-key")
|
||||
monkeypatch.delenv("APIMODELS_API_BASE", raising=False)
|
||||
with respx.mock() as upstream:
|
||||
route: Final = upstream.post("https://api.apimodels.app/v1/chat/completions").respond(
|
||||
200, json=_chat_completion("gpt-5.6-luna")
|
||||
)
|
||||
response: Final = litellm.completion(
|
||||
model="apimodels/gpt-5.6-luna",
|
||||
messages=[{"role": "user", "content": "Say hello"}],
|
||||
)
|
||||
|
||||
request: Final = route.calls.last.request
|
||||
body: Final = json.loads(request.content)
|
||||
assert route.call_count == 1
|
||||
assert str(request.url) == "https://api.apimodels.app/v1/chat/completions"
|
||||
assert request.headers["authorization"] == "Bearer apimodels-env-key"
|
||||
assert body["model"] == "gpt-5.6-luna"
|
||||
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
|
||||
assert response.choices[0].message.content == "Hello from APIMODELS"
|
||||
|
||||
|
||||
def test_apimodels_chat_completion_request_honours_api_base_override():
|
||||
with respx.mock() as upstream:
|
||||
route: Final = upstream.post("https://apimodels.internal.example/v1/chat/completions").respond(
|
||||
200, json=_chat_completion("gpt-5.6-luna")
|
||||
)
|
||||
response: Final = litellm.completion(
|
||||
model="apimodels/gpt-5.6-luna",
|
||||
messages=[{"role": "user", "content": "Say hello"}],
|
||||
api_base="https://apimodels.internal.example/v1",
|
||||
api_key="apimodels-explicit-key",
|
||||
)
|
||||
|
||||
request: Final = route.calls.last.request
|
||||
assert route.call_count == 1
|
||||
assert str(request.url) == "https://apimodels.internal.example/v1/chat/completions"
|
||||
assert request.headers["authorization"] == "Bearer apimodels-explicit-key"
|
||||
assert response.choices[0].message.content == "Hello from APIMODELS"
|
||||
|
||||
|
||||
def test_apimodels_responses_request_is_bridged_to_chat_completions():
|
||||
with respx.mock() as upstream:
|
||||
route: Final = upstream.post("https://api.apimodels.app/v1/chat/completions").respond(
|
||||
200, json=_chat_completion("claude-opus-5-5")
|
||||
)
|
||||
response: Final = litellm.responses(
|
||||
model="apimodels/claude-opus-5-5",
|
||||
input="Say hello",
|
||||
api_key="apimodels-test-key",
|
||||
)
|
||||
|
||||
request: Final = route.calls.last.request
|
||||
body: Final = json.loads(request.content)
|
||||
assert route.call_count == 1
|
||||
assert request.headers["authorization"] == "Bearer apimodels-test-key"
|
||||
assert body["model"] == "claude-opus-5-5"
|
||||
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
|
||||
assert response.output[0].content[0].text == "Hello from APIMODELS"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_apimodels_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("https://api.apimodels.app/v1/chat/completions").respond(
|
||||
200, json=_chat_completion("gpt-5.6-luna")
|
||||
)
|
||||
response: Final = await litellm.anthropic.messages.acreate(
|
||||
model="apimodels/gpt-5.6-luna",
|
||||
messages=[{"role": "user", "content": "Say hello"}],
|
||||
max_tokens=32,
|
||||
api_key="apimodels-test-key",
|
||||
)
|
||||
|
||||
request: Final = route.calls.last.request
|
||||
body: Final = json.loads(request.content)
|
||||
assert route.call_count == 1
|
||||
assert request.headers["authorization"] == "Bearer apimodels-test-key"
|
||||
assert body["model"] == "gpt-5.6-luna"
|
||||
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
|
||||
assert body["max_tokens"] == 32
|
||||
assert response["content"][0]["text"] == "Hello from APIMODELS"
|
||||
|
||||
|
||||
def _completion_with_usage(model: str, usage: dict[str, object]) -> litellm.ModelResponse:
|
||||
body: Final = {**_chat_completion(model), "usage": usage}
|
||||
with respx.mock() as upstream:
|
||||
upstream.post("https://api.apimodels.app/v1/chat/completions").respond(200, json=body)
|
||||
return litellm.completion(
|
||||
model=f"apimodels/{model}",
|
||||
messages=[{"role": "user", "content": "Say hello"}],
|
||||
api_key="apimodels-test-key",
|
||||
)
|
||||
|
||||
|
||||
def test_apimodels_chat_completion_cost_bills_cached_tokens_at_cache_read_rate():
|
||||
row: Final = litellm.model_cost["apimodels/gpt-6-sol"]
|
||||
response: Final = _completion_with_usage(
|
||||
"gpt-6-sol",
|
||||
{
|
||||
"prompt_tokens": 1000,
|
||||
"completion_tokens": 20,
|
||||
"total_tokens": 1020,
|
||||
"prompt_tokens_details": {"cached_tokens": 800},
|
||||
},
|
||||
)
|
||||
|
||||
assert row["cache_read_input_token_cost"] < row["input_cost_per_token"]
|
||||
assert litellm.completion_cost(completion_response=response, model="apimodels/gpt-6-sol") == pytest.approx(
|
||||
200 * row["input_cost_per_token"] + 800 * row["cache_read_input_token_cost"] + 20 * row["output_cost_per_token"]
|
||||
)
|
||||
|
||||
|
||||
def test_apimodels_prompt_over_272k_bills_the_whole_request_at_the_long_context_rates():
|
||||
row: Final = litellm.model_cost["apimodels/gpt-6-sol"]
|
||||
response: Final = _completion_with_usage(
|
||||
"gpt-6-sol",
|
||||
{
|
||||
"prompt_tokens": 300_000,
|
||||
"completion_tokens": 20,
|
||||
"total_tokens": 300_020,
|
||||
"prompt_tokens_details": {"cached_tokens": 100_000},
|
||||
},
|
||||
)
|
||||
|
||||
assert row["input_cost_per_token_above_272k_tokens"] > row["input_cost_per_token"]
|
||||
assert litellm.completion_cost(completion_response=response, model="apimodels/gpt-6-sol") == pytest.approx(
|
||||
200_000 * row["input_cost_per_token_above_272k_tokens"]
|
||||
+ 100_000 * row["cache_read_input_token_cost_above_272k_tokens"]
|
||||
+ 20 * row["output_cost_per_token_above_272k_tokens"]
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue