ZenMux
Access 18 ZenMux models through Mastra's model router. Authentication is handled automatically using the ZENMUX_API_KEY environment variable.
Learn more in the ZenMux documentation.
ZENMUX_API_KEY=your-api-key
import { Agent } from "@mastra/core";
const agent = new Agent({
name: "my-agent",
instructions: "You are a helpful assistant",
model: "zenmux/anthropic/claude-haiku-4.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);
}
info
Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the ZenMux documentation for details.
Models
| Model | Image | Audio | Video | Tools | Streaming | Context Window |
|---|---|---|---|---|---|---|
zenmux/anthropic/claude-haiku-4.5 | ✓ | ✗ | ✗ | ✓ | ✗ | 200,000 |
zenmux/anthropic/claude-opus-4.1 | ✓ | ✗ | ✗ | ✓ | ✗ | 200,000 |
zenmux/anthropic/claude-sonnet-4.5 | ✓ | ✗ | ✗ | ✓ | ✗ | 1,000,000 |
zenmux/deepseek/deepseek-chat | ✗ | ✗ | ✗ | ✓ | ✗ | 128,000 |
zenmux/google/gemini-2.5-pro | ✓ | ✓ | ✓ | ✓ | ✗ | 1,048,576 |
zenmux/inclusionai/lint-1t | ✗ | ✗ | ✗ | ✓ | ✗ | 128,000 |
zenmux/inclusionai/ring-1t | ✗ | ✗ | ✗ | ✓ | ✗ | 128,000 |
zenmux/kuaishou/kat-coder-pro-v1 | ✗ | ✗ | ✗ | ✓ | ✗ | 256,000 |
zenmux/moonshotai/kimi-k2-0905 | ✗ | ✗ | ✗ | ✓ | ✗ | 262,144 |
zenmux/openai/gpt-5 | ✓ | ✗ | ✗ | ✓ | ✗ | 400,000 |
zenmux/openai/gpt-5-codex | ✓ | ✗ | ✗ | ✓ | ✗ | 400,000 |
zenmux/qwen/qwen3-coder-plus | ✗ | ✗ | ✗ | ✓ | ✗ | 1,000,000 |
zenmux/x-ai/grok-4 | ✓ | ✗ | ✗ | ✓ | ✗ | 256,000 |
zenmux/x-ai/grok-4-fast | ✓ | ✗ | ✗ | ✓ | ✗ | 2,000,000 |
zenmux/x-ai/grok-4-fast-non-reasoning | ✓ | ✗ | ✗ | ✓ | ✗ | 2,000,000 |
zenmux/x-ai/grok-code-fast-1 | ✗ | ✗ | ✗ | ✓ | ✗ | 256,000 |
zenmux/z-ai/glm-4.5-air | ✗ | ✗ | ✗ | ✓ | ✗ | 128,000 |
zenmux/z-ai/glm-4.6 | ✗ | ✗ | ✗ | ✓ | ✗ | 200,000 |
Advanced Configuration
Custom Headers
const agent = new Agent({
name: "custom-agent",
model: {
url: "https://zenmux.ai/api/v1",
id: "zenmux/anthropic/claude-haiku-4.5",
apiKey: process.env.ZENMUX_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});
Dynamic Model Selection
const agent = new Agent({
name: "dynamic-agent",
model: ({ runtimeContext }) => {
const useAdvanced = runtimeContext.task === "complex";
return useAdvanced
? "zenmux/z-ai/glm-4.6"
: "zenmux/anthropic/claude-haiku-4.5";
}
});