> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # ![Umans AI 標誌](https://models.dev/logos/umans-ai.svg)Umans AI 透過 Mastra 的模型路由器存取 7 個 Umans AI 模型。系統會自動使用 `UMANS_AI_API_KEY` 環境變數進行驗證。 詳情請參閱[Umans AI 文件](https://app.umans.ai/offers/code/docs/orgs)。 ```bash UMANS_AI_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: 'umans-ai/umans-coder', }) // 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 專屬功能可能無法使用,詳情請參閱[Umans AI 文件](https://app.umans.ai/offers/code/docs/orgs)。 ## 模型 | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M | | --------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- | | `umans-ai/umans-coder` | 262K | | | | | | $0.95 | $4 | | `umans-ai/umans-deepseek-v4-flash-0731` | 1.0M | | | | | | $0.14 | $0.28 | | `umans-ai/umans-flash` | 262K | | | | | | $0.15 | $1 | | `umans-ai/umans-glm-5.1` | 205K | | | | | | $1 | $4 | | `umans-ai/umans-glm-5.2` | 406K | | | | | | $1 | $4 | | `umans-ai/umans-kimi-k2.7` | 262K | | | | | | $0.95 | $4 | | `umans-ai/umans-kimi-k3` | 1.0M | | | | | | $3 | $15 | ## 進階設定 ### 自訂標頭 ```typescript const agent = new Agent({ id: 'custom-agent', name: 'custom-agent', model: { url: 'https://api.code.umans.ai/v1', id: 'umans-ai/umans-coder', apiKey: process.env.UMANS_AI_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 ? 'umans-ai/umans-kimi-k3' : 'umans-ai/umans-coder' }, }) ```