页面简介
Complete API reference for OpenRouter's Models API. Discover models, filter by input and output modalities, query supported parameters, sort by price and latency, and resolve aliases and variants.
正文摘录
The OpenRouter Models API provides programmatic access to metadata, capabilities, context limits, pricing, and provider endpoints for every model available on OpenRouter. The catalog updates continuously as providers deploy new models, adjust pricing, and add hardware endpoints. Catalog endpoints OpenRouter provides several endpoints for discovering and inspecting models: MethodEndpointAuthPurposeGET/api/v1/modelsOptionalPublic catalog with server-side filtering, sorting, and pagination.GET/api/v1/models/userRequiredCatalog filtered to models accessible by your API key, reflecting your workspace guardrails, provider preferences, and privacy settings.GET/api/v1/model/{author}/{slug}OptionalDetailed record for a single model, resolving aliases and variants automatically.GET/api/v1/models/{author}/{slug}/endpointsOptionalPer-provider endpoints for a model with quantization, pricing, context limits, and availability.GET/api/v1/models/countOptionalTotal count of models matching an output_modalities filter.GET/api/v1/endpoints/zdrOptionalPreview of provider endpoints that support Zero Data Retention (ZDR).GET/api/v1/images/modelsOptionalDedicated image generation catalog with typed input_modalities, output_modalities, and capability descriptors.GET/api/v1/images/models/{author}/{slug}/endpointsOptionalPer-provider endpoints for an image generation model with typed modality members, capabilities, and pricing.GET/api/v1/videos/modelsOptionalDedicated video generation catalog with duration, resolution, SKU pricing, and typed input_modalities and output_modalities.GET/api/v1/embeddings/modelsOptionalDedicated text and multimodal embedding catalog with typed input_modalities and output_modalities.GET/api/v1/rerank/modelsOptionalDedicated rerank catalog with typed input_modalities, output_modalities, and input-token or search-unit pricing.GET/api/v1/audio/speech/modelsOptionalDedicated text-to-speech catalog with voices, output formats, and speed ranges.GET/api/v1/audio/speech/models/{author}/{slug}OptionalSingle text-to-speech model with per-endpoint voices and speech parameters.GET/api/v1/audio/transcriptions/modelsOptionalDedicated speech-to-text catalog with typed input_modalities, output_modalities, and per-endpoint transcription parameters.GET/api/v1/audio/transcriptions/models/{author}/{slug}OptionalSingle speech-to-text model with per-endpoint transcription parameters (response_format, timestamp_granularities, diarize, keyterms). Query parameters (GET /api/v1/models) The primary catalog endpoint accepts the following query parameters: ParameterTypeDefaultDescriptionoutput_modalitiesstringtextComma-separated output modalities to return, or all. Options: text, image, video, speech, transcription, audio, embeddings, rerank, decisions, all.input_modalitiesstring(all)Comma-separated input modalities required: text, image, audio, file.endpointsstring(all)Comma-separated API paths the model must serve. Examples: /api/v1/chat/completions, /api/v1/audio/speech, /api/alpha/extractions.supported_parametersstring(all)Comma-separated API parameters required (e.g. tools, structured_outputs, reasoning).sortstring(default)Server-side ordering: pricing-low-to-high, pricing-high-to-low, latency-low-to-high, throughput-high-to-low, context-high-to-low, newest, most-popular.min_pricenumber(none)Minimum prompt price in /Mtokens.Usefulforexcluding‘/M tokens. Useful for excluding `0free models or-1` dynamic routers.max_pricenumber(none)Maximum prompt price in $/M tokens.contextinteger(none)Minimum context window size in tokens.zdrstring (true)(none)When set to true, returns only models with at least one Zero Data Retention (ZDR) endpoint. This filters the catalog only; it doesn’t restrict routing, so other endpoints of the same model may still retain prompts. To enforce ZDR on a request, set provider.zdr: true; see Zero Data Retention.regionstring(none)Returns only models with at least one endpoint in the given data region (eu or us). This filters the catalog only; it doesn’t restrict routing, so a matched model can still be served by an endpoint outside the region. To keep inference in a region, send requests to the regional base URL (https://eu.openrouter.ai or https://us.openrouter.ai) and enforce it with a guardrail’s allowed_data_regions; see In-Region Routing. Requests served by your own BYOK key go to wherever that deployment runs, so provision BYOK deployments in the same region; see BYOK with In-Region Routing.qstring(none)Case-insensitive search string matching model name, author, or description.offsetinteger0Number of models to skip for pagination.limitinteger(none)Maximum number of models to return (up to 1000). Modality filtering guide By default, GET /api/v1/models returns text-output models only. If you omit output_modalities, image generators, embedding models, dedicated speech models, and decision models are excluded. Pass output_modalities=all to receive the complete multi-modal catalog, or target specific capabilities: TypeScriptPythonGo# Summarize each response: model count plus a few sample IDs summary='{model_count: (.data | length), sample_ids: [.data[:5][].id]}' # Text generation models only (default) curl -fsS "https://openrouter.ai/api/v1/models" \ -H "Authorization: Bearer $OPENROUTER_API_KEY" | jq "$summary" # Every model across all modalities (image, video, text, speech, etc.) curl -fsS "https://openrouter.ai/api/v1/models?output_modalities=all" \ -H "Authorization: Bearer $OPENROUTER_API_KEY" | jq "$summary" # Image generation models curl -fsS "https://openrouter.ai/api/v1/models?output_modalities=image" \ -H "Authorization: Bearer $OPENROUTER_API_KEY" | jq "$summary" # Dedicated text-to-speech models curl -fsS "https://openrouter.ai/api/v1/models?output_modalities=speech" \ -H "Authorization: Bearer $OPENROUTER_API_KEY" | jq "$summary" # Dedicated speech-to-text models curl -fsS "https://openrouter.ai/api/v1/models?output_modalities=transcription" \ -H "Authorization: Bearer $OPENROUTER_API_KEY" | jq "$summary" Output{ "model_count": 518, "sample_ids": [ "near-ai/qwen3.8-27b-cyber", "near-ai/deepseek-v4.1-flash-1017-cyber", "openai/gpt-6.2-astra-pro", "openai/gpt-6.2-astra-pro:batch", "openai/gpt-6.2-astra" ] } { "model_count": 774, "sample_ids": [ "near-ai/qwen3.8-27b-cyber", "near-ai/deepseek-v4.1-flash-1017-cyber", "heygen/heygen-avatar-6-turbo", "heygen/heygen-avatar-6", "openai/gpt-6.2-astra-pro" ] } { "model_count": 73, "sample_ids": [ "microsoft/mai-image-2.7-flash", "microsoft/mai-image-2.7", "recraft/recraft-v4.1-flash-v2", "tencent/hy-world-2.1-panorama", "bytedance-seed/seedream-5-5" ] } { "model_count": 41, "sample_ids": [ "speechify/simba-3.5", "assemblyai/assemblyai-tts-1", "heygen/heygen-voice-1-turbo", "heygen/heygen-voice-1-turbo:free", "mistralai/voxtral-mini-tts-3-0" ] } Important distinction: audio vs speech vs transcription OpenRouter categorizes audio capabilities into three distinct output modalities: speech: Dedicated Text-to-Speech (TTS) models that run on the POST /api/v1/audio/speech endpoint (e.g. assemblyai/assemblyai-tts-1, heygen/heygen-voice-1). They return raw binary audio files (MP3, WAV, PCM). To list their voices and speech parameters, use GET /api/v1/audio/speech/models. transcription: Dedicated Speech-to-Text (STT) models that run on the POST /api/v1/audio/transcriptions endpoint (e.g. x-ai/grok-stt-2.0, nvidia/nemotron-3.5-transcribe, openai/whisper-large-v3). They accept audio file uploads and return transcribed text. To list their supported transcription parameters, use GET /api/v1/audio/transcriptions/models. audio: General conversational multimodal models that process or emit audio chunks via POST /api/v1/chat/completions or POST /api/v1/responses (e.g. openai/gpt-audio, openai/gpt-audio-mini, google/lyria-3-clip-preview). Sentinel prices and safe cheapest-model sorting When building model selectors or cost optimizers, be aware of two sentinel price values in the pricing object: -1 (Dynamic Router models): Routers such as openrouter/auto, openrouter/auto-code, openrouter/fusion, and typesafe/jev-router set pricing.prompt: "-1" and pricing.completion: "-1". Because these models dynamically delegate to underlying models at runtime, their final cost depends on the selected downstream provider. 0 (Free models and variants): Models ending in :free (e.g. liquid/lfm-2.5-2.6b:free) and experimental preview models set prompt and completion pricing to 0. For rerank models (GET /api/v1/rerank/models or output_modalities=rerank), paid models publish either pricing.prompt (USD per input token) or pricing.request (USD per search unit, where larger requests cost a multiple of this rate). Search-unit counting varies by provider (for example, one query over up to 100 documents on Cohere, or estimated 500-token query/document chunks counted in groups of 100 on Amazon Bedrock, where long documents can count as multiple units). A rerank model with pricing.prompt: "0" and a non-zero pricing.request is priced per search unit rather than free. The naive sort trap If client code performs a naive numeric sort (models.sort((a, b) => a.pricing.prompt - b.pricing.prompt)), dynamic router models with -1 will sort to the very top, followed by free models with 0. If your application expects a standard paid LLM with direct provider endpoints, sending requests to -1 routers or rate-limited :free variants will produce unexpected routing behavior. Safe server-side query To query the cheapest paid production chat models server-side in one call, combine three filters: sort=pricing-low-to-high (orders from lowest price to highest) min_price=0.000001 (excludes -1 dynamic routers and $0 free variants) endpoints=/api/v1/chat/completions (excludes models that only serve batches, embeddings, or media) TypeScriptPythonGocurl -fsS "https://openrouter.ai/api/v1/models?sort=pricing-low-to-high&min_price=0.000001&endpoints=/api/v1/chat/completions" TypeScript client-side filtering example PythonGocURLinterface