跳至主要內容

OrcaRouter 標誌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 端點。部分 Provider 專屬功能可能無法使用,詳情請參閱OrcaRouter 文件

模型
模型 的直接連結

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
orcarouter/anthropic/claude-haiku-4.5200K$1$5
orcarouter/anthropic/claude-opus-4200K$15$75
orcarouter/anthropic/claude-opus-4.1200K$15$75
orcarouter/anthropic/claude-opus-4.5200K$5$25
orcarouter/anthropic/claude-opus-4.61.0M$5$25
orcarouter/anthropic/claude-opus-4.71.0M$5$25
orcarouter/anthropic/claude-sonnet-4200K$3$15
orcarouter/anthropic/claude-sonnet-4.5200K$3$15
orcarouter/anthropic/claude-sonnet-4.61.0M$3$15
orcarouter/deepseek/deepseek-chat1.0M$0.14$0.28
orcarouter/deepseek/deepseek-reasoner1.0M$0.43$0.87
orcarouter/deepseek/deepseek-v4-flash1.0M$0.19$0.37
orcarouter/deepseek/deepseek-v4-pro1.0M$0.56$1
orcarouter/google/gemini-2.5-flash1.0M$0.30$3
orcarouter/google/gemini-2.5-flash-lite1.0M$0.10$0.40
orcarouter/google/gemini-2.5-pro1.0M$3$15
orcarouter/google/gemini-3-flash-preview1.0M$0.50$3
orcarouter/google/gemini-3-pro-preview1.0M$4$18
orcarouter/google/gemini-3.1-flash-lite-preview1.0M$0.25$2
orcarouter/google/gemini-3.1-pro-preview1.0M$4$18
orcarouter/google/gemini-3.1-pro-preview-customtools1.0M$4$18
orcarouter/google/gemini-flash-latest1.0M$2$9
orcarouter/google/gemini-flash-lite-latest1.0M$0.25$2
orcarouter/google/gemma-4-26b-a4b-it262K$0.06$0.33
orcarouter/google/gemma-4-31b-it262K$0.13$0.38
orcarouter/grok/grok-4.31.0M$1$3
orcarouter/kimi/kimi-k2.5262K$0.60$3
orcarouter/kimi/kimi-k2.6262K$0.95$4
orcarouter/minimax/minimax-m2.5205K$0.30$1
orcarouter/minimax/minimax-m2.5-highspeed205K$0.60$2
orcarouter/minimax/minimax-m2.7205K$0.30$1
orcarouter/minimax/minimax-m2.7-highspeed205K$0.60$2
orcarouter/openai/gpt-3.5-turbo16K$0.50$2
orcarouter/openai/gpt-48K$30$60
orcarouter/openai/gpt-4-turbo128K$10$30
orcarouter/openai/gpt-4.11.0M$2$8
orcarouter/openai/gpt-4.1-mini1.0M$0.40$2
orcarouter/openai/gpt-4.1-nano1.0M$0.10$0.40
orcarouter/openai/gpt-4o128K$3$10
orcarouter/openai/gpt-4o-2024-05-13128K$5$15
orcarouter/openai/gpt-4o-2024-08-06128K$3$10
orcarouter/openai/gpt-4o-2024-11-20128K$3$10
orcarouter/openai/gpt-4o-mini128K$0.15$0.60
orcarouter/openai/gpt-5400K$1$10
orcarouter/openai/gpt-5-chat-latest400K$1$10
orcarouter/openai/gpt-5-codex400K$1$10
orcarouter/openai/gpt-5-mini400K$0.25$2
orcarouter/openai/gpt-5-nano400K$0.05$0.40
orcarouter/openai/gpt-5-pro400K$15$120
orcarouter/openai/gpt-5.1400K$1$10
orcarouter/openai/gpt-5.1-chat-latest128K$1$10
orcarouter/openai/gpt-5.1-codex400K$1$10
orcarouter/openai/gpt-5.1-codex-max400K$1$10
orcarouter/openai/gpt-5.1-codex-mini400K$0.25$2
orcarouter/openai/gpt-5.2400K$2$14
orcarouter/openai/gpt-5.2-chat-latest128K$2$14
orcarouter/openai/gpt-5.2-codex400K$2$14
orcarouter/openai/gpt-5.2-pro400K$21$168
orcarouter/openai/gpt-5.3-chat-latest128K$2$14
orcarouter/openai/gpt-5.3-codex400K$2$14
orcarouter/openai/gpt-5.41.1M$5$23
orcarouter/openai/gpt-5.4-mini400K$0.75$5
orcarouter/openai/gpt-5.4-nano400K$0.20$1
orcarouter/openai/gpt-5.4-pro1.1M$60$270
orcarouter/openai/gpt-5.51.1M$5$30
orcarouter/openai/gpt-5.5-pro1.1M$30$180
orcarouter/orcarouter/auto128K
orcarouter/qwen/qwen3-max262K$0.36$1
orcarouter/qwen/qwen3.5-122b-a10b262K$0.12$0.92
orcarouter/qwen/qwen3.5-27b262K$0.09$0.69
orcarouter/qwen/qwen3.5-35b-a3b262K$0.06$0.46
orcarouter/qwen/qwen3.5-397b-a17b262K$0.17$1
orcarouter/qwen/qwen3.5-plus1.0M$0.12$0.69
orcarouter/qwen/qwen3.6-35b-a3b262K$0.25$1
orcarouter/qwen/qwen3.6-plus1.0M$0.50$3
orcarouter/z-ai/glm-4.5131K$0.60$2
orcarouter/z-ai/glm-4.5-air131K$0.20$1
orcarouter/z-ai/glm-4.6205K$0.60$2
orcarouter/z-ai/glm-4.7205K$0.60$2
orcarouter/z-ai/glm-5205K$1$3
orcarouter/z-ai/glm-5.1200K$1$4
81 available models

進階設定
進階設定 的直接連結

自訂標頭
自訂標頭 的直接連結

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'
},
})