CrossModel
Access 37 CrossModel models through Mastra's model router. Authentication is handled automatically using the CROSSMODEL_API_KEY environment variable.
Learn more in the CrossModel documentation.
.env
CROSSMODEL_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: "crossmodel/anthropic/claude-fable-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);
}
info
Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the CrossModel documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
crossmodel/anthropic/claude-fable-5 | 1.0M | $10 | $50 | |||||
crossmodel/anthropic/claude-haiku-4-5 | 200K | $1 | $5 | |||||
crossmodel/anthropic/claude-opus-4-7 | 1.0M | $5 | $25 | |||||
crossmodel/anthropic/claude-opus-4-8 | 1.0M | $5 | $25 | |||||
crossmodel/anthropic/claude-sonnet-4-6 | 1.0M | $3 | $15 | |||||
crossmodel/anthropic/claude-sonnet-5 | 1.0M | $2 | $10 | |||||
crossmodel/deepseek/deepseek-v4-flash | 1.0M | $0.16 | $0.32 | |||||
crossmodel/deepseek/deepseek-v4-pro | 1.0M | $0.47 | $0.94 | |||||
crossmodel/gemini/gemini-2.5-flash | 1.0M | $0.30 | $3 | |||||
crossmodel/gemini/gemini-2.5-flash-lite | 1.0M | $0.10 | $0.40 | |||||
crossmodel/gemini/gemini-2.5-pro | 1.0M | $1 | $10 | |||||
crossmodel/gemini/gemini-3-flash-preview | 1.0M | $0.50 | $3 | |||||
crossmodel/gemini/gemini-3.1-pro-preview | 1.0M | $2 | $12 | |||||
crossmodel/gemini/gemini-3.5-flash | 1.0M | $2 | $9 | |||||
crossmodel/minimax/minimax-m2.7 | 205K | $0.33 | $1 | |||||
crossmodel/minimax/minimax-m3 | 1.0M | $0.33 | $1 | |||||
crossmodel/moonshot/kimi-k2.5 | 262K | $0.62 | $3 | |||||
crossmodel/moonshot/kimi-k2.6 | 262K | $1 | $4 | |||||
crossmodel/moonshot/kimi-k2.7-code | 262K | $1 | $4 | |||||
crossmodel/openai/gpt-4o-mini | 128K | $0.15 | $0.60 | |||||
crossmodel/openai/gpt-5.4 | 1.1M | $3 | $15 | |||||
crossmodel/openai/gpt-5.4-mini | 400K | $0.75 | $5 | |||||
crossmodel/openai/gpt-5.4-nano | 400K | $0.20 | $1 | |||||
crossmodel/openai/gpt-5.5 | 1.1M | $5 | $30 | |||||
crossmodel/openai/gpt-5.5-pro | 1.1M | $30 | $180 | |||||
crossmodel/qwen/qwen3.6-flash | 1.0M | $0.19 | $1 | |||||
crossmodel/qwen/qwen3.6-plus | 1.0M | $0.32 | $2 | |||||
crossmodel/qwen/qwen3.7-max | 1.0M | $2 | $6 | |||||
crossmodel/qwen/qwen3.7-plus | 1.0M | $0.32 | $1 | |||||
crossmodel/tencent/hy3-preview | 256K | $0.19 | $0.63 | |||||
crossmodel/xiaomi/mimo-v2.5 | 1.0M | $0.16 | $0.32 | |||||
crossmodel/xiaomi/mimo-v2.5-pro | 1.0M | $0.47 | $0.94 | |||||
crossmodel/z-ai/glm-4.7 | 200K | $0.47 | $2 | |||||
crossmodel/z-ai/glm-5 | 200K | $0.60 | $3 | |||||
crossmodel/z-ai/glm-5-turbo | 200K | $0.90 | $4 | |||||
crossmodel/z-ai/glm-5.1 | 200K | $1 | $4 | |||||
crossmodel/z-ai/glm-5.2 | 1.0M | $1 | $4 |
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.crossmodel.ai/v1",
id: "crossmodel/anthropic/claude-fable-5",
apiKey: process.env.CROSSMODEL_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
? "crossmodel/z-ai/glm-5.2"
: "crossmodel/anthropic/claude-fable-5";
}
});