> Discover all available pages from the documentation index: https://mastra.ai/llms.txt

# ![UnoRouter logo](https://models.dev/logos/unorouter.svg)UnoRouter

Access 23 UnoRouter models through Mastra's model router. Authentication is handled automatically using the `UNOROUTER_API_KEY` environment variable.

Learn more in the [UnoRouter documentation](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);
}
```

> **Note:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [UnoRouter documentation](https://unorouter.com/models) for details.

## 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    |       |           |       |       |       | —          | —           |

## Advanced configuration

### Custom headers

```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"
    }
  }
});
```

### Dynamic model selection

```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";
  }
});
```