OrcaRouter
透過 Mastra 的模型路由器存取 81 個 OrcaRouter 模型。系統會自動使用 ORCAROUTER_API_KEY 環境變數完成身分驗證。
如需進一步了解,請參閱OrcaRouter 文件。
.env
ORCAROUTER_API_KEY=your-api-key
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: 'orcarouter/anthropic/claude-haiku-4.5',
})
// Generate a response
const response = await agent.generate('Hello!')
// Stream a response
const stream = await agent.stream('Tell me a story')
for await (const chunk of stream) {
console.log(chunk)
}
資訊
Mastra 使用與 OpenAI 相容的 /chat/completions endpoint。部分 Provider 特有功能可能無法使用,詳情請參閱OrcaRouter 文件。
模型「模型」的直接連結
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
orcarouter/anthropic/claude-haiku-4.5 | 200K | $1 | $5 | |||||
orcarouter/anthropic/claude-opus-4 | 200K | $15 | $75 | |||||
orcarouter/anthropic/claude-opus-4.1 | 200K | $15 | $75 | |||||
orcarouter/anthropic/claude-opus-4.5 | 200K | $5 | $25 | |||||
orcarouter/anthropic/claude-opus-4.6 | 1.0M | $5 | $25 | |||||
orcarouter/anthropic/claude-opus-4.7 | 1.0M | $5 | $25 | |||||
orcarouter/anthropic/claude-sonnet-4 | 200K | $3 | $15 | |||||
orcarouter/anthropic/claude-sonnet-4.5 | 200K | $3 | $15 | |||||
orcarouter/anthropic/claude-sonnet-4.6 | 1.0M | $3 | $15 | |||||
orcarouter/deepseek/deepseek-chat | 1.0M | $0.14 | $0.28 | |||||
orcarouter/deepseek/deepseek-reasoner | 1.0M | $0.43 | $0.87 | |||||
orcarouter/deepseek/deepseek-v4-flash | 1.0M | $0.19 | $0.37 | |||||
orcarouter/deepseek/deepseek-v4-pro | 1.0M | $0.56 | $1 | |||||
orcarouter/google/gemini-2.5-flash | 1.0M | $0.30 | $3 | |||||
orcarouter/google/gemini-2.5-flash-lite | 1.0M | $0.10 | $0.40 | |||||
orcarouter/google/gemini-2.5-pro | 1.0M | $3 | $15 | |||||
orcarouter/google/gemini-3-flash-preview | 1.0M | $0.50 | $3 | |||||
orcarouter/google/gemini-3-pro-preview | 1.0M | $4 | $18 | |||||
orcarouter/google/gemini-3.1-flash-lite-preview | 1.0M | $0.25 | $2 | |||||
orcarouter/google/gemini-3.1-pro-preview | 1.0M | $4 | $18 | |||||
orcarouter/google/gemini-3.1-pro-preview-customtools | 1.0M | $4 | $18 | |||||
orcarouter/google/gemini-flash-latest | 1.0M | $2 | $9 | |||||
orcarouter/google/gemini-flash-lite-latest | 1.0M | $0.25 | $2 | |||||
orcarouter/google/gemma-4-26b-a4b-it | 262K | $0.06 | $0.33 | |||||
orcarouter/google/gemma-4-31b-it | 262K | $0.13 | $0.38 | |||||
orcarouter/grok/grok-4.3 | 1.0M | $1 | $3 | |||||
orcarouter/kimi/kimi-k2.5 | 262K | $0.60 | $3 | |||||
orcarouter/kimi/kimi-k2.6 | 262K | $0.95 | $4 | |||||
orcarouter/minimax/minimax-m2.5 | 205K | $0.30 | $1 | |||||
orcarouter/minimax/minimax-m2.5-highspeed | 205K | $0.60 | $2 | |||||
orcarouter/minimax/minimax-m2.7 | 205K | $0.30 | $1 | |||||
orcarouter/minimax/minimax-m2.7-highspeed | 205K | $0.60 | $2 | |||||
orcarouter/openai/gpt-3.5-turbo | 16K | $0.50 | $2 | |||||
orcarouter/openai/gpt-4 | 8K | $30 | $60 | |||||
orcarouter/openai/gpt-4-turbo | 128K | $10 | $30 | |||||
orcarouter/openai/gpt-4.1 | 1.0M | $2 | $8 | |||||
orcarouter/openai/gpt-4.1-mini | 1.0M | $0.40 | $2 | |||||
orcarouter/openai/gpt-4.1-nano | 1.0M | $0.10 | $0.40 | |||||
orcarouter/openai/gpt-4o | 128K | $3 | $10 | |||||
orcarouter/openai/gpt-4o-2024-05-13 | 128K | $5 | $15 | |||||
orcarouter/openai/gpt-4o-2024-08-06 | 128K | $3 | $10 | |||||
orcarouter/openai/gpt-4o-2024-11-20 | 128K | $3 | $10 | |||||
orcarouter/openai/gpt-4o-mini | 128K | $0.15 | $0.60 | |||||
orcarouter/openai/gpt-5 | 400K | $1 | $10 | |||||
orcarouter/openai/gpt-5-chat-latest | 400K | $1 | $10 | |||||
orcarouter/openai/gpt-5-codex | 400K | $1 | $10 | |||||
orcarouter/openai/gpt-5-mini | 400K | $0.25 | $2 | |||||
orcarouter/openai/gpt-5-nano | 400K | $0.05 | $0.40 | |||||
orcarouter/openai/gpt-5-pro | 400K | $15 | $120 | |||||
orcarouter/openai/gpt-5.1 | 400K | $1 | $10 | |||||
orcarouter/openai/gpt-5.1-chat-latest | 128K | $1 | $10 | |||||
orcarouter/openai/gpt-5.1-codex | 400K | $1 | $10 | |||||
orcarouter/openai/gpt-5.1-codex-max | 400K | $1 | $10 | |||||
orcarouter/openai/gpt-5.1-codex-mini | 400K | $0.25 | $2 | |||||
orcarouter/openai/gpt-5.2 | 400K | $2 | $14 | |||||
orcarouter/openai/gpt-5.2-chat-latest | 128K | $2 | $14 | |||||
orcarouter/openai/gpt-5.2-codex | 400K | $2 | $14 | |||||
orcarouter/openai/gpt-5.2-pro | 400K | $21 | $168 | |||||
orcarouter/openai/gpt-5.3-chat-latest | 128K | $2 | $14 | |||||
orcarouter/openai/gpt-5.3-codex | 400K | $2 | $14 | |||||
orcarouter/openai/gpt-5.4 | 1.1M | $5 | $23 | |||||
orcarouter/openai/gpt-5.4-mini | 400K | $0.75 | $5 | |||||
orcarouter/openai/gpt-5.4-nano | 400K | $0.20 | $1 | |||||
orcarouter/openai/gpt-5.4-pro | 1.1M | $60 | $270 | |||||
orcarouter/openai/gpt-5.5 | 1.1M | $5 | $30 | |||||
orcarouter/openai/gpt-5.5-pro | 1.1M | $30 | $180 | |||||
orcarouter/orcarouter/auto | 128K | — | — | |||||
orcarouter/qwen/qwen3-max | 262K | $0.36 | $1 | |||||
orcarouter/qwen/qwen3.5-122b-a10b | 262K | $0.12 | $0.92 | |||||
orcarouter/qwen/qwen3.5-27b | 262K | $0.09 | $0.69 | |||||
orcarouter/qwen/qwen3.5-35b-a3b | 262K | $0.06 | $0.46 | |||||
orcarouter/qwen/qwen3.5-397b-a17b | 262K | $0.17 | $1 | |||||
orcarouter/qwen/qwen3.5-plus | 1.0M | $0.12 | $0.69 | |||||
orcarouter/qwen/qwen3.6-35b-a3b | 262K | $0.25 | $1 | |||||
orcarouter/qwen/qwen3.6-plus | 1.0M | $0.50 | $3 | |||||
orcarouter/z-ai/glm-4.5 | 131K | $0.60 | $2 | |||||
orcarouter/z-ai/glm-4.5-air | 131K | $0.20 | $1 | |||||
orcarouter/z-ai/glm-4.6 | 205K | $0.60 | $2 | |||||
orcarouter/z-ai/glm-4.7 | 205K | $0.60 | $2 | |||||
orcarouter/z-ai/glm-5 | 205K | $1 | $3 | |||||
orcarouter/z-ai/glm-5.1 | 200K | $1 | $4 |
進階設定「進階設定」的直接連結
自訂標頭「自訂標頭」的直接連結
src/mastra/agents/my-agent.ts
const agent = new Agent({
id: 'custom-agent',
name: 'custom-agent',
model: {
url: 'https://api.orcarouter.ai/v1',
id: 'orcarouter/anthropic/claude-haiku-4.5',
apiKey: process.env.ORCAROUTER_API_KEY,
headers: {
'X-Custom-Header': 'value',
},
},
})
動態選擇模型「動態選擇模型」的直接連結
src/mastra/agents/my-agent.ts
const agent = new Agent({
id: 'dynamic-agent',
name: 'Dynamic Agent',
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === 'complex'
return useAdvanced ? 'orcarouter/z-ai/glm-5.1' : 'orcarouter/anthropic/claude-haiku-4.5'
},
})