Skip to main content

Abacus logoAbacus

Access 95 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);
}
info

Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the Abacus documentation for details.

Models
Direct link to Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
abacus/claude-3-7-sonnet-20250219200K$3$15
abacus/claude-fable-51.0M$10$50
abacus/claude-haiku-4-5-20251001200K$1$5
abacus/claude-opus-4-1-20250805200K$15$75
abacus/claude-opus-4-20250514200K$15$75
abacus/claude-opus-4-5-20251101200K$5$25
abacus/claude-opus-4-61.0M$5$25
abacus/claude-opus-4-71.0M$5$25
abacus/claude-opus-4-81.0M$5$25
abacus/claude-sonnet-4-20250514200K$3$15
abacus/claude-sonnet-4-5-20250929200K$3$15
abacus/claude-sonnet-4-61.0M$3$15
abacus/claude-sonnet-51.0M$3$15
abacus/deepseek-ai/DeepSeek-R1128K$3$7
abacus/deepseek-ai/DeepSeek-V3.1-Terminus128K$0.27$1
abacus/deepseek-ai/DeepSeek-V3.2128K$0.27$0.40
abacus/deepseek-ai/DeepSeek-V4-Flash1.0M$0.14$0.28
abacus/deepseek-ai/DeepSeek-V4-Pro1.0M$2$3
abacus/deepseek/deepseek-v3.1128K$0.55$2
abacus/gemini-2.5-flash1.0M$0.30$3
abacus/gemini-2.5-flash-image33K$0.30$30
abacus/gemini-2.5-pro1.0M$1$10
abacus/gemini-3-flash-preview1.0M$0.50$3
abacus/gemini-3-pro-image-preview66K$2$12
abacus/gemini-3.1-flash-image-preview1.0M$0.50$3
abacus/gemini-3.1-flash-lite1.0M$0.25$2
abacus/gemini-3.1-flash-lite-preview1.0M$0.25$2
abacus/gemini-3.1-pro-preview1.0M$2$12
abacus/gemini-3.5-flash1.0M$2$9
abacus/google/gemma-4-31b-it262K$0.14$0.40
abacus/gpt-4.11.0M$2$8
abacus/gpt-4.1-mini1.0M$0.40$2
abacus/gpt-4.1-nano1.0M$0.10$0.40
abacus/gpt-4o128K$3$10
abacus/gpt-4o-2024-11-20128K$3$10
abacus/gpt-4o-mini128K$0.15$0.60
abacus/gpt-5400K$1$10
abacus/gpt-5-codex400K$1$10
abacus/gpt-5-mini400K$0.25$2
abacus/gpt-5-nano400K$0.05$0.40
abacus/gpt-5.1400K$1$10
abacus/gpt-5.1-chat-latest400K$1$10
abacus/gpt-5.1-codex400K$1$10
abacus/gpt-5.1-codex-max400K$1$10
abacus/gpt-5.2400K$2$14
abacus/gpt-5.2-chat-latest400K$2$14
abacus/gpt-5.2-codex400K$2$14
abacus/gpt-5.3-chat-latest400K$2$14
abacus/gpt-5.3-codex400K$2$14
abacus/gpt-5.3-codex-xhigh400K$2$14
abacus/gpt-5.4400K$3$15
abacus/gpt-5.4-mini400K$0.75$5
abacus/gpt-5.4-nano400K$0.20$1
abacus/gpt-5.51.0M$5$30
abacus/gpt-5.6-luna1.0M$1$6
abacus/gpt-5.6-sol1.0M$5$30
abacus/gpt-5.6-terra1.0M$3$15
abacus/grok-4-0709256K$3$15
abacus/grok-4-1-fast-non-reasoning2.0M$0.20$0.50
abacus/grok-4-fast-non-reasoning2.0M$0.20$0.50
abacus/grok-4.31.0M$1$3
abacus/grok-4.5500K$2$6
abacus/grok-code-fast-1256K$0.20$2
abacus/kimi-k2-turbo-preview256K$0.15$8
abacus/kimi-k2.5262K$0.60$3
abacus/llama-3.3-70b-versatile128K$0.59$0.79
abacus/meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP81.0M$0.14$0.59
abacus/meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo128K$4$4
abacus/meta-llama/Meta-Llama-3.1-8B-Instruct128K$0.02$0.05
abacus/meta-llama/Meta-Llama-3.3-70B-Instruct131K$0.59$0.79
abacus/mimo-v2-pro1.0M$1$3
abacus/MiniMaxAI/MiniMax-M2.7205K$0.30$1
abacus/MiniMaxAI/MiniMax-M31.0M$0.30$1
abacus/moonshotai/Kimi-K2.6262K$0.95$4
abacus/muse-spark-1.11.0M$1$4
abacus/o3200K$2$8
abacus/o3-mini200K$1$4
abacus/o3-pro200K$20$40
abacus/o4-mini200K$1$4
abacus/openai/gpt-oss-120b128K$0.08$0.44
abacus/qwen-2.5-coder-32b128K$0.79$0.79
abacus/Qwen/Qwen2.5-72B-Instruct128K$0.11$0.38
abacus/Qwen/Qwen3-235B-A22B-Instruct-2507262K$0.13$0.60
abacus/Qwen/Qwen3-32B131K$0.09$0.29
abacus/Qwen/Qwen3-Coder-480B-A35B-Instruct262K$0.29$1
abacus/Qwen/Qwen3.6-27B262K$0.32$3
abacus/Qwen/QwQ-32B33K$0.40$0.40
abacus/qwen3-max131K$1$6
abacus/route-llm128K$3$15
abacus/zai-org/GLM-4.5131K$0.60$2
abacus/zai-org/GLM-4.6203K$0.60$2
abacus/zai-org/GLM-4.7205K$0.60$2
abacus/zai-org/GLM-5205K$1$3
abacus/zai-org/GLM-5.1205K$1$4
abacus/zai-org/GLM-5.21.0M$1$4
95 available models

Advanced configuration
Direct link to Advanced configuration

Custom headers
Direct 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 selection
Direct 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";
}
});
On this page