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

# ![Deep Infra logo](https://models.dev/logos/deepinfra.svg)Deep Infra

Access 60 Deep Infra models through Mastra's model router. Authentication is handled automatically using the `DEEPINFRA_API_KEY` environment variable.

Learn more in the [Deep Infra documentation](https://deepinfra.com/models).

```bash
DEEPINFRA_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: "deepinfra/ByteDance/Seed-2.0-code"
});

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

## Models

| Model                                                         | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
| ------------------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
| `deepinfra/ByteDance/Seed-2.0-code`                           | 256K    |       |           |       |       |       | $0.50      | $3          |
| `deepinfra/ByteDance/Seed-2.0-mini`                           | 256K    |       |           |       |       |       | $0.10      | $0.40       |
| `deepinfra/ByteDance/Seed-2.0-pro`                            | 256K    |       |           |       |       |       | $0.50      | $3          |
| `deepinfra/deepseek-ai/DeepSeek-R1-0528`                      | 164K    |       |           |       |       |       | $0.50      | $2          |
| `deepinfra/deepseek-ai/DeepSeek-V3`                           | 164K    |       |           |       |       |       | $0.32      | $0.89       |
| `deepinfra/deepseek-ai/DeepSeek-V3-0324`                      | 164K    |       |           |       |       |       | $0.24      | $0.90       |
| `deepinfra/deepseek-ai/DeepSeek-V3.1`                         | 164K    |       |           |       |       |       | $0.25      | $0.95       |
| `deepinfra/deepseek-ai/DeepSeek-V3.2`                         | 164K    |       |           |       |       |       | $0.26      | $0.38       |
| `deepinfra/deepseek-ai/DeepSeek-V4-Flash`                     | 1.0M    |       |           |       |       |       | $0.09      | $0.18       |
| `deepinfra/deepseek-ai/DeepSeek-V4-Flash-0731`                | 1.0M    |       |           |       |       |       | $0.08      | $0.18       |
| `deepinfra/deepseek-ai/DeepSeek-V4-Pro`                       | 1.0M    |       |           |       |       |       | $1         | $3          |
| `deepinfra/deepseek-ai/DeepSeek-V4-Pro-0813`                  | 1.0M    |       |           |       |       |       | $1         | $3          |
| `deepinfra/google/gemma-4-26B-A4B-it`                         | 262K    |       |           |       |       |       | $0.07      | $0.34       |
| `deepinfra/google/gemma-4-31B-it`                             | 262K    |       |           |       |       |       | $0.13      | $0.38       |
| `deepinfra/google/gemma-4-E4B-it`                             | 131K    |       |           |       |       |       | $0.02      | $0.10       |
| `deepinfra/meta-llama/Llama-3.3-70B-Instruct-Turbo`           | 131K    |       |           |       |       |       | $0.10      | $0.32       |
| `deepinfra/meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8` | 1.0M    |       |           |       |       |       | $0.20      | $0.80       |
| `deepinfra/meta-llama/Llama-4-Scout-17B-16E-Instruct`         | 328K    |       |           |       |       |       | $0.10      | $0.30       |
| `deepinfra/MiniMaxAI/MiniMax-M2.7`                            | 197K    |       |           |       |       |       | $0.25      | $1          |
| `deepinfra/MiniMaxAI/MiniMax-M3`                              | 524K    |       |           |       |       |       | $0.28      | $1          |
| `deepinfra/moonshotai/Kimi-K2.5`                              | 262K    |       |           |       |       |       | $0.45      | $2          |
| `deepinfra/moonshotai/Kimi-K2.6`                              | 262K    |       |           |       |       |       | $0.75      | $4          |
| `deepinfra/moonshotai/Kimi-K2.7-Code`                         | 262K    |       |           |       |       |       | $0.68      | $3          |
| `deepinfra/moonshotai/Kimi-K3`                                | 1.0M    |       |           |       |       |       | $3         | $14         |
| `deepinfra/nvidia/Nemotron-3-Nano-30B-A3B`                    | 262K    |       |           |       |       |       | $0.05      | $0.20       |
| `deepinfra/openai/gpt-oss-120b`                               | 131K    |       |           |       |       |       | $0.04      | $0.17       |
| `deepinfra/openai/gpt-oss-20b`                                | 131K    |       |           |       |       |       | $0.03      | $0.14       |
| `deepinfra/Qwen/Qwen3-235B-A22B-Instruct-2507`                | 262K    |       |           |       |       |       | $0.09      | $0.55       |
| `deepinfra/Qwen/Qwen3-30B-A3B`                                | 41K     |       |           |       |       |       | $0.12      | $0.50       |
| `deepinfra/Qwen/Qwen3-32B`                                    | 41K     |       |           |       |       |       | $0.08      | $0.28       |
| `deepinfra/Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo`         | 262K    |       |           |       |       |       | $0.30      | $1          |
| `deepinfra/Qwen/Qwen3-Max`                                    | 256K    |       |           |       |       |       | $1         | $6          |
| `deepinfra/Qwen/Qwen3-Next-80B-A3B-Instruct`                  | 262K    |       |           |       |       |       | $0.09      | $1          |
| `deepinfra/Qwen/Qwen3-VL-235B-A22B-Instruct`                  | 262K    |       |           |       |       |       | $0.20      | $0.88       |
| `deepinfra/Qwen/Qwen3.5-122B-A10B`                            | 262K    |       |           |       |       |       | $0.29      | $2          |
| `deepinfra/Qwen/Qwen3.5-27B`                                  | 262K    |       |           |       |       |       | $0.26      | $3          |
| `deepinfra/Qwen/Qwen3.5-35B-A3B`                              | 262K    |       |           |       |       |       | $0.14      | $1          |
| `deepinfra/Qwen/Qwen3.5-397B-A17B`                            | 262K    |       |           |       |       |       | $0.45      | $3          |
| `deepinfra/Qwen/Qwen3.5-9B`                                   | 262K    |       |           |       |       |       | $0.10      | $0.15       |
| `deepinfra/Qwen/Qwen3.6-27B`                                  | 262K    |       |           |       |       |       | $0.32      | $3          |
| `deepinfra/Qwen/Qwen3.6-35B-A3B`                              | 262K    |       |           |       |       |       | $0.10      | $0.95       |
| `deepinfra/Qwen/Qwen3.7-Max`                                  | 256K    |       |           |       |       |       | $3         | $8          |
| `deepinfra/Qwen/Qwen3.8-2.4T-A95B`                            | 262K    |       |           |       |       |       | $2         | $6          |
| `deepinfra/Qwen/Qwen3.8-27B`                                  | 262K    |       |           |       |       |       | $0.40      | $3          |
| `deepinfra/Qwen/Qwen3.8-Max`                                  | 256K    |       |           |       |       |       | $2         | $5          |
| `deepinfra/stepfun-ai/Step-3.7-Flash`                         | 262K    |       |           |       |       |       | $0.20      | $1          |
| `deepinfra/tencent/Hy3`                                       | 262K    |       |           |       |       |       | $0.14      | $0.58       |
| `deepinfra/thinkingmachines/Inkling`                          | 524K    |       |           |       |       |       | $0.95      | $4          |
| `deepinfra/thinkingmachines/Inkling-Small`                    | 524K    |       |           |       |       |       | $0.45      | $1          |
| `deepinfra/XiaomiMiMo/MiMo-V2.5`                              | 262K    |       |           |       |       |       | $0.40      | $2          |
| `deepinfra/XiaomiMiMo/MiMo-V2.5-Pro`                          | 1.0M    |       |           |       |       |       | $1         | $3          |
| `deepinfra/zai-org/GLM-4.6`                                   | 203K    |       |           |       |       |       | $0.50      | $2          |
| `deepinfra/zai-org/GLM-4.7`                                   | 203K    |       |           |       |       |       | $0.40      | $2          |
| `deepinfra/zai-org/GLM-4.7-Flash`                             | 203K    |       |           |       |       |       | $0.06      | $0.40       |
| `deepinfra/zai-org/GLM-5`                                     | 203K    |       |           |       |       |       | $0.60      | $2          |
| `deepinfra/zai-org/GLM-5.1`                                   | 203K    |       |           |       |       |       | $1         | $4          |
| `deepinfra/zai-org/GLM-5.2`                                   | 1.0M    |       |           |       |       |       | $0.75      | $2          |

## Advanced configuration

### Custom headers

```typescript
const agent = new Agent({
  id: "custom-agent",
  name: "custom-agent",
  model: {
    id: "deepinfra/ByteDance/Seed-2.0-code",
    apiKey: process.env.DEEPINFRA_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
      ? "deepinfra/zai-org/GLM-5.2"
      : "deepinfra/ByteDance/Seed-2.0-code";
  }
});
```

## 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/deepinfra) for more details.

**npm**:

```bash
npm install @ai-sdk/deepinfra
```

**pnpm**:

```bash
pnpm add @ai-sdk/deepinfra
```

**Yarn**:

```bash
yarn add @ai-sdk/deepinfra
```

**Bun**:

```bash
bun add @ai-sdk/deepinfra
```

For detailed provider-specific documentation, see the [AI SDK Deep Infra provider docs](https://ai-sdk.dev/providers/ai-sdk-providers/deepinfra).