OpenRouter
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 102 models through Mastra’s model router.
Learn more in the OpenRouter documentation .
Usage
import { Agent } from "@mastra/core";
const agent = new Agent({
name: "my-agent",
instructions: "You are a helpful assistant",
model: "openrouter/anthropic/claude-3.5-haiku"
});
Mastra uses the OpenAI-compatible /chat/completions
endpoint. Some provider-specific features may not be available. Check the OpenRouter documentation for details.
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
Model |
---|
anthropic/claude-3.5-haiku |
anthropic/claude-3.7-sonnet |
anthropic/claude-opus-4 |
anthropic/claude-opus-4.1 |
anthropic/claude-sonnet-4 |
anthropic/claude-sonnet-4.5 |
cognitivecomputations/dolphin3.0-mistral-24b |
cognitivecomputations/dolphin3.0-r1-mistral-24b |
deepseek/deepseek-chat-v3-0324 |
deepseek/deepseek-chat-v3.1 |
deepseek/deepseek-r1-0528-qwen3-8b:free |
deepseek/deepseek-r1-0528:free |
deepseek/deepseek-r1-distill-llama-70b |
deepseek/deepseek-r1-distill-qwen-14b |
deepseek/deepseek-r1:free |
deepseek/deepseek-v3-base:free |
deepseek/deepseek-v3.1-terminus |
featherless/qwerky-72b |
google/gemini-2.0-flash-001 |
google/gemini-2.0-flash-exp:free |
google/gemini-2.5-flash |
google/gemini-2.5-pro |
google/gemini-2.5-pro-preview-05-06 |
google/gemini-2.5-pro-preview-06-05 |
google/gemma-2-9b-it:free |
google/gemma-3-12b-it |
google/gemma-3-27b-it |
google/gemma-3n-e4b-it |
google/gemma-3n-e4b-it:free |
meta-llama/llama-3.2-11b-vision-instruct |
meta-llama/llama-3.3-70b-instruct:free |
meta-llama/llama-4-scout:free |
microsoft/mai-ds-r1:free |
mistralai/codestral-2508 |
mistralai/devstral-medium-2507 |
mistralai/devstral-small-2505 |
mistralai/devstral-small-2505:free |
mistralai/devstral-small-2507 |
mistralai/mistral-7b-instruct:free |
mistralai/mistral-medium-3 |
mistralai/mistral-medium-3.1 |
mistralai/mistral-nemo:free |
mistralai/mistral-small-3.1-24b-instruct |
mistralai/mistral-small-3.2-24b-instruct |
mistralai/mistral-small-3.2-24b-instruct:free |
moonshotai/kimi-dev-72b:free |
moonshotai/kimi-k2 |
moonshotai/kimi-k2-0905 |
moonshotai/kimi-k2:free |
nousresearch/deephermes-3-llama-3-8b-preview |
nousresearch/hermes-4-405b |
nousresearch/hermes-4-70b |
openai/gpt-4.1 |
openai/gpt-4.1-mini |
openai/gpt-4o-mini |
openai/gpt-5 |
openai/gpt-5-chat |
openai/gpt-5-mini |
openai/gpt-5-nano |
openai/gpt-oss-120b |
openai/gpt-oss-20b |
openai/o4-mini |
openrouter/cypher-alpha:free |
openrouter/horizon-alpha |
openrouter/horizon-beta |
openrouter/sonoma-dusk-alpha |
openrouter/sonoma-sky-alpha |
qwen/qwen-2.5-coder-32b-instruct |
qwen/qwen2.5-vl-32b-instruct:free |
qwen/qwen2.5-vl-72b-instruct |
qwen/qwen2.5-vl-72b-instruct:free |
qwen/qwen3-14b:free |
qwen/qwen3-235b-a22b-07-25 |
qwen/qwen3-235b-a22b-07-25:free |
qwen/qwen3-235b-a22b-thinking-2507 |
qwen/qwen3-235b-a22b:free |
qwen/qwen3-30b-a3b-instruct-2507 |
qwen/qwen3-30b-a3b:free |
qwen/qwen3-32b:free |
qwen/qwen3-8b:free |
qwen/qwen3-coder |
qwen/qwen3-coder:free |
qwen/qwen3-max |
qwen/qwen3-next-80b-a3b-instruct |
qwen/qwq-32b:free |
rekaai/reka-flash-3 |
sarvamai/sarvam-m:free |
thudm/glm-z1-32b:free |
tngtech/deepseek-r1t2-chimera:free |
x-ai/grok-3 |
x-ai/grok-3-beta |
x-ai/grok-3-mini |
x-ai/grok-3-mini-beta |
x-ai/grok-4 |
x-ai/grok-4-fast |
x-ai/grok-4-fast:free |
x-ai/grok-code-fast-1 |
z-ai/glm-4.5 |
z-ai/glm-4.5-air |
z-ai/glm-4.5-air:free |
z-ai/glm-4.5v |
z-ai/glm-4.6 |