CommandCode
Access 71 CommandCode models through Mastra's model router. Authentication is handled automatically using the CMD_API_KEY environment variable.
Learn more in the CommandCode documentation.
.env
CMD_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: "commandcode/MiniMaxAI/MiniMax-M2.5"
});
// 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 CommandCode documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
commandcode/claude-fable-5 | 1.0M | $10 | $50 | |||||
commandcode/claude-fable-5-1 | 1.0M | $10 | $50 | |||||
commandcode/claude-haiku-4-5-20251001 | 200K | $1 | $5 | |||||
commandcode/claude-haiku-5-5 | 1.0M | $0.10 | $0.50 | |||||
commandcode/claude-opus-4-7 | 1.0M | $5 | $25 | |||||
commandcode/claude-opus-4-8 | 1.0M | $5 | $25 | |||||
commandcode/claude-opus-5 | 1.0M | $5 | $25 | |||||
commandcode/claude-opus-5-5 | 1.0M | $4 | $20 | |||||
commandcode/claude-sonnet-4-6 | 1.0M | $3 | $15 | |||||
commandcode/claude-sonnet-5 | 1.0M | $2 | $10 | |||||
commandcode/claude-sonnet-5-5 | 1.0M | $2 | $10 | |||||
commandcode/deepseek/deepseek-v4-flash | 1.0M | $0.15 | $0.60 | |||||
commandcode/deepseek/deepseek-v4-flash-fast | 1.0M | $0.28 | $0.56 | |||||
commandcode/deepseek/deepseek-v4-flash-vision-exp | 1.0M | $0.15 | $0.60 | |||||
commandcode/deepseek/deepseek-v4-pro | 1.0M | $0.66 | $2 | |||||
commandcode/deepseek/deepseek-v4.1-flash | 1.0M | $0.15 | $0.60 | |||||
commandcode/deepseek/deepseek-v4.1-flash-fast | 1.0M | $0.16 | $0.58 | |||||
commandcode/google/gemini-3.1-flash-lite | 1.0M | $0.25 | $2 | |||||
commandcode/google/gemini-3.5-flash | 1.0M | $2 | $9 | |||||
commandcode/google/gemini-3.5-flash-lite | 1.0M | $0.30 | $3 | |||||
commandcode/google/gemini-3.6-flash | 1.0M | $2 | $8 | |||||
commandcode/google/gemini-3.7-flash | 1.0M | $2 | $8 | |||||
commandcode/google/gemini-3.8-flash | 1.0M | $2 | $8 | |||||
commandcode/google/gemini-4-argon | 1.0M | $2 | $10 | |||||
commandcode/gpt-5.3-codex | 400K | $2 | $8 | |||||
commandcode/gpt-5.4 | 400K | $3 | $15 | |||||
commandcode/gpt-5.4-mini | 400K | $0.75 | $5 | |||||
commandcode/gpt-5.5 | 400K | $5 | $30 | |||||
commandcode/gpt-5.6-luna | 1.1M | $0.20 | $1 | |||||
commandcode/gpt-5.6-sol | 1.1M | $5 | $30 | |||||
commandcode/gpt-5.6-terra | 1.1M | $2 | $12 | |||||
commandcode/gpt-6-astra | 1.1M | $10 | $50 | |||||
commandcode/gpt-6-luna | 1.1M | $0.10 | $0.50 | |||||
commandcode/gpt-6-sol | 1.1M | $2 | $10 | |||||
commandcode/gpt-6.1-sol | 1.1M | $2 | $10 | |||||
commandcode/inclusionai/ling-3.1-flash:free | 262K | โ | โ | |||||
commandcode/meta/muse-spark-1.1 | 1.0M | $1 | $4 | |||||
commandcode/meta/muse-spark-1.2 | 1.0M | $1 | $4 | |||||
commandcode/meta/muse-spark-1.2-contributor | 1.0M | $0.10 | $0.20 | |||||
commandcode/meta/muse-spark-1.3 | 1.0M | $1 | $4 | |||||
commandcode/meta/muse-spark-1.3-contributor | 1.0M | $0.10 | $0.20 | |||||
commandcode/meta/muse-wonder-1.0 | 1.0M | $4 | $20 | |||||
commandcode/MiniMaxAI/MiniMax-M2.5 | 200K | $0.30 | $1 | |||||
commandcode/MiniMaxAI/MiniMax-M2.7 | 200K | $0.30 | $1 | |||||
commandcode/MiniMaxAI/MiniMax-M3 | 1.0M | $0.30 | $1 | |||||
commandcode/mistral/mistral-large-4 | 524K | $1 | $4 | |||||
commandcode/moonshotai/Kimi-K2.7-Code | 256K | $0.95 | $4 | |||||
commandcode/moonshotai/Kimi-K2.7-Code-Highspeed | 262K | $2 | $8 | |||||
commandcode/moonshotai/Kimi-K3 | 1.0M | $3 | $15 | |||||
commandcode/nvidia/nemotron-3-ultra-550b-a55b | 1.0M | $0.60 | $2 | |||||
commandcode/Qwen/Qwen3.8-27B | 262K | $0.40 | $3 | |||||
commandcode/Qwen/Qwen3.8-Flash | 1.0M | $0.16 | $0.47 | |||||
commandcode/Qwen/Qwen3.8-Max | 1.0M | $2 | $6 | |||||
commandcode/Qwen/Qwen3.8-Max-0902 | 1.0M | $2 | $6 | |||||
commandcode/Qwen/Qwen3.8-Omni-Flash | 1.0M | $0.15 | $0.47 | |||||
commandcode/sakana/fugu-ultra | 1.0M | $5 | $30 | |||||
commandcode/stepfun/Step-3.5-Flash | 256K | $0.09 | $0.30 | |||||
commandcode/stepfun/Step-3.7-Flash | 256K | $0.20 | $1 | |||||
commandcode/stepfun/Step-5-Preview | 1.0M | $1 | $3 | |||||
commandcode/tencent/hy3-paid | 256K | $0.14 | $0.58 | |||||
commandcode/tencent/hy4-preview | 1.0M | $0.83 | $3 | |||||
commandcode/thinkingmachines/inkling | 256K | $1 | $4 | |||||
commandcode/thinkingmachines/inkling-small | 1.0M | $0.50 | $1 | |||||
commandcode/xai/grok-4.5 | 500K | $2 | $6 | |||||
commandcode/xai/grok-4.6 | 500K | $2 | $6 | |||||
commandcode/xai/grok-4.7 | 500K | $2 | $6 | |||||
commandcode/z-ai/glm-5.3-flash | 1.0M | $0.15 | $0.50 | |||||
commandcode/z-ai/glm-5.3-flashx | 1.0M | $0.37 | $1 | |||||
commandcode/zai-org/GLM-5.2 | 1.0M | $1 | $4 | |||||
commandcode/zai-org/GLM-5.2-Fast | 1.0M | $3 | $10 | |||||
commandcode/zai-org/GLM-5.3 | 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://api.commandcode.ai/provider/v1",
id: "commandcode/MiniMaxAI/MiniMax-M2.5",
apiKey: process.env.CMD_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
? "commandcode/zai-org/GLM-5.3"
: "commandcode/MiniMaxAI/MiniMax-M2.5";
}
});