# ![Nebius Token Factory logo](https://models.dev/logos/nebius.svg)Nebius Token Factory

Access 49 Nebius Token Factory models through Mastra's model router. Authentication is handled automatically using the `NEBIUS_API_KEY` environment variable.

Learn more in the [Nebius Token Factory documentation](https://docs.tokenfactory.nebius.com/).

```bash
NEBIUS_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: "nebius/BAAI/bge-en-icl"
});

// 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 [Nebius Token Factory documentation](https://docs.tokenfactory.nebius.com/) for details.

## Models

| Model                                               | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
| --------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
| `nebius/BAAI/bge-en-icl`                            | 33K     |       |           |       |       |       | $0.01      | —           |
| `nebius/BAAI/bge-multilingual-gemma2`               | 8K      |       |           |       |       |       | $0.01      | —           |
| `nebius/black-forest-labs/flux-dev`                 | 77      |       |           |       |       |       | —          | —           |
| `nebius/black-forest-labs/flux-schnell`             | 77      |       |           |       |       |       | —          | —           |
| `nebius/deepseek-ai/DeepSeek-R1-0528`               | 128K    |       |           |       |       |       | $0.80      | $2          |
| `nebius/deepseek-ai/DeepSeek-R1-0528-fast`          | 131K    |       |           |       |       |       | $2         | $6          |
| `nebius/deepseek-ai/DeepSeek-V3-0324`               | 128K    |       |           |       |       |       | $0.50      | $2          |
| `nebius/deepseek-ai/DeepSeek-V3-0324-fast`          | 128K    |       |           |       |       |       | $0.75      | $2          |
| `nebius/deepseek-ai/DeepSeek-V3.2`                  | 163K    |       |           |       |       |       | $0.30      | $0.45       |
| `nebius/google/gemma-2-2b-it`                       | 8K      |       |           |       |       |       | $0.02      | $0.06       |
| `nebius/google/gemma-2-9b-it-fast`                  | 8K      |       |           |       |       |       | $0.03      | $0.09       |
| `nebius/google/gemma-3-27b-it`                      | 110K    |       |           |       |       |       | $0.10      | $0.30       |
| `nebius/google/gemma-3-27b-it-fast`                 | 110K    |       |           |       |       |       | $0.20      | $0.60       |
| `nebius/intfloat/e5-mistral-7b-instruct`            | 33K     |       |           |       |       |       | $0.01      | —           |
| `nebius/meta-llama/Llama-3.3-70B-Instruct`          | 128K    |       |           |       |       |       | $0.13      | $0.40       |
| `nebius/meta-llama/Llama-3.3-70B-Instruct-fast`     | 128K    |       |           |       |       |       | $0.25      | $0.75       |
| `nebius/meta-llama/Llama-Guard-3-8B`                | 8K      |       |           |       |       |       | $0.02      | $0.06       |
| `nebius/meta-llama/Meta-Llama-3.1-8B-Instruct`      | 128K    |       |           |       |       |       | $0.02      | $0.06       |
| `nebius/meta-llama/Meta-Llama-3.1-8B-Instruct-fast` | 128K    |       |           |       |       |       | $0.03      | $0.09       |
| `nebius/MiniMaxAI/MiniMax-M2.1`                     | 128K    |       |           |       |       |       | $0.30      | $1          |
| `nebius/moonshotai/Kimi-K2-Instruct`                | 200K    |       |           |       |       |       | $0.50      | $2          |
| `nebius/moonshotai/Kimi-K2-Thinking`                | 128K    |       |           |       |       |       | $0.60      | $3          |
| `nebius/moonshotai/Kimi-K2.5`                       | 256K    |       |           |       |       |       | $0.50      | $3          |
| `nebius/moonshotai/Kimi-K2.5-fast`                  | 256K    |       |           |       |       |       | $0.50      | $3          |
| `nebius/NousResearch/Hermes-4-405B`                 | 128K    |       |           |       |       |       | $1         | $3          |
| `nebius/NousResearch/Hermes-4-70B`                  | 128K    |       |           |       |       |       | $0.13      | $0.40       |
| `nebius/nvidia/Llama-3_1-Nemotron-Ultra-253B-v1`    | 128K    |       |           |       |       |       | $0.60      | $2          |
| `nebius/nvidia/nemotron-3-super-120b-a12b`          | 256K    |       |           |       |       |       | $0.30      | $0.90       |
| `nebius/nvidia/Nemotron-Nano-V2-12b`                | 32K     |       |           |       |       |       | $0.07      | $0.20       |
| `nebius/nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B`      | 32K     |       |           |       |       |       | $0.06      | $0.24       |
| `nebius/openai/gpt-oss-120b`                        | 128K    |       |           |       |       |       | $0.15      | $0.60       |
| `nebius/openai/gpt-oss-20b`                         | 128K    |       |           |       |       |       | $0.05      | $0.20       |
| `nebius/PrimeIntellect/INTELLECT-3`                 | 128K    |       |           |       |       |       | $0.20      | $1          |
| `nebius/Qwen/Qwen2.5-Coder-7B-fast`                 | 128K    |       |           |       |       |       | $0.03      | $0.09       |
| `nebius/Qwen/Qwen2.5-VL-72B-Instruct`               | 128K    |       |           |       |       |       | $0.25      | $0.75       |
| `nebius/Qwen/Qwen3-235B-A22B-Instruct-2507`         | 262K    |       |           |       |       |       | $0.20      | $0.60       |
| `nebius/Qwen/Qwen3-235B-A22B-Thinking-2507`         | 262K    |       |           |       |       |       | $0.20      | $0.80       |
| `nebius/Qwen/Qwen3-30B-A3B-Instruct-2507`           | 128K    |       |           |       |       |       | $0.10      | $0.30       |
| `nebius/Qwen/Qwen3-30B-A3B-Thinking-2507`           | 128K    |       |           |       |       |       | $0.10      | $0.30       |
| `nebius/Qwen/Qwen3-32B`                             | 128K    |       |           |       |       |       | $0.10      | $0.30       |
| `nebius/Qwen/Qwen3-32B-fast`                        | 128K    |       |           |       |       |       | $0.20      | $0.60       |
| `nebius/Qwen/Qwen3-Coder-30B-A3B-Instruct`          | 128K    |       |           |       |       |       | $0.10      | $0.30       |
| `nebius/Qwen/Qwen3-Coder-480B-A35B-Instruct`        | 262K    |       |           |       |       |       | $0.40      | $2          |
| `nebius/Qwen/Qwen3-Embedding-8B`                    | 33K     |       |           |       |       |       | $0.01      | —           |
| `nebius/Qwen/Qwen3-Next-80B-A3B-Thinking`           | 128K    |       |           |       |       |       | $0.15      | $1          |
| `nebius/zai-org/GLM-4.5`                            | 128K    |       |           |       |       |       | $0.60      | $2          |
| `nebius/zai-org/GLM-4.5-Air`                        | 128K    |       |           |       |       |       | $0.20      | $1          |
| `nebius/zai-org/GLM-4.7-FP8`                        | 128K    |       |           |       |       |       | $0.40      | $2          |
| `nebius/zai-org/GLM-5`                              | 200K    |       |           |       |       |       | $1         | $3          |

## Advanced configuration

### Custom headers

```typescript
const agent = new Agent({
  id: "custom-agent",
  name: "custom-agent",
  model: {
    url: "https://api.tokenfactory.nebius.com/v1",
    id: "nebius/BAAI/bge-en-icl",
    apiKey: process.env.NEBIUS_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
      ? "nebius/zai-org/GLM-5"
      : "nebius/BAAI/bge-en-icl";
  }
});
```