> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # ![UnoRouter 標誌](https://models.dev/logos/unorouter.svg)UnoRouter 透過 Mastra 的模型路由器存取 23 個 UnoRouter 模型。系統會自動使用 `UNOROUTER_API_KEY` 環境變數進行驗證。 詳情請參閱[UnoRouter 文件](https://unorouter.com/models)。 ```bash UNOROUTER_API_KEY=your-api-key ``` ```typescript import { Agent } from '@mastra/core/agent' const agent = new Agent({ id: 'my-agent', name: 'My Agent', instructions: 'You are a helpful assistant', model: 'unorouter/claude-haiku-4-5-20251001', }) // 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 專屬功能可能無法使用,詳情請參閱[UnoRouter 文件](https://unorouter.com/models)。 ## 模型 | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M | | ------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- | | `unorouter/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $6 | | `unorouter/claude-opus-4-8` | 1.0M | | | | | | $0.42 | $2 | | `unorouter/claude-sonnet-5` | 1.0M | | | | | | $1 | $7 | | `unorouter/deepseek-v4-flash` | 1.0M | | | | | | $0.06 | $0.13 | | `unorouter/deepseek-v4-flash:free` | 1.0M | | | | | | — | — | | `unorouter/deepseek-v4-pro` | 1.0M | | | | | | $0.90 | $2 | | `unorouter/deepseek-v4-pro:free` | 1.0M | | | | | | — | — | | `unorouter/gemini-3.5-flash` | 1.0M | | | | | | $0.19 | $1 | | `unorouter/gemma-4-31b-it:free` | 262K | | | | | | — | — | | `unorouter/glm-4.5-flash:free` | 131K | | | | | | — | — | | `unorouter/glm-5.2` | 1.0M | | | | | | $2 | $5 | | `unorouter/glm-5.2:free` | 1.0M | | | | | | — | — | | `unorouter/gpt-5.2` | 400K | | | | | | $1 | $8 | | `unorouter/gpt-5.4` | 1.1M | | | | | | $2 | $11 | | `unorouter/gpt-5.4:free` | 1.1M | | | | | | — | — | | `unorouter/gpt-5.5` | 1.1M | | | | | | $0.19 | $1 | | `unorouter/gpt-5.5:free` | 1.1M | | | | | | — | — | | `unorouter/kimi-k2.6` | 262K | | | | | | $1 | $5 | | `unorouter/minimax-m2.7` | 205K | | | | | | $0.82 | $3 | | `unorouter/minimax-m2.7:free` | 205K | | | | | | — | — | | `unorouter/nemotron-3-ultra-550b-a55b:free` | 1.0M | | | | | | — | — | | `unorouter/qwen3.5-397b-a17b:free` | 262K | | | | | | — | — | | `unorouter/step-3.7-flash:free` | 256K | | | | | | — | — | ## 進階設定 ### 自訂標頭 ```typescript const agent = new Agent({ id: 'custom-agent', name: 'custom-agent', model: { url: 'https://api.unorouter.com/v1', id: 'unorouter/claude-haiku-4-5-20251001', apiKey: process.env.UNOROUTER_API_KEY, headers: { 'X-Custom-Header': 'value', }, }, }) ``` ### 動態選擇模型 ```typescript const agent = new Agent({ id: 'dynamic-agent', name: 'Dynamic Agent', model: ({ requestContext }) => { const useAdvanced = requestContext.task === 'complex' return useAdvanced ? 'unorouter/step-3.7-flash:free' : 'unorouter/claude-haiku-4-5-20251001' }, }) ```