mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
Merge 13d6d2accb into e9b1c11098
This commit is contained in:
commit
c67f2a0de3
10 changed files with 1726 additions and 0 deletions
|
|
@ -689,6 +689,7 @@ openinfer_models: Final[Set[str]] = set()
|
|||
kyma_models: Final[set[str]] = set() # mutable-ok: populated when the shared model catalog loads
|
||||
streamlake_models: Final[Set[str]] = set()
|
||||
wally_models: Final[Set[str]] = set()
|
||||
apimodels_models: Final[Set[str]] = set()
|
||||
zerogpu_models: Final[Set[str]] = set()
|
||||
v0_models: Set = set()
|
||||
morph_models: Set = set()
|
||||
|
|
@ -987,6 +988,8 @@ def _populate_provider_model_sets(model_cost_map: Mapping[str, Mapping[str, obje
|
|||
streamlake_models.add(key)
|
||||
elif value.get("litellm_provider") == "wally":
|
||||
wally_models.add(key)
|
||||
elif value.get("litellm_provider") == "apimodels":
|
||||
apimodels_models.add(key)
|
||||
elif value.get("litellm_provider") == "zerogpu":
|
||||
zerogpu_models.add(key)
|
||||
elif value.get("litellm_provider") == "v0":
|
||||
|
|
@ -1169,6 +1172,7 @@ model_list = list(
|
|||
| kyma_models
|
||||
| streamlake_models
|
||||
| wally_models
|
||||
| apimodels_models
|
||||
| zerogpu_models
|
||||
| v0_models
|
||||
| morph_models
|
||||
|
|
@ -1303,6 +1307,7 @@ def _build_models_by_provider() -> dict:
|
|||
"kyma": kyma_models,
|
||||
"streamlake": streamlake_models,
|
||||
"wally": wally_models,
|
||||
"apimodels": apimodels_models,
|
||||
"zerogpu": zerogpu_models,
|
||||
"v0": v0_models,
|
||||
"morph": morph_models,
|
||||
|
|
|
|||
|
|
@ -1095,6 +1095,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",
|
||||
|
|
@ -1183,6 +1184,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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74112,6 +74112,643 @@
|
|||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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-sonnet-4-5-20250929": {
|
||||
"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": 200000,
|
||||
"max_output_tokens": 64000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5.295e-06,
|
||||
"source": "https://apimodels.app/models/claude-sonnet-4-5-20250929",
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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.1-terra": {
|
||||
"cache_read_input_token_cost": 2.5e-08,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 5e-08,
|
||||
"input_cost_per_token": 5e-07,
|
||||
"input_cost_per_token_above_272k_tokens": 1e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.5e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 3.75e-06,
|
||||
"source": "https://apimodels.app/models/gpt-6.1-terra",
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,32 @@
|
|||
"generateContent": false
|
||||
}
|
||||
},
|
||||
"apimodels": {
|
||||
"display_name": "apimodels.app (`apimodels`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/apimodels",
|
||||
"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
|
||||
}
|
||||
},
|
||||
"aihubmix": {
|
||||
"display_name": "AIHubMix (`aihubmix`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/aihubmix",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -4800,6 +4800,7 @@ class LlmProviders(str, Enum):
|
|||
REKA = "reka"
|
||||
STREAMLAKE = "streamlake"
|
||||
WALLY = "wally"
|
||||
APIMODELS = "apimodels"
|
||||
LITELLM_AGENT = "litellm_agent"
|
||||
CURSOR = "cursor"
|
||||
BEDROCK_MANTLE = "bedrock_mantle"
|
||||
|
|
|
|||
|
|
@ -74112,6 +74112,643 @@
|
|||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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-sonnet-4-5-20250929": {
|
||||
"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": 200000,
|
||||
"max_output_tokens": 64000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5.295e-06,
|
||||
"source": "https://apimodels.app/models/claude-sonnet-4-5-20250929",
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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.1-terra": {
|
||||
"cache_read_input_token_cost": 2.5e-08,
|
||||
"cache_read_input_token_cost_above_272k_tokens": 5e-08,
|
||||
"input_cost_per_token": 5e-07,
|
||||
"input_cost_per_token_above_272k_tokens": 1e-06,
|
||||
"litellm_provider": "apimodels",
|
||||
"max_input_tokens": 922000,
|
||||
"max_output_tokens": 128000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.5e-06,
|
||||
"output_cost_per_token_above_272k_tokens": 3.75e-06,
|
||||
"source": "https://apimodels.app/models/gpt-6.1-terra",
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,
|
||||
"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,32 @@
|
|||
"generateContent": false
|
||||
}
|
||||
},
|
||||
"apimodels": {
|
||||
"display_name": "apimodels.app (`apimodels`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/apimodels",
|
||||
"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
|
||||
}
|
||||
},
|
||||
"aihubmix": {
|
||||
"display_name": "AIHubMix (`aihubmix`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/aihubmix",
|
||||
|
|
|
|||
359
tests/unit/llms/openai_like/test_apimodels_provider.py
Normal file
359
tests/unit/llms/openai_like/test_apimodels_provider.py
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
import json
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Final
|
||||
|
||||
import pytest
|
||||
import respx
|
||||
|
||||
import litellm
|
||||
from litellm._internal_context import pinned_billing_time
|
||||
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://api.apimodels.app/v1"
|
||||
_CHAT_COMPLETIONS_URL: Final = f"{_DEFAULT_API_BASE}/chat/completions"
|
||||
_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,
|
||||
}
|
||||
# A Tuesday inside the DeepSeek weekday peak hours, and two moments outside them.
|
||||
_WEEKDAY_PEAK: Final = datetime(2026, 11, 3, 2, 0, tzinfo=timezone.utc)
|
||||
_WEEKDAY_OFF_PEAK: Final = datetime(2026, 11, 3, 12, 0, tzinfo=timezone.utc)
|
||||
_WEEKEND: Final = datetime(2026, 11, 7, 2, 0, tzinfo=timezone.utc)
|
||||
APIMODELS_MODELS: Final = tuple(sorted(name for name in litellm.model_cost if name.startswith("apimodels/")))
|
||||
OFF_PEAK_MODELS: Final = tuple(name for name in APIMODELS_MODELS if "off_peak_pricing" in litellm.model_cost[name])
|
||||
|
||||
|
||||
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
|
||||
assert _DEFAULT_API_BASE in litellm.constants.openai_compatible_endpoints
|
||||
|
||||
|
||||
def test_apimodels_provider_resolution(monkeypatch: pytest.MonkeyPatch):
|
||||
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 == _DEFAULT_API_BASE
|
||||
|
||||
|
||||
def test_apimodels_provider_keeps_explicit_credentials(monkeypatch: pytest.MonkeyPatch):
|
||||
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):
|
||||
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):
|
||||
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=_DEFAULT_API_BASE,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert model == "gpt-5.6-luna"
|
||||
assert provider == "apimodels"
|
||||
assert api_key == "apimodels-env-key"
|
||||
assert api_base == _DEFAULT_API_BASE
|
||||
|
||||
|
||||
@pytest.mark.parametrize("model", APIMODELS_MODELS)
|
||||
def test_apimodels_model_cost_and_capabilities(model: str):
|
||||
from litellm.cost_calculator import cost_per_token
|
||||
from litellm.utils import supports_function_calling, supports_prompt_caching, supports_reasoning, supports_vision
|
||||
|
||||
entry: Final = litellm.model_cost[model]
|
||||
with pinned_billing_time(_WEEKDAY_PEAK):
|
||||
prompt_cost, completion_cost = cost_per_token(
|
||||
model=model,
|
||||
prompt_tokens=1_000,
|
||||
completion_tokens=1_000,
|
||||
custom_llm_provider="apimodels",
|
||||
)
|
||||
cached_prompt_cost, _ = cost_per_token(
|
||||
model=model,
|
||||
prompt_tokens=1_000,
|
||||
completion_tokens=0,
|
||||
cache_read_input_tokens=1_000,
|
||||
custom_llm_provider="apimodels",
|
||||
)
|
||||
model_info: Final = litellm.get_model_info(model)
|
||||
|
||||
assert entry["source"].startswith("https://apimodels.app/models/")
|
||||
assert entry["cache_read_input_token_cost"] < entry["input_cost_per_token"]
|
||||
assert prompt_cost == pytest.approx(entry["input_cost_per_token"] * 1_000)
|
||||
assert completion_cost == pytest.approx(entry["output_cost_per_token"] * 1_000)
|
||||
assert cached_prompt_cost == pytest.approx(entry["cache_read_input_token_cost"] * 1_000)
|
||||
assert model_info["litellm_provider"] == "apimodels"
|
||||
assert "max_tokens" not in entry
|
||||
assert model_info["max_tokens"] == entry.get("max_output_tokens")
|
||||
declared_capabilities: Final = {
|
||||
flag: check(model)
|
||||
for flag, check in (
|
||||
("supports_function_calling", supports_function_calling),
|
||||
("supports_reasoning", supports_reasoning),
|
||||
("supports_prompt_caching", supports_prompt_caching),
|
||||
("supports_vision", supports_vision),
|
||||
)
|
||||
if flag in entry
|
||||
}
|
||||
assert declared_capabilities == {flag: entry[flag] for flag in declared_capabilities}
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("local_model_cost_map")
|
||||
def test_apimodels_wildcard_expands_to_every_apimodels_row():
|
||||
from litellm.proxy.auth.model_checks import get_known_models_from_wildcard
|
||||
|
||||
assert set(get_known_models_from_wildcard("apimodels/*")) == set(APIMODELS_MODELS)
|
||||
|
||||
|
||||
def test_apimodels_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())
|
||||
apimodels_entries: Final = {name: entry for name, entry in cost_map.items() if name.startswith("apimodels/")}
|
||||
|
||||
assert apimodels_entries
|
||||
assert tuple(sorted(apimodels_entries)) == APIMODELS_MODELS
|
||||
assert apimodels_entries == {name: backup[name] for name in apimodels_entries}
|
||||
|
||||
|
||||
def test_apimodels_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())
|
||||
apimodels: Final = 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"] in APIMODELS_MODELS
|
||||
assert {field["key"]: field["required"] for field in apimodels["credential_fields"]} == {
|
||||
"api_base": False,
|
||||
"api_key": True,
|
||||
}
|
||||
|
||||
|
||||
def test_apimodels_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"]["apimodels"]["endpoints"]
|
||||
root: Final = json.loads(root_path.read_text())["providers"]["apimodels"]["endpoints"]
|
||||
|
||||
assert backup == root
|
||||
assert {endpoint: root[endpoint] for endpoint in _EXPECTED_ENDPOINTS} == _EXPECTED_ENDPOINTS
|
||||
|
||||
|
||||
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(_CHAT_COMPLETIONS_URL).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) == _CHAT_COMPLETIONS_URL
|
||||
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(_CHAT_COMPLETIONS_URL).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"}]
|
||||
message_items: Final = [item for item in response.output if item.type == "message"]
|
||||
assert message_items[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(_CHAT_COMPLETIONS_URL).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 any(block.get("text") == "Hello from APIMODELS" for block in response["content"])
|
||||
|
||||
|
||||
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(_CHAT_COMPLETIONS_URL).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"]
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("model", OFF_PEAK_MODELS)
|
||||
@pytest.mark.parametrize("moment", (_WEEKDAY_OFF_PEAK, _WEEKEND), ids=("weekday-off-peak", "weekend"))
|
||||
def test_apimodels_deepseek_rows_bill_half_rate_outside_weekday_peak_hours(model: str, moment: datetime):
|
||||
from litellm.cost_calculator import cost_per_token
|
||||
|
||||
entry: Final = litellm.model_cost[model]
|
||||
with pinned_billing_time(moment):
|
||||
prompt_cost, completion_cost = cost_per_token(
|
||||
model=model,
|
||||
prompt_tokens=1_000,
|
||||
completion_tokens=1_000,
|
||||
custom_llm_provider="apimodels",
|
||||
)
|
||||
|
||||
assert prompt_cost == pytest.approx(entry["input_cost_per_token"] / 2 * 1_000)
|
||||
assert completion_cost == pytest.approx(entry["output_cost_per_token"] / 2 * 1_000)
|
||||
|
||||
|
||||
def test_apimodels_off_peak_rows_are_the_deepseek_flash_models():
|
||||
assert OFF_PEAK_MODELS == ("apimodels/deepseek-v4-flash", "apimodels/deepseek-v4.1-flash")
|
||||
Loading…
Add table
Reference in a new issue