# ![ZenMux logo](https://models.dev/logos/zenmux.svg)ZenMux Access 63 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable. Learn more in the [ZenMux documentation](https://docs.zenmux.ai). ```bash ZENMUX_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: "zenmux/anthropic/claude-3.5-haiku" }); // 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); } ``` > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [ZenMux documentation](https://docs.zenmux.ai) for details. ## Models | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M | | ------------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- | | `zenmux/anthropic/claude-3.5-haiku` | 200K | | | | | | $0.80 | $4 | | `zenmux/anthropic/claude-3.5-sonnet` | 200K | | | | | | $3 | $15 | | `zenmux/anthropic/claude-3.7-sonnet` | 200K | | | | | | $3 | $15 | | `zenmux/anthropic/claude-haiku-4.5` | 200K | | | | | | $1 | $5 | | `zenmux/anthropic/claude-opus-4` | 200K | | | | | | $15 | $75 | | `zenmux/anthropic/claude-opus-4.1` | 200K | | | | | | $15 | $75 | | `zenmux/anthropic/claude-opus-4.5` | 200K | | | | | | $5 | $25 | | `zenmux/anthropic/claude-opus-4.6` | 1.0M | | | | | | $5 | $25 | | `zenmux/anthropic/claude-sonnet-4` | 1.0M | | | | | | $3 | $15 | | `zenmux/anthropic/claude-sonnet-4.5` | 1.0M | | | | | | $3 | $15 | | `zenmux/baidu/ernie-5.0-thinking-preview` | 128K | | | | | | $0.84 | $3 | | `zenmux/deepseek/deepseek-chat` | 128K | | | | | | $0.28 | $0.42 | | `zenmux/deepseek/deepseek-v3.2` | 128K | | | | | | $0.28 | $0.43 | | `zenmux/deepseek/deepseek-v3.2-exp` | 163K | | | | | | $0.22 | $0.33 | | `zenmux/google/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 | | `zenmux/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 | | `zenmux/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 | | `zenmux/google/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 | | `zenmux/google/gemini-3-pro-preview` | 1.0M | | | | | | $2 | $12 | | `zenmux/inclusionai/ling-1t` | 128K | | | | | | $0.56 | $2 | | `zenmux/inclusionai/ring-1t` | 128K | | | | | | $0.56 | $2 | | `zenmux/kuaishou/kat-coder-pro-v1` | 256K | | | | | | $0.30 | $1 | | `zenmux/kuaishou/kat-coder-pro-v1-free` | 256K | | | | | | — | — | | `zenmux/minimax/minimax-m2` | 204K | | | | | | $0.30 | $1 | | `zenmux/minimax/minimax-m2.1` | 204K | | | | | | $0.30 | $1 | | `zenmux/minimax/minimax-m2.5` | 205K | | | | | | $0.30 | $1 | | `zenmux/minimax/minimax-m2.5-lightning` | 205K | | | | | | $0.60 | $5 | | `zenmux/moonshotai/kimi-k2-0905` | 262K | | | | | | $0.60 | $3 | | `zenmux/moonshotai/kimi-k2-thinking` | 262K | | | | | | $0.60 | $3 | | `zenmux/moonshotai/kimi-k2-thinking-turbo` | 262K | | | | | | $1 | $8 | | `zenmux/moonshotai/kimi-k2.5` | 262K | | | | | | $0.58 | $3 | | `zenmux/openai/gpt-5` | 400K | | | | | | $1 | $10 | | `zenmux/openai/gpt-5-codex` | 400K | | | | | | $1 | $10 | | `zenmux/openai/gpt-5.1` | 400K | | | | | | $1 | $10 | | `zenmux/openai/gpt-5.1-chat` | 128K | | | | | | $1 | $10 | | `zenmux/openai/gpt-5.1-codex` | 400K | | | | | | $1 | $10 | | `zenmux/openai/gpt-5.1-codex-mini` | 400K | | | | | | $0.25 | $2 | | `zenmux/openai/gpt-5.2` | 400K | | | | | | $2 | $14 | | `zenmux/openai/gpt-5.2-codex` | 400K | | | | | | $2 | $14 | | `zenmux/qwen/qwen3-coder-plus` | 1.0M | | | | | | $1 | $5 | | `zenmux/qwen/qwen3-max` | 256K | | | | | | $1 | $6 | | `zenmux/stepfun/step-3` | 66K | | | | | | $0.21 | $0.57 | | `zenmux/stepfun/step-3.5-flash` | 256K | | | | | | $0.10 | $0.30 | | `zenmux/stepfun/step-3.5-flash-free` | 256K | | | | | | — | — | | `zenmux/volcengine/doubao-seed-1.8` | 256K | | | | | | $0.11 | $0.28 | | `zenmux/volcengine/doubao-seed-code` | 256K | | | | | | $0.17 | $1 | | `zenmux/x-ai/grok-4` | 256K | | | | | | $3 | $15 | | `zenmux/x-ai/grok-4-fast` | 2.0M | | | | | | $0.20 | $0.50 | | `zenmux/x-ai/grok-4.1-fast` | 2.0M | | | | | | $0.20 | $0.50 | | `zenmux/x-ai/grok-4.1-fast-non-reasoning` | 2.0M | | | | | | $0.20 | $0.50 | | `zenmux/x-ai/grok-code-fast-1` | 256K | | | | | | $0.20 | $2 | | `zenmux/xiaomi/mimo-v2-flash` | 262K | | | | | | $0.10 | $0.30 | | `zenmux/xiaomi/mimo-v2-flash-free` | 262K | | | | | | — | — | | `zenmux/z-ai/glm-4.5` | 128K | | | | | | $0.35 | $2 | | `zenmux/z-ai/glm-4.5-air` | 128K | | | | | | $0.11 | $0.56 | | `zenmux/z-ai/glm-4.6` | 200K | | | | | | $0.35 | $2 | | `zenmux/z-ai/glm-4.6v` | 200K | | | | | | $0.14 | $0.42 | | `zenmux/z-ai/glm-4.6v-flash` | 200K | | | | | | $0.02 | $0.21 | | `zenmux/z-ai/glm-4.6v-flash-free` | 200K | | | | | | — | — | | `zenmux/z-ai/glm-4.7` | 200K | | | | | | $0.28 | $1 | | `zenmux/z-ai/glm-4.7-flash-free` | 200K | | | | | | — | — | | `zenmux/z-ai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.42 | | `zenmux/z-ai/glm-5` | 200K | | | | | | $0.58 | $3 | ## Advanced Configuration ### Custom Headers ```typescript const agent = new Agent({ id: "custom-agent", name: "custom-agent", model: { url: "https://zenmux.ai/api/anthropic/v1", id: "zenmux/anthropic/claude-3.5-haiku", apiKey: process.env.ZENMUX_API_KEY, headers: { "X-Custom-Header": "value" } } }); ``` ### Dynamic Model Selection ```typescript const agent = new Agent({ id: "dynamic-agent", name: "Dynamic Agent", model: ({ requestContext }) => { const useAdvanced = requestContext.task === "complex"; return useAdvanced ? "zenmux/z-ai/glm-5" : "zenmux/anthropic/claude-3.5-haiku"; } }); ``` ## Direct Provider Installation This provider can also be installed directly as a standalone package, which can be used instead of the Mastra model router string. View the [package documentation](https://www.npmjs.com/package/@ai-sdk/anthropic) for more details. **npm**: ```bash npm install @ai-sdk/anthropic ``` **pnpm**: ```bash pnpm add @ai-sdk/anthropic ``` **Yarn**: ```bash yarn add @ai-sdk/anthropic ``` **Bun**: ```bash bun add @ai-sdk/anthropic ```