Token Harbor
Access 91 Token Harbor models through Mastra's model router. Authentication is handled automatically using the TOKENHARBOR_API_KEY environment variable.
Learn more in the Token Harbor documentation.
.env
TOKENHARBOR_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: "tokenharbor/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);
}
note
Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the Token Harbor documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
tokenharbor/claude-fable-5 | 1.0M | $10 | $50 | |||||
tokenharbor/claude-fable-5.1 | 1.0M | $10 | $50 | |||||
tokenharbor/claude-fable-5.2 | 1.0M | $8 | $40 | |||||
tokenharbor/claude-fable-5.2-fast | 1.0M | $16 | $80 | |||||
tokenharbor/claude-haiku-5.5 | 1.0M | $0.10 | $0.50 | |||||
tokenharbor/claude-opus-4.8 | 1.0M | $5 | $25 | |||||
tokenharbor/claude-opus-5 | 1.0M | $5 | $25 | |||||
tokenharbor/claude-opus-5-fast | 1.0M | $10 | $50 | |||||
tokenharbor/claude-opus-5.5 | 1.0M | $4 | $20 | |||||
tokenharbor/claude-opus-5.5-fast | 1.0M | $8 | $40 | |||||
tokenharbor/claude-sonnet-4.6 | 1.0M | $3 | $15 | |||||
tokenharbor/claude-sonnet-5 | 1.0M | $2 | $10 | |||||
tokenharbor/claude-sonnet-5.5 | 1.0M | $2 | $10 | |||||
tokenharbor/deepseek-r1-0528 | 128K | $1 | $5 | |||||
tokenharbor/deepseek-v3.2 | 128K | $0.62 | $2 | |||||
tokenharbor/deepseek-v4-flash | 1.0M | $0.44 | $1 | |||||
tokenharbor/deepseek-v4-flash:free | 1.0M | — | — | |||||
tokenharbor/deepseek-v4-pro | 1.0M | $1 | $4 | |||||
tokenharbor/deepseek-v4.1-flash | 1.0M | $0.30 | $1 | |||||
tokenharbor/deepseek-v4.1-flash-1017 | 1.0M | $0.15 | $0.60 | |||||
tokenharbor/deepseek-v4.1-flash-1017-fast | 1.0M | $0.60 | $2 | |||||
tokenharbor/deepseek-v4.1-flash-1017-ultrafast | 1.0M | $1 | $5 | |||||
tokenharbor/deepseek-v4.1-flash:free | 1.0M | — | — | |||||
tokenharbor/gemini-3.6-flash | 1.0M | $0.75 | $4 | |||||
tokenharbor/gemini-3.7-flash | 1.0M | $0.75 | $4 | |||||
tokenharbor/gemini-3.8-flash | 1.0M | $0.75 | $4 | |||||
tokenharbor/gemini-4-argon | 1.0M | $4 | $20 | |||||
tokenharbor/gemini-4-carbon | 1.0M | $4 | $20 | |||||
tokenharbor/gemini-4-hydrogen | 1.0M | $2 | $8 | |||||
tokenharbor/gemini-4-neon | 1.0M | $3 | $15 | |||||
tokenharbor/gemini-4-neon-fast | 1.0M | $5 | $27 | |||||
tokenharbor/glm-5.1 | 203K | $1 | $4 | |||||
tokenharbor/glm-5.2 | 1.0M | $1 | $4 | |||||
tokenharbor/glm-5.3 | 200K | $1 | $4 | |||||
tokenharbor/glm-5.3-fast | 1.0M | $2 | $7 | |||||
tokenharbor/glm-5.3-flash | 1.0M | $0.15 | $0.50 | |||||
tokenharbor/glm-5.3-flashx | 1.0M | $0.37 | $1 | |||||
tokenharbor/glm-5.3-flashx-legal | 1.0M | $0.37 | $1 | |||||
tokenharbor/gpt-5.6-luna | 1.1M | $0.20 | $1 | |||||
tokenharbor/gpt-5.6-luna-fast | 1.1M | $0.40 | $2 | |||||
tokenharbor/gpt-5.6-sol | 1.1M | $4 | $20 | |||||
tokenharbor/gpt-5.6-sol-fast | 1.1M | $8 | $40 | |||||
tokenharbor/gpt-5.6-terra | 1.1M | $2 | $12 | |||||
tokenharbor/gpt-5.6-terra-fast | 1.1M | $4 | $24 | |||||
tokenharbor/gpt-6-astra | 1.1M | $10 | $50 | |||||
tokenharbor/gpt-6-astra-fast | 1.1M | $20 | $100 | |||||
tokenharbor/gpt-6-luna | 1.1M | $0.10 | $0.50 | |||||
tokenharbor/gpt-6-luna-fast | 1.1M | $0.20 | $1 | |||||
tokenharbor/gpt-6-sol | 1.1M | $2 | $10 | |||||
tokenharbor/gpt-6-sol-fast | 1.1M | $4 | $20 | |||||
tokenharbor/gpt-6.1-sol | 1.1M | $2 | $10 | |||||
tokenharbor/gpt-6.1-sol-fast | 1.1M | $4 | $20 | |||||
tokenharbor/gpt-6.1-terra | 1.1M | $1 | $5 | |||||
tokenharbor/gpt-6.1-terra-fast | 1.1M | $2 | $10 | |||||
tokenharbor/gpt-6.2-astra | 1.1M | $8 | $40 | |||||
tokenharbor/gpt-6.2-astra-fast | 1.1M | $16 | $80 | |||||
tokenharbor/gpt-6.2-sol | 1.1M | $2 | $10 | |||||
tokenharbor/gpt-6.2-sol-fast | 1.1M | $4 | $20 | |||||
tokenharbor/grok-4.5 | 500K | $2 | $6 | |||||
tokenharbor/grok-4.6 | 500K | $2 | $6 | |||||
tokenharbor/grok-4.7 | 500K | $2 | $6 | |||||
tokenharbor/inkling-2-small | 1.0M | $0.30 | $1 | |||||
tokenharbor/kimi-k2.6 | 262K | $0.95 | $4 | |||||
tokenharbor/kimi-k3 | 1.0M | $3 | $15 | |||||
tokenharbor/kimi-k3-fast | 1.0M | $6 | $23 | |||||
tokenharbor/kimi-k3.1-pro | 1.0M | $2 | $10 | |||||
tokenharbor/ling-3.1-flash | 262K | $0.30 | $0.90 | |||||
tokenharbor/ling-3.1-flash-1019 | 1.0M | $0.30 | $0.90 | |||||
tokenharbor/mimo-v2.5 | 1.0M | $0.14 | $0.28 | |||||
tokenharbor/mimo-v2.5-pro | 1.0M | $0.43 | $0.87 | |||||
tokenharbor/mimo-v2.5:free | 1.0M | — | — | |||||
tokenharbor/mimo-v2.6-flash | 1.0M | $0.14 | $0.28 | |||||
tokenharbor/mimo-v2.6-flash:free | 1.0M | — | — | |||||
tokenharbor/mimo-v2.6-pro | 1.0M | $0.43 | $0.87 | |||||
tokenharbor/minimax-m3.1-flash | 1.0M | $0.15 | $0.60 | |||||
tokenharbor/mistral-large-2512 | 262K | $0.50 | $2 | |||||
tokenharbor/mistral-large-4 | 1.0M | $0.70 | $2 | |||||
tokenharbor/muse-ember | 1.0M | $0.10 | $0.50 | |||||
tokenharbor/muse-spark-1-3 | 1.0M | $1 | $4 | |||||
tokenharbor/muse-spark-1.1 | 1.0M | $1 | $4 | |||||
tokenharbor/muse-spark-1.2 | 1.0M | $1 | $4 | |||||
tokenharbor/muse-wonder-1.0 | 1.0M | $4 | $20 | |||||
tokenharbor/qwen3.5-27b | 262K | $0.30 | $2 | |||||
tokenharbor/qwen3.6-27b | 262K | $0.60 | $4 | |||||
tokenharbor/qwen3.6-flash | 1.0M | $0.25 | $2 | |||||
tokenharbor/qwen3.7-flash | 1.0M | $0.03 | $0.13 | |||||
tokenharbor/qwen3.7-max | 1.0M | $3 | $8 | |||||
tokenharbor/qwen3.8-27b | 1.0M | $0.35 | $2 | |||||
tokenharbor/qwen3.8-flash | 1.0M | $0.15 | $0.47 | |||||
tokenharbor/qwen3.8-max | 1.0M | $2 | $6 | |||||
tokenharbor/qwen4-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://tokenharbor.ai/v1",
id: "tokenharbor/claude-fable-5",
apiKey: process.env.TOKENHARBOR_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
? "tokenharbor/qwen4-max"
: "tokenharbor/claude-fable-5";
}
});