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.
.env
ABACUS_API_KEY=your-api-key
src/mastra/agents/my-agent.ts
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 for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
abacus/claude-fable-5 | 1.0M | $10 | $50 | |||||
abacus/claude-haiku-4-5-20251001 | 200K | $1 | $5 | |||||
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-5-20250929 | 200K | $3 | $15 | |||||
abacus/claude-sonnet-4-6 | 1.0M | $3 | $15 | |||||
abacus/claude-sonnet-5 | 1.0M | $2 | $10 | |||||
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.1-flash-lite | 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 | $0.75 | $4 | |||||
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-mini | 128K | $0.15 | $0.60 | |||||
abacus/gpt-5 | 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.2 | 400K | $2 | $14 | |||||
abacus/gpt-5.3-codex | 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 | $0.20 | $1 | |||||
abacus/gpt-5.6-sol | 1.0M | $4 | $20 | |||||
abacus/gpt-5.6-terra | 1.0M | $2 | $12 | |||||
abacus/grok-4.3 | 1.0M | $1 | $3 | |||||
abacus/grok-4.5 | 500K | $2 | $6 | |||||
abacus/grok-4.6 | 500K | $2 | $6 | |||||
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 | $80 | |||||
abacus/o4-mini | 200K | $1 | $4 | |||||
abacus/openai/gpt-oss-120b | 128K | $0.04 | $0.17 | |||||
abacus/Qwen/Qwen3-32B | 131K | $0.08 | $0.28 | |||||
abacus/Qwen/Qwen3-Coder-480B-A35B-Instruct | 262K | $0.38 | $2 | |||||
abacus/Qwen/Qwen3.6-27B | 262K | $0.32 | $3 | |||||
abacus/qwen3.7-max | 1.0M | $3 | $8 | |||||
abacus/qwen3.8-max | 1.0M | $2 | $6 | |||||
abacus/route-llm | 128K | $2 | $10 | |||||
abacus/thinkingmachines/Inkling | 262K | $4 | $9 | |||||
abacus/zai-org/GLM-4.6 | 203K | $0.55 | $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 |
Model availability, capabilities, context windows, and pricing are sourced from models.dev and may change.
Advanced configurationDirect link to Advanced configuration
Custom headersDirect link to Custom headers
src/mastra/agents/my-agent.ts
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 selectionDirect link to Dynamic model selection
src/mastra/agents/my-agent.ts
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";
}
});