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

# ![Abacus logo](https://models.dev/logos/abacus.svg)Abacus

Access 108 Abacus models through Mastra's model router. Authentication is handled automatically using the `ABACUS_API_KEY` environment variable.

Learn more in the [Abacus documentation](https://abacus.ai).

```bash
ABACUS_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: "abacus/MiniMaxAI/MiniMax-M2.7"
});

// 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 [Abacus documentation](https://abacus.ai) for details.

## Models

| Model                                                      | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
| ---------------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
| `abacus/claude-3-7-sonnet-20250219`                        | 200K    |       |           |       |       |       | $3         | $15         |
| `abacus/claude-fable-5`                                    | 1.0M    |       |           |       |       |       | $10        | $50         |
| `abacus/claude-haiku-4-5-20251001`                         | 200K    |       |           |       |       |       | $1         | $5          |
| `abacus/claude-opus-4-1-20250805`                          | 200K    |       |           |       |       |       | $15        | $75         |
| `abacus/claude-opus-4-20250514`                            | 200K    |       |           |       |       |       | $15        | $75         |
| `abacus/claude-opus-4-5-20251101`                          | 200K    |       |           |       |       |       | $5         | $25         |
| `abacus/claude-opus-4-6`                                   | 1.0M    |       |           |       |       |       | $5         | $25         |
| `abacus/claude-opus-4-7`                                   | 1.0M    |       |           |       |       |       | $5         | $25         |
| `abacus/claude-opus-4-8`                                   | 1.0M    |       |           |       |       |       | $5         | $25         |
| `abacus/claude-opus-5`                                     | 1.0M    |       |           |       |       |       | $5         | $25         |
| `abacus/claude-sonnet-4-20250514`                          | 200K    |       |           |       |       |       | $3         | $15         |
| `abacus/claude-sonnet-4-5-20250929`                        | 200K    |       |           |       |       |       | $3         | $15         |
| `abacus/claude-sonnet-4-6`                                 | 1.0M    |       |           |       |       |       | $3         | $15         |
| `abacus/claude-sonnet-5`                                   | 1.0M    |       |           |       |       |       | $3         | $15         |
| `abacus/deepseek-ai/DeepSeek-R1`                           | 128K    |       |           |       |       |       | $3         | $7          |
| `abacus/deepseek-ai/DeepSeek-V3.1-Terminus`                | 128K    |       |           |       |       |       | $0.27      | $1          |
| `abacus/deepseek-ai/DeepSeek-V3.2`                         | 128K    |       |           |       |       |       | $0.27      | $0.40       |
| `abacus/deepseek-ai/DeepSeek-V4-Flash`                     | 1.0M    |       |           |       |       |       | $0.14      | $0.28       |
| `abacus/deepseek-ai/DeepSeek-V4-Pro`                       | 1.0M    |       |           |       |       |       | $2         | $3          |
| `abacus/deepseek/deepseek-v3.1`                            | 128K    |       |           |       |       |       | $0.55      | $2          |
| `abacus/gemini-2.5-flash`                                  | 1.0M    |       |           |       |       |       | $0.30      | $3          |
| `abacus/gemini-2.5-flash-image`                            | 33K     |       |           |       |       |       | $0.30      | $30         |
| `abacus/gemini-2.5-pro`                                    | 1.0M    |       |           |       |       |       | $1         | $10         |
| `abacus/gemini-3-flash-preview`                            | 1.0M    |       |           |       |       |       | $0.50      | $3          |
| `abacus/gemini-3-pro-image`                                | 66K     |       |           |       |       |       | $2         | $12         |
| `abacus/gemini-3-pro-image-preview`                        | 66K     |       |           |       |       |       | $2         | $12         |
| `abacus/gemini-3.1-flash-image`                            | 1.0M    |       |           |       |       |       | $0.50      | $3          |
| `abacus/gemini-3.1-flash-image-preview`                    | 1.0M    |       |           |       |       |       | $0.50      | $3          |
| `abacus/gemini-3.1-flash-lite`                             | 1.0M    |       |           |       |       |       | $0.25      | $2          |
| `abacus/gemini-3.1-flash-lite-preview`                     | 1.0M    |       |           |       |       |       | $0.25      | $2          |
| `abacus/gemini-3.1-pro-preview`                            | 1.0M    |       |           |       |       |       | $2         | $12         |
| `abacus/gemini-3.5-flash`                                  | 1.0M    |       |           |       |       |       | $2         | $9          |
| `abacus/gemini-3.5-flash-lite`                             | 1.0M    |       |           |       |       |       | $0.30      | $3          |
| `abacus/gemini-3.6-flash`                                  | 1.0M    |       |           |       |       |       | $2         | $8          |
| `abacus/gemini-3.7-flash`                                  | 1.0M    |       |           |       |       |       | $0.75      | $4          |
| `abacus/google/gemma-4-31b-it`                             | 262K    |       |           |       |       |       | $0.14      | $0.40       |
| `abacus/gpt-4.1`                                           | 1.0M    |       |           |       |       |       | $2         | $8          |
| `abacus/gpt-4.1-mini`                                      | 1.0M    |       |           |       |       |       | $0.40      | $2          |
| `abacus/gpt-4.1-nano`                                      | 1.0M    |       |           |       |       |       | $0.10      | $0.40       |
| `abacus/gpt-4o`                                            | 128K    |       |           |       |       |       | $3         | $10         |
| `abacus/gpt-4o-2024-11-20`                                 | 128K    |       |           |       |       |       | $3         | $10         |
| `abacus/gpt-4o-mini`                                       | 128K    |       |           |       |       |       | $0.15      | $0.60       |
| `abacus/gpt-5`                                             | 400K    |       |           |       |       |       | $1         | $10         |
| `abacus/gpt-5-codex`                                       | 400K    |       |           |       |       |       | $1         | $10         |
| `abacus/gpt-5-mini`                                        | 400K    |       |           |       |       |       | $0.25      | $2          |
| `abacus/gpt-5-nano`                                        | 400K    |       |           |       |       |       | $0.05      | $0.40       |
| `abacus/gpt-5.1`                                           | 400K    |       |           |       |       |       | $1         | $10         |
| `abacus/gpt-5.1-chat-latest`                               | 400K    |       |           |       |       |       | $1         | $10         |
| `abacus/gpt-5.1-codex`                                     | 400K    |       |           |       |       |       | $1         | $10         |
| `abacus/gpt-5.1-codex-max`                                 | 400K    |       |           |       |       |       | $1         | $10         |
| `abacus/gpt-5.2`                                           | 400K    |       |           |       |       |       | $2         | $14         |
| `abacus/gpt-5.2-chat-latest`                               | 400K    |       |           |       |       |       | $2         | $14         |
| `abacus/gpt-5.2-codex`                                     | 400K    |       |           |       |       |       | $2         | $14         |
| `abacus/gpt-5.3-chat-latest`                               | 400K    |       |           |       |       |       | $2         | $14         |
| `abacus/gpt-5.3-codex`                                     | 400K    |       |           |       |       |       | $2         | $14         |
| `abacus/gpt-5.3-codex-xhigh`                               | 400K    |       |           |       |       |       | $2         | $14         |
| `abacus/gpt-5.4`                                           | 400K    |       |           |       |       |       | $3         | $15         |
| `abacus/gpt-5.4-mini`                                      | 400K    |       |           |       |       |       | $0.75      | $5          |
| `abacus/gpt-5.4-nano`                                      | 400K    |       |           |       |       |       | $0.20      | $1          |
| `abacus/gpt-5.5`                                           | 1.0M    |       |           |       |       |       | $5         | $30         |
| `abacus/gpt-5.6-luna`                                      | 1.0M    |       |           |       |       |       | $1         | $6          |
| `abacus/gpt-5.6-sol`                                       | 1.0M    |       |           |       |       |       | $5         | $30         |
| `abacus/gpt-5.6-terra`                                     | 1.0M    |       |           |       |       |       | $3         | $15         |
| `abacus/grok-4-0709`                                       | 256K    |       |           |       |       |       | $3         | $15         |
| `abacus/grok-4-1-fast-non-reasoning`                       | 2.0M    |       |           |       |       |       | $0.20      | $0.50       |
| `abacus/grok-4-fast-non-reasoning`                         | 2.0M    |       |           |       |       |       | $0.20      | $0.50       |
| `abacus/grok-4.3`                                          | 1.0M    |       |           |       |       |       | $1         | $3          |
| `abacus/grok-4.5`                                          | 500K    |       |           |       |       |       | $2         | $6          |
| `abacus/grok-4.6`                                          | 500K    |       |           |       |       |       | $2         | $6          |
| `abacus/grok-code-fast-1`                                  | 256K    |       |           |       |       |       | $0.20      | $2          |
| `abacus/kimi-k2-turbo-preview`                             | 256K    |       |           |       |       |       | $0.15      | $8          |
| `abacus/kimi-k2.5`                                         | 262K    |       |           |       |       |       | $0.60      | $3          |
| `abacus/llama-3.3-70b-versatile`                           | 128K    |       |           |       |       |       | $0.59      | $0.79       |
| `abacus/meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8` | 1.0M    |       |           |       |       |       | $0.14      | $0.59       |
| `abacus/meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo`     | 128K    |       |           |       |       |       | $4         | $4          |
| `abacus/meta-llama/Meta-Llama-3.1-8B-Instruct`             | 128K    |       |           |       |       |       | $0.02      | $0.05       |
| `abacus/meta-llama/Meta-Llama-3.3-70B-Instruct`            | 131K    |       |           |       |       |       | $0.59      | $0.79       |
| `abacus/mimo-v2-pro`                                       | 1.0M    |       |           |       |       |       | $1         | $3          |
| `abacus/MiniMaxAI/MiniMax-M2.7`                            | 205K    |       |           |       |       |       | $0.30      | $1          |
| `abacus/MiniMaxAI/MiniMax-M3`                              | 1.0M    |       |           |       |       |       | $0.30      | $1          |
| `abacus/moonshotai/Kimi-K2.6`                              | 262K    |       |           |       |       |       | $0.95      | $4          |
| `abacus/moonshotai/Kimi-K2.7-Code`                         | 262K    |       |           |       |       |       | $0.95      | $4          |
| `abacus/moonshotai/Kimi-K3`                                | 1.0M    |       |           |       |       |       | $3         | $15         |
| `abacus/muse-spark-1.1`                                    | 1.0M    |       |           |       |       |       | $1         | $4          |
| `abacus/muse-spark-1.2`                                    | 1.0M    |       |           |       |       |       | $1         | $4          |
| `abacus/o3`                                                | 200K    |       |           |       |       |       | $2         | $8          |
| `abacus/o3-mini`                                           | 200K    |       |           |       |       |       | $1         | $4          |
| `abacus/o3-pro`                                            | 200K    |       |           |       |       |       | $20        | $40         |
| `abacus/o4-mini`                                           | 200K    |       |           |       |       |       | $1         | $4          |
| `abacus/openai/gpt-oss-120b`                               | 128K    |       |           |       |       |       | $0.08      | $0.44       |
| `abacus/qwen-2.5-coder-32b`                                | 128K    |       |           |       |       |       | $0.79      | $0.79       |
| `abacus/Qwen/Qwen2.5-72B-Instruct`                         | 128K    |       |           |       |       |       | $0.11      | $0.38       |
| `abacus/Qwen/Qwen3-235B-A22B-Instruct-2507`                | 262K    |       |           |       |       |       | $0.13      | $0.60       |
| `abacus/Qwen/Qwen3-32B`                                    | 131K    |       |           |       |       |       | $0.09      | $0.29       |
| `abacus/Qwen/Qwen3-Coder-480B-A35B-Instruct`               | 262K    |       |           |       |       |       | $0.29      | $1          |
| `abacus/Qwen/Qwen3.6-27B`                                  | 262K    |       |           |       |       |       | $0.32      | $3          |
| `abacus/Qwen/QwQ-32B`                                      | 33K     |       |           |       |       |       | $0.40      | $0.40       |
| `abacus/qwen3-max`                                         | 131K    |       |           |       |       |       | $1         | $6          |
| `abacus/qwen3.7-max`                                       | 1.0M    |       |           |       |       |       | $3         | $8          |
| `abacus/qwen3.8-max`                                       | 1.0M    |       |           |       |       |       | $2         | $6          |
| `abacus/route-llm`                                         | 128K    |       |           |       |       |       | $3         | $15         |
| `abacus/thinkingmachines/Inkling`                          | 262K    |       |           |       |       |       | $4         | $9          |
| `abacus/zai-org/GLM-4.5`                                   | 131K    |       |           |       |       |       | $0.60      | $2          |
| `abacus/zai-org/GLM-4.6`                                   | 203K    |       |           |       |       |       | $0.60      | $2          |
| `abacus/zai-org/GLM-4.7`                                   | 205K    |       |           |       |       |       | $0.60      | $2          |
| `abacus/zai-org/GLM-5`                                     | 205K    |       |           |       |       |       | $1         | $3          |
| `abacus/zai-org/GLM-5.1`                                   | 205K    |       |           |       |       |       | $1         | $4          |
| `abacus/zai-org/GLM-5.2`                                   | 1.0M    |       |           |       |       |       | $1         | $4          |

## Advanced configuration

### Custom headers

```typescript
const agent = new Agent({
  id: "custom-agent",
  name: "custom-agent",
  model: {
    url: "https://routellm.abacus.ai/v1",
    id: "abacus/MiniMaxAI/MiniMax-M2.7",
    apiKey: process.env.ABACUS_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
      ? "abacus/zai-org/GLM-5.2"
      : "abacus/MiniMaxAI/MiniMax-M2.7";
  }
});
```