# ![ZenMux logo](https://models.dev/logos/zenmux.svg)ZenMux

Access 87 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.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/anthropic/claude-sonnet-4.6`          | 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.1-flash-lite-preview` | 1.1M    |       |           |       |       |       | $0.25      | $2          |
| `zenmux/google/gemini-3.1-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-v2`            | 256K    |       |           |       |       |       | $0.30      | $1          |
| `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/minimax/minimax-m2.7`                 | 205K    |       |           |       |       |       | $0.31      | $1          |
| `zenmux/minimax/minimax-m2.7-highspeed`       | 205K    |       |           |       |       |       | $0.61      | $2          |
| `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/openai/gpt-5.2-pro`                   | 400K    |       |           |       |       |       | $21        | $168        |
| `zenmux/openai/gpt-5.3-chat`                  | 128K    |       |           |       |       |       | $2         | $14         |
| `zenmux/openai/gpt-5.3-codex`                 | 400K    |       |           |       |       |       | $2         | $14         |
| `zenmux/openai/gpt-5.4`                       | 1.1M    |       |           |       |       |       | $4         | $19         |
| `zenmux/openai/gpt-5.4-mini`                  | 400K    |       |           |       |       |       | $0.75      | $5          |
| `zenmux/openai/gpt-5.4-nano`                  | 400K    |       |           |       |       |       | $0.20      | $1          |
| `zenmux/openai/gpt-5.4-pro`                   | 1.1M    |       |           |       |       |       | $45        | $225        |
| `zenmux/qwen/qwen3-coder-plus`                | 1.0M    |       |           |       |       |       | $1         | $5          |
| `zenmux/qwen/qwen3-max`                       | 256K    |       |           |       |       |       | $1         | $6          |
| `zenmux/qwen/qwen3.5-flash`                   | 1.0M    |       |           |       |       |       | $0.10      | $0.40       |
| `zenmux/qwen/qwen3.5-plus`                    | 1.0M    |       |           |       |       |       | $0.80      | $5          |
| `zenmux/qwen/qwen3.6-plus`                    | 1.0M    |       |           |       |       |       | $0.50      | $3          |
| `zenmux/sapiens-ai/agnes-1.5-lite`            | 256K    |       |           |       |       |       | $0.12      | $0.60       |
| `zenmux/sapiens-ai/agnes-1.5-pro`             | 256K    |       |           |       |       |       | $0.16      | $0.80       |
| `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-2.0-code`      | 256K    |       |           |       |       |       | $0.90      | $4          |
| `zenmux/volcengine/doubao-seed-2.0-lite`      | 256K    |       |           |       |       |       | $0.09      | $0.51       |
| `zenmux/volcengine/doubao-seed-2.0-mini`      | 256K    |       |           |       |       |       | $0.03      | $0.28       |
| `zenmux/volcengine/doubao-seed-2.0-pro`       | 256K    |       |           |       |       |       | $0.45      | $2          |
| `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-4.2-fast`                   | 2.0M    |       |           |       |       |       | $3         | $9          |
| `zenmux/x-ai/grok-4.2-fast-non-reasoning`     | 2.0M    |       |           |       |       |       | $3         | $9          |
| `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-omni`                  | 265K    |       |           |       |       |       | $0.40      | $2          |
| `zenmux/xiaomi/mimo-v2-pro`                   | 1.0M    |       |           |       |       |       | $2         | $5          |
| `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          |
| `zenmux/z-ai/glm-5-turbo`                     | 200K    |       |           |       |       |       | $0.88      | $3          |
| `zenmux/z-ai/glm-5.1`                         | 200K    |       |           |       |       |       | $0.88      | $4          |
| `zenmux/z-ai/glm-5v-turbo`                    | 200K    |       |           |       |       |       | $0.73      | $3          |

## Advanced configuration

### Custom headers

```typescript
const agent = new Agent({
  id: "custom-agent",
  name: "custom-agent",
  model: {
    url: "https://zenmux.ai/api/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-5v-turbo"
      : "zenmux/anthropic/claude-3.5-haiku";
  }
});
```