Look up a model
~/.cache/routehub/openrouter_models.json (or $XDG_CACHE_HOME/routehub), and that file is used when OpenRouter can’t be reached, so an offline or air-gapped run keeps the catalog it last saw. Set ROUTEHUB_CACHE_DIR to move the file, or to off to disable it.
The supports_* functions return False for unknown models, and get_model_info raises ModelNotMappedError. Prices can be None.
Capability checks
supports_vision, supports_reasoning, supports_function_calling, supports_parallel_function_calling, supports_response_schema, supports_prompt_caching, supports_tool_choice, supports_system_messages, supports_pdf_input, supports_audio_input, supports_audio_output, supports_web_search, supports_computer_use and supports_assistant_prefill all take a model string.
How names are matched
- Anthropic-style names find OpenRouter’s:
claude-opus-4-7-20251001findsanthropic/claude-opus-4.7. - Serving providers’ IDs find the vendor’s entry.
groq/llama-3.3-70b-versatile,together_ai/meta-llama/Llama-3.3-70B-Instruct-Turboandcerebras/llama3.3-70ball resolve tometa-llama/llama-3.3-70b-instruct. Output limits come from the vendor’s entry and may differ from what the serving provider allows. - Embedding models, which OpenRouter doesn’t list, come from a small built-in table:
text-embedding-3-small,text-embedding-3-large,text-embedding-ada-002,gemini-embedding-001andmistral-embed.
provider, the RouteHub provider that serves it. litellm_provider holds the same value for code written against litellm.
Compute the cost of a call
Multiply the usage from a response by the prices from the catalog:Register your own models
Register private, fine-tuned or self-hosted models. Registered entries take priority and never expire:List models from every provider
get_all_models asks each provider’s own models API what it serves, concurrently, and returns one consistent shape:
OLLAMA_API_BASE is set.
Fields on each entry
Fields on each entry
id, provider, model, name, type, context_window, max_output_tokens, input_modalities, output_modalities, supports_vision, supports_function_calling, supports_reasoning, supports_structured_output, input_cost_per_token, output_cost_per_token, created, endpoints and the provider’s raw record. A field is None where the provider doesn’t report it.refresh=True to fetch again, or call clear_cache(). aget_all_models and aget_models are the async forms.
Count tokens
o200k_base for models tiktoken doesn’t know, so counts for non-OpenAI models are estimates. When no tokenizer can be loaded, for example offline before tiktoken has cached its files, counts fall back to four bytes per token.