Abacus
Access 52 Abacus models through Mastra's model router. Authentication is handled automatically using the ABACUS_API_KEY environment variable.
Learn more in the Abacus documentation.
ABACUS_API_KEY=your-api-key
import { Agent } from "@mastra/core/agent";
const agent = new Agent({
id: "my-agent",
name: "My Agent",
instructions: "You are a helpful assistant",
model: "abacus/Qwen-QwQ-32B"
});
// 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 Abacus documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
abacus/claude-3-7-sonnet-20250219 | 200K | $3 | $15 | |||||
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-sonnet-4-20250514 | 200K | $3 | $15 | |||||
abacus/claude-sonnet-4-5-20250929 | 200K | $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-deepseek-v3.1 | 128K | $0.55 | $2 | |||||
abacus/gemini-2.0-flash-001 | 1.0M | $0.10 | $0.40 | |||||
abacus/gemini-2.0-pro-exp-02-05 | 2.0M | — | — | |||||
abacus/gemini-2.5-flash | 1.0M | $0.30 | $3 | |||||
abacus/gemini-2.5-pro | 1.0M | $1 | $10 | |||||
abacus/gemini-3-flash-preview | 1.0M | $0.50 | $3 | |||||
abacus/gemini-3-pro-preview | 1.0M | $2 | $12 | |||||
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-2024-11-20 | 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.1-chat-latest | 400K | $1 | $10 | |||||
abacus/gpt-5.2 | 400K | $2 | $14 | |||||
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-code-fast-1 | 256K | $0.20 | $2 | |||||
abacus/kimi-k2-turbo-preview | 256K | $0.15 | $8 | |||||
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-70B-Instruct | 128K | $0.40 | $0.40 | |||||
abacus/meta-llama-Meta-Llama-3.1-8B-Instruct | 128K | $0.02 | $0.05 | |||||
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.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 | 128K | $0.09 | $0.29 | |||||
abacus/qwen-qwen3-coder-480b-a35b-instruct | 262K | $0.29 | $1 | |||||
abacus/qwen-qwen3-Max | 131K | $1 | $6 | |||||
abacus/Qwen-QwQ-32B | 33K | $0.40 | $0.40 | |||||
abacus/zai-org-glm-4.5 | 128K | $0.60 | $2 | |||||
abacus/zai-org-glm-4.6 | 128K | $0.60 | $2 |
Advanced ConfigurationDirect link to Advanced Configuration
Custom HeadersDirect link to Custom Headers
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://routellm.abacus.ai/v1/chat/completions",
id: "abacus/Qwen-QwQ-32B",
apiKey: process.env.ABACUS_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});
Dynamic Model SelectionDirect link to Dynamic Model Selection
const agent = new Agent({
id: "dynamic-agent",
name: "Dynamic Agent",
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === "complex";
return useAdvanced
? "abacus/zai-org-glm-4.6"
: "abacus/Qwen-QwQ-32B";
}
});