AIHubMix
Access 23 AIHubMix models through Mastra’s model router. Authentication is handled automatically using the AIHUBMIX_API_KEY
environment variable.
Learn more in the AIHubMix documentation .
AIHUBMIX_API_KEY=your-api-key
import { Agent } from "@mastra/core";
const agent = new Agent({
name: "my-agent",
instructions: "You are a helpful assistant",
model: "aihubmix/DeepSeek-V3.2-Exp"
});
// 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);
}
Mastra uses the OpenAI-compatible /chat/completions
endpoint. Some provider-specific features may not be available. Check the AIHubMix documentation for details.
Models
Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
---|---|---|---|---|---|---|---|---|
aihubmix/DeepSeek-V3.2-Exp | 163K | $0.27 | $0.41 | |||||
aihubmix/gpt-5 | 400K | $5 | $20 | |||||
aihubmix/Kimi-K2-0905 | 262K | $0.55 | $2 | |||||
aihubmix/gpt-4o-2024-11-20 | 128K | $3 | $10 | |||||
aihubmix/claude-haiku-4-5 | 200K | $0.80 | $4 | |||||
aihubmix/qwen3-coder-480b-a35b-instruct | 262K | $0.82 | $3 | |||||
aihubmix/gpt-5-nano | 128K | $0.50 | $2 | |||||
aihubmix/o4-mini | 200K | $2 | $6 | |||||
aihubmix/gpt-5-codex | 400K | — | — | |||||
aihubmix/claude-opus-4-1 | 200K | $17 | $83 | |||||
aihubmix/qwen3-235b-a22b-instruct-2507 | 262K | $0.15 | $0.60 | |||||
aihubmix/qwen3-235b-a22b-thinking-2507 | 262K | $0.15 | $0.60 | |||||
aihubmix/gemini-2.5-flash | 1.0M | $0.07 | $0.30 | |||||
aihubmix/glm-4.6 | 205K | $0.60 | $2 | |||||
aihubmix/gemini-2.5-pro | 2.0M | $1 | $5 | |||||
aihubmix/gpt-4.1 | 1.0M | $2 | $8 | |||||
aihubmix/gpt-4.1-mini | 1.0M | $0.40 | $2 | |||||
aihubmix/gpt-4o | 128K | $3 | $10 | |||||
aihubmix/gpt-5-pro | 400K | $7 | $28 | |||||
aihubmix/gpt-5-mini | 200K | $2 | $6 | |||||
aihubmix/claude-sonnet-4-5 | 200K | $3 | $15 | |||||
aihubmix/gpt-4.1-nano | 1.0M | $0.10 | $0.40 | |||||
aihubmix/DeepSeek-V3.2-Exp-Think | 131K | $0.27 | $0.41 |
Advanced Configuration
Custom Headers
const agent = new Agent({
name: "custom-agent",
model: {
url: "https://api.aihubmix.com/v1",
modelId: "DeepSeek-V3.2-Exp",
apiKey: process.env.AIHUBMIX_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});
Dynamic Model Selection
const agent = new Agent({
name: "dynamic-agent",
model: ({ runtimeContext }) => {
const useAdvanced = runtimeContext.task === "complex";
return useAdvanced
? "aihubmix/qwen3-coder-480b-a35b-instruct"
: "aihubmix/DeepSeek-V3.2-Exp";
}
});