CheapestToken
Access 19 CheapestToken models through Mastra's model router. Authentication is handled automatically using the CHEAPEST_TOKEN_API_KEY environment variable.
Learn more in the CheapestToken documentation.
.env
CHEAPEST_TOKEN_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: "cheapest-token/deepseek-v4-pro-0813"
});
// 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 CheapestToken documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
cheapest-token/deepseek-v4-pro-0813 | 1.0M | $1 | $4 | |||||
cheapest-token/deepseek-v4.1-flash-1017 | 1.0M | $0.30 | $1 | |||||
cheapest-token/glm-5.3 | 1.0M | $1 | $4 | |||||
cheapest-token/glm-5.3-flash | 1.0M | $0.15 | $0.50 | |||||
cheapest-token/gpt-5.5 | 1.1M | $5 | $24 | |||||
cheapest-token/gpt-5.6-luna | 1.1M | $0.20 | $1 | |||||
cheapest-token/gpt-5.6-sol | 1.1M | $4 | $16 | |||||
cheapest-token/gpt-5.6-terra | 1.1M | $2 | $10 | |||||
cheapest-token/gpt-6-astra | 1.1M | $10 | $35 | |||||
cheapest-token/gpt-6-luna | 1.1M | $0.10 | $0.50 | |||||
cheapest-token/gpt-6-sol | 1.1M | $2 | $8 | |||||
cheapest-token/gpt-6.1-sol | 1.1M | $2 | $8 | |||||
cheapest-token/gpt-6.1-terra | 1.1M | $1 | $4 | |||||
cheapest-token/grok-4.6 | 200K | $2 | $5 | |||||
cheapest-token/grok-4.7 | 500K | $2 | $5 | |||||
cheapest-token/kimi-k3 | 1.0M | $4 | $12 | |||||
cheapest-token/minimax-m3.1-flash | 1.0M | $0.15 | $0.60 | |||||
cheapest-token/nemotron-3.5-super-vl | 1.0M | $0.30 | $0.65 | |||||
cheapest-token/qwen3.8-max | 1.0M | $2 | $5 |
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
import { Agent } from "@mastra/core/agent";
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://api.cheapest-token.com/v1",
id: "cheapest-token/deepseek-v4-pro-0813",
apiKey: process.env.CHEAPEST_TOKEN_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});
Dynamic model selectionDirect link to Dynamic model selection
src/mastra/agents/my-agent.ts
import { Agent } from "@mastra/core/agent";
const agent = new Agent({
id: "dynamic-agent",
name: "Dynamic Agent",
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === "complex";
return useAdvanced
? "cheapest-token/qwen3.8-max"
: "cheapest-token/deepseek-v4-pro-0813";
}
});