Ofox
透過 Mastra 的模型路由器存取 71 個 Ofox 模型。系統會自動使用 OFOX_API_KEY 環境變數進行驗證。
詳情請參閱Ofox 文件。
.env
OFOX_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: 'ofox/anthropic/claude-fable-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 專屬功能可能無法使用,詳情請參閱Ofox 文件。
模型模型 的直接連結
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
ofox/anthropic/claude-fable-5 | 1.0M | $10 | $50 | |||||
ofox/anthropic/claude-haiku-4.5 | 200K | $1 | $5 | |||||
ofox/anthropic/claude-opus-4.5 | 200K | $5 | $25 | |||||
ofox/anthropic/claude-opus-4.6 | 1.0M | $5 | $25 | |||||
ofox/anthropic/claude-opus-4.7 | 1.0M | $5 | $25 | |||||
ofox/anthropic/claude-opus-4.8 | 1.0M | $5 | $25 | |||||
ofox/anthropic/claude-opus-5 | 1.0M | $5 | $25 | |||||
ofox/anthropic/claude-sonnet-4.6 | 1.0M | $3 | $15 | |||||
ofox/anthropic/claude-sonnet-5 | 1.0M | $2 | $10 | |||||
ofox/bailian/qwen-flash | 1.0M | $0.02 | $0.22 | |||||
ofox/bailian/qwen-max | 33K | $0.35 | $1 | |||||
ofox/bailian/qwen-turbo | 128K | $0.05 | $0.09 | |||||
ofox/bailian/qwen-vl-max | 131K | $0.23 | $0.58 | |||||
ofox/bailian/qwen3-coder-flash | 1.0M | $0.50 | $3 | |||||
ofox/bailian/qwen3-coder-next | 262K | $0.20 | $2 | |||||
ofox/bailian/qwen3-coder-plus | 1.0M | $2 | $9 | |||||
ofox/bailian/qwen3-max | 262K | $0.36 | $1 | |||||
ofox/bailian/qwen3.5-122b-a10b | 256K | $0.29 | $2 | |||||
ofox/bailian/qwen3.5-27b | 262K | $0.29 | $2 | |||||
ofox/bailian/qwen3.5-397b-a17b | 256K | $0.55 | $4 | |||||
ofox/bailian/qwen3.5-flash | 1.0M | $0.10 | $0.40 | |||||
ofox/bailian/qwen3.5-plus | 1.0M | $0.40 | $2 | |||||
ofox/bailian/qwen3.6-27b | 256K | $0.60 | $4 | |||||
ofox/bailian/qwen3.6-flash | 1.0M | $0.25 | $2 | |||||
ofox/bailian/qwen3.6-max-preview | 262K | $2 | $12 | |||||
ofox/bailian/qwen3.6-plus | 1.0M | $0.50 | $3 | |||||
ofox/bailian/qwen3.7-max | 1.0M | $3 | $8 | |||||
ofox/bailian/qwen3.7-plus | 1.0M | $0.40 | $2 | |||||
ofox/bailian/qwen3.8-max | 1.0M | $2 | $6 | |||||
ofox/deepseek/deepseek-v3.2 | 128K | $0.29 | $0.43 | |||||
ofox/deepseek/deepseek-v4-flash | 1.0M | $0.14 | $0.28 | |||||
ofox/deepseek/deepseek-v4-pro | 1.0M | $0.45 | $0.88 | |||||
ofox/google/gemini-2.5-flash | 1.0M | $0.30 | $3 | |||||
ofox/google/gemini-2.5-flash-lite | 1.0M | $0.10 | $0.40 | |||||
ofox/google/gemini-2.5-pro | 1.0M | $1 | $10 | |||||
ofox/google/gemini-3-flash-preview | 1.0M | $0.50 | $3 | |||||
ofox/google/gemini-3.1-flash-lite | 1.0M | $0.25 | $2 | |||||
ofox/google/gemini-3.1-pro-preview | 1.0M | $2 | $12 | |||||
ofox/google/gemini-3.5-flash | 1.0M | $2 | $9 | |||||
ofox/google/gemini-3.6-flash | 1.0M | $2 | $8 | |||||
ofox/moonshotai/kimi-k2.5 | 262K | $0.60 | $3 | |||||
ofox/moonshotai/kimi-k2.6 | 262K | $0.95 | $4 | |||||
ofox/moonshotai/kimi-k2.7-code-highspeed | 262K | $2 | $8 | |||||
ofox/moonshotai/kimi-k3 | 1.0M | $3 | $15 | |||||
ofox/openai/gpt-4.1 | 1.0M | $2 | $8 | |||||
ofox/openai/gpt-4.1-mini | 1.0M | $0.40 | $2 | |||||
ofox/openai/gpt-4o | 128K | $3 | $10 | |||||
ofox/openai/gpt-4o-mini | 128K | $0.15 | $0.60 | |||||
ofox/openai/gpt-5 | 400K | $1 | $10 | |||||
ofox/openai/gpt-5-mini | 256K | $0.25 | $2 | |||||
ofox/openai/gpt-5.1 | 400K | $1 | $10 | |||||
ofox/openai/gpt-5.1-codex-max | 256K | $1 | $10 | |||||
ofox/openai/gpt-5.1-codex-mini | 256K | $0.25 | $2 | |||||
ofox/openai/gpt-5.2 | 400K | $2 | $14 | |||||
ofox/openai/gpt-5.2-codex | 400K | $2 | $14 | |||||
ofox/openai/gpt-5.4-mini | 400K | $0.75 | $5 | |||||
ofox/openai/gpt-5.4-nano | 400K | $0.20 | $1 | |||||
ofox/openai/gpt-5.5 | 1.1M | $5 | $30 | |||||
ofox/openai/gpt-5.6-luna | 1.1M | $0.20 | $1 | |||||
ofox/openai/gpt-5.6-sol | 1.1M | $5 | $30 | |||||
ofox/openai/gpt-5.6-terra | 1.1M | $2 | $12 | |||||
ofox/x-ai/grok-4.1-fast | 2.0M | $0.20 | $0.50 | |||||
ofox/x-ai/grok-4.20 | 2.0M | $4 | $12 | |||||
ofox/x-ai/grok-4.3 | 1.0M | $1 | $3 | |||||
ofox/z-ai/glm-4.6 | 205K | $0.40 | $2 | |||||
ofox/z-ai/glm-4.7 | 205K | $0.40 | $2 | |||||
ofox/z-ai/glm-4.7-flashx | 200K | $0.07 | $0.43 | |||||
ofox/z-ai/glm-5 | 205K | $1 | $3 | |||||
ofox/z-ai/glm-5-turbo | 200K | $1 | $4 | |||||
ofox/z-ai/glm-5.1 | 200K | $1 | $4 | |||||
ofox/z-ai/glm-5.2 | 1.0M | $1 | $4 |
進階設定進階設定 的直接連結
自訂標頭自訂標頭 的直接連結
src/mastra/agents/my-agent.ts
const agent = new Agent({
id: 'custom-agent',
name: 'custom-agent',
model: {
url: 'https://api.ofox.ai/v1',
id: 'ofox/anthropic/claude-fable-5',
apiKey: process.env.OFOX_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 ? 'ofox/z-ai/glm-5.2' : 'ofox/anthropic/claude-fable-5'
},
})