Skip to main content

OpenRouter logoOpenRouter

OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 368 models through Mastra's model router.

Learn more in the OpenRouter documentation.

Usage
Direct link to Usage

src/mastra/agents/my-agent.ts
import { Agent } from "@mastra/core/agent";

const agent = new Agent({
id: "my-agent",
name: "My Agent",
instructions: "You are a helpful assistant",
model: "openrouter/aion-labs/aion-2.0"
});
note

Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the OpenRouter documentation for details.

Configuration
Direct link to Configuration

# Use gateway API key
OPENROUTER_API_KEY=your-gateway-key

# Or use provider API keys directly
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=ant-...

Available models
Direct link to Available models

Model
~anthropic/claude-fable-latest
~anthropic/claude-haiku-latest
~anthropic/claude-opus-latest
~anthropic/claude-sonnet-latest
~deepseek/deepseek-flash-latest
~deepseek/deepseek-pro-latest
~deepseek/deepseek-v4-flash-latest
~google/gemini-carbon-latest
~google/gemini-flash-latest
~google/gemini-hydrogen-latest
~google/gemini-neon-latest
~google/gemini-pro-latest
~moonshotai/kimi-latest
~moonshotai/kimi-pro-latest
~openai/gpt-astra-latest
~openai/gpt-luna-latest
~openai/gpt-mini-latest
~openai/gpt-sol-latest
~openai/gpt-terra-latest
~x-ai/grok-latest
~z-ai/glm-flash-latest
~z-ai/glm-latest
aion-labs/aion-2.0
aion-labs/aion-3.0
aion-labs/aion-3.0-mini
aion-labs/aion-3.5
aion-labs/aion-3.5-mini
aion-labs/aion-rp-llama-3.1-8b
amazon/ergo-1.0
amazon/nova-2-lite-v1
amazon/nova-lite-v1
amazon/nova-micro-v1
amazon/nova-premier-v1
amazon/nova-pro-v1
anthracite-org/magnum-v4-72b
anthropic/claude-fable-5
anthropic/claude-fable-5.1
anthropic/claude-fable-5.2
anthropic/claude-haiku-4.5
anthropic/claude-haiku-5.5
anthropic/claude-opus-4.1
anthropic/claude-opus-4.5
anthropic/claude-opus-4.6
anthropic/claude-opus-4.7
anthropic/claude-opus-4.8
anthropic/claude-opus-5
anthropic/claude-opus-5.5
anthropic/claude-sonnet-4.5
anthropic/claude-sonnet-4.6
anthropic/claude-sonnet-5
anthropic/claude-sonnet-5.5
baidu/ernie-5.5-flash-preview:free
baidu/ernie-light-dt-1.0-intl
bytedance-seed/seed-2-1-turbo
bytedance-seed/seed-2.0-lite
bytedance-seed/seed-2.0-mini
bytedance/ui-tars-1.5-7b
cognitivecomputations/dolphin-mistral-24b-venice-edition
cohere/command-a
cohere/command-a-plus
cohere/command-r-08-2024
cohere/command-r-plus-08-2024
cohere/command-r7b-12-2024
deepseek/deepseek-chat
deepseek/deepseek-chat-v3-0324
deepseek/deepseek-chat-v3.1
deepseek/deepseek-r1-0528
deepseek/deepseek-v3.1-terminus
deepseek/deepseek-v3.2
deepseek/deepseek-v3.2-exp
deepseek/deepseek-v4-flash
deepseek/deepseek-v4-flash-0731
deepseek/deepseek-v4-flash-vision-exp
deepseek/deepseek-v4-pro
deepseek/deepseek-v4-pro-0813
deepseek/deepseek-v4.1-flash
deepseek/deepseek-v4.1-flash-1017
elorian/glimpse
fireworks/ember-1
google/gemini-2.5-flash-image
google/gemini-2.5-flash-lite
google/gemini-2.5-pro-preview
google/gemini-3-flash-preview
google/gemini-3-pro-image
google/gemini-3-pro-image-preview
google/gemini-3.1-flash-image
google/gemini-3.1-flash-image-preview
google/gemini-3.1-flash-lite
google/gemini-3.1-flash-lite-image
google/gemini-3.1-flash-lite-preview
google/gemini-3.1-pro-preview
google/gemini-3.1-pro-preview-customtools
google/gemini-3.5-flash
google/gemini-3.5-flash-lite
google/gemini-3.6-flash
google/gemini-3.7-flash
google/gemini-3.8-flash
google/gemini-4-argon
google/gemini-4-carbon
google/gemini-4-hydrogen
google/gemini-4-neon
google/gemini-nano-banana-2.1
google/gemini-omni-1.1-flash
google/gemini-omni-1.2-flash
google/gemma-2-27b-it
google/gemma-3-12b-it
google/gemma-3-27b-it
google/gemma-3-4b-it
google/gemma-4-26b-a4b-it
google/gemma-4-26b-a4b-it:free
google/gemma-4-31b-it
google/gemma-4-31b-it:free
google/lyria-3-clip-preview
google/lyria-3-pro-preview
gryphe/mythomax-l2-13b
ibm-granite/granite-4.2-8b
inclusionai/ling-3.0-flash
inclusionai/ling-3.0-flash-vl
inclusionai/ling-3.1-flash
inclusionai/ling-3.2-air
inclusionai/lingsante-3.1-air-vl
inference-net/schematron-v2-small
inference-net/schematron-v2-turbo
kt/midm-k-3.0-pro
liquid/lfm-2.5-24b-a2b
liquid/lfm-3-1.7b
liquid/lfm-3-1.7b:free
mancer/weaver
meta-llama/llama-3.1-70b-instruct
meta-llama/llama-3.1-8b-instruct
meta-llama/llama-3.2-3b-instruct
meta-llama/llama-3.3-70b-instruct
meta-llama/llama-4-maverick
meta-llama/llama-4-scout
meta-llama/llama-guard-4-12b
meta/muse-ember
meta/muse-glimmer-30b
meta/muse-spark-1.1
meta/muse-spark-1.2
meta/muse-spark-1.2-contributor
meta/muse-spark-1.3
meta/muse-spark-1.3-contributor
meta/muse-spark-open
meta/muse-wonder
microsoft/phi-4
minimax/minimax-m2.5
minimax/minimax-m2.7
minimax/minimax-m3
minimax/minimax-m3.1-flash
mistralai/codestral-2508
mistralai/devstral-2512
mistralai/ministral-14b-2512
mistralai/ministral-3b-2512
mistralai/ministral-8b-2512
mistralai/mistral-large
mistralai/mistral-large-2407
mistralai/mistral-large-2512
mistralai/mistral-large-4-0
mistralai/mistral-medium-3-5
mistralai/mistral-nemo
mistralai/mistral-saba
mistralai/mistral-small-24b-instruct-2501
mistralai/mistral-small-2603
mistralai/mistral-small-3.1-24b-instruct
mistralai/mistral-small-3.2-24b-instruct
mistralai/mixtral-8x22b-instruct
mistralai/pixtral-large-2502
mistralai/voxtral-small-24b-2507
moonshotai/kimi-k2-0905
moonshotai/kimi-k2.5
moonshotai/kimi-k2.6
moonshotai/kimi-k2.7-code
moonshotai/kimi-k3
moonshotai/kimi-k3.1-pro
morph/morph-v3-fast
morph/morph-v3-large
motif-technologies/motif-3
nousresearch/hermes-4-405b
nvidia/nemotron-3-nano-30b-a3b
nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free
nvidia/nemotron-3-super-120b-a12b
nvidia/nemotron-3-ultra-550b-a55b
nvidia/nemotron-3-ultra-550b-a55b:free
nvidia/nemotron-3.5-lightning
nvidia/nemotron-3.5-lightning:free
nvidia/nemotron-3.5-super-vl
nvidia/nemotron-3.5-super-vl:free
openai/gpt-3.5-turbo-0613
openai/gpt-3.5-turbo-16k
openai/gpt-4
openai/gpt-4.1
openai/gpt-4.1-mini
openai/gpt-4.1-nano
openai/gpt-4o
openai/gpt-4o-2024-05-13
openai/gpt-4o-2024-08-06
openai/gpt-4o-2024-11-20
openai/gpt-4o-mini
openai/gpt-4o-mini-2024-07-18
openai/gpt-5
openai/gpt-5-image
openai/gpt-5-mini
openai/gpt-5-nano
openai/gpt-5-pro
openai/gpt-5.1
openai/gpt-5.1-codex
openai/gpt-5.1-codex-max
openai/gpt-5.1-codex-mini
openai/gpt-5.2
openai/gpt-5.2-codex
openai/gpt-5.2-pro
openai/gpt-5.3-codex
openai/gpt-5.4
openai/gpt-5.4-image-2
openai/gpt-5.4-mini
openai/gpt-5.4-nano
openai/gpt-5.4-pro
openai/gpt-5.5
openai/gpt-5.5-pro
openai/gpt-5.6-luna
openai/gpt-5.6-luna-pro
openai/gpt-5.6-sol
openai/gpt-5.6-sol-pro
openai/gpt-5.6-terra
openai/gpt-5.6-terra-pro
openai/gpt-6-astra
openai/gpt-6-astra-pro
openai/gpt-6-luna
openai/gpt-6-luna-pro
openai/gpt-6-sol
openai/gpt-6-sol-pro
openai/gpt-6.1-sol
openai/gpt-6.1-sol-pro
openai/gpt-6.1-terra
openai/gpt-6.1-terra-pro
openai/gpt-6.2-astra
openai/gpt-6.2-astra-pro
openai/gpt-6.2-sol
openai/gpt-6.2-sol-pro
openai/gpt-audio
openai/gpt-audio-mini
openai/gpt-chat-latest
openai/gpt-oss-120b
openai/gpt-oss-20b
openai/gpt-oss-safeguard-20b
openai/o3
openai/o3-pro
openrouter/auto
openrouter/free
openrouter/fusion
openrouter/pareto-code
particle-ai/particle-1
perceptron/perceptron-mk1
perceptron/perceptron-mk1.5
perplexity/sonar
perplexity/sonar-deep-research
perplexity/sonar-pro
perplexity/sonar-pro-search
perplexity/sonar-reasoning-pro
prism-ml/ternary-bonsai-2-27b
prism-ml/ternary-bonsai-2-9b
qwen/qwen-2.5-72b-instruct
qwen/qwen-2.5-coder-32b-instruct
qwen/qwen-plus
qwen/qwen2.5-vl-72b-instruct
qwen/qwen3-14b
qwen/qwen3-235b-a22b-2507
qwen/qwen3-30b-a3b
qwen/qwen3-30b-a3b-instruct-2507
qwen/qwen3-32b
qwen/qwen3-coder
qwen/qwen3-coder-30b-a3b-instruct
qwen/qwen3-coder-flash
qwen/qwen3-coder-next
qwen/qwen3-next-80b-a3b-instruct
qwen/qwen3-vl-235b-a22b-instruct
qwen/qwen3-vl-30b-a3b-instruct
qwen/qwen3-vl-8b-instruct
qwen/qwen3.5-122b-a10b
qwen/qwen3.5-27b
qwen/qwen3.5-35b-a3b
qwen/qwen3.5-397b-a17b
qwen/qwen3.5-9b
qwen/qwen3.5-flash-02-23
qwen/qwen3.5-plus-02-15
qwen/qwen3.5-plus-20260420
qwen/qwen3.6-27b
qwen/qwen3.6-35b-a3b
qwen/qwen3.6-flash
qwen/qwen3.6-plus
qwen/qwen3.7-flash
qwen/qwen3.7-max
qwen/qwen3.7-plus
qwen/qwen3.8-2.4t-a95b
qwen/qwen3.8-27b
qwen/qwen3.8-flash
qwen/qwen3.8-max-0902
qwen/qwen3.8-max-prime
qwen/qwen3.8-omni-flash
qwen/qwen4-max
radixark/daisyrose-27b
recursive/flint-v1.0:free
reflection/beam-1.0-501b-a23b
rekaai/reka-edge
rekaai/reka-flash-3
relace/relace-apply-3
relace/relace-search
ricursiveai/ripple-65b-preview
sakana/fugu-max
sakana/fugu-ultra
sakana/fugu-ultra-v2
sakana/sakana-namazu
sao10k/l3-lunaris-8b
scaledown/extract
scaledown/summarize
scaledown/toolcall:free
stepfun/step-3.7-flash
stepfun/step-5
stepfun/step-5-preview
tencent/hy-mt2-1.8b
tencent/hy-mt2-30b-a3b
tencent/hy-mt2-7b
tencent/hy3
tencent/hy4
tencent/hy4-flash
tencent/hy4-preview
thedrummer/cydonia-24b-v4.1
thedrummer/skyfall-36b-v2
thedrummer/unslopnemo-12b
thinkingmachines/inkling
thinkingmachines/inkling-2-mini
thinkingmachines/inkling-2-small
thinkingmachines/inkling-small
tngtech/deepseek-r1t2-chimera
undi95/remm-slerp-l2-13b
upstage/solar-mini-4-5
upstage/solar-mini4
upstage/solar-pro-4-contributor
upstage/solar-pro4
writer/palmyra-x5
x-ai/grok-4.20
x-ai/grok-4.20-multi-agent
x-ai/grok-4.3
x-ai/grok-4.5
x-ai/grok-4.6
x-ai/grok-4.7
xiaomi/mimo-v2.6-flash
xiaomi/mimo-v2.6-flash-mopd
xiaomi/mimo-v2.6-pro
xiaomi/mimo-v2.6-pro-ultraspeed
z-ai/glm-4.5
z-ai/glm-4.5-air
z-ai/glm-4.5v
z-ai/glm-4.6
z-ai/glm-4.6v
z-ai/glm-4.7
z-ai/glm-4.7-flash
z-ai/glm-5
z-ai/glm-5-turbo
z-ai/glm-5.1
z-ai/glm-5.2
z-ai/glm-5.3
z-ai/glm-5.3-flash
z-ai/glm-5.3-flashx
z-ai/glm-5.3-flashx-legal
z-ai/glm-5.3-prime
z-ai/glm-5.4
z-ai/glm-5v-turbo
On this page