SiliconFlow
Access 72 SiliconFlow models through Mastra's model router. Authentication is handled automatically using the SILICONFLOW_API_KEY environment variable.
Learn more in the SiliconFlow documentation.
SILICONFLOW_API_KEY=your-api-key
import { Agent } from "@mastra/core";
const agent = new Agent({
name: "my-agent",
instructions: "You are a helpful assistant",
model: "siliconflow/baidu-ernie-4.5-300b-a47b"
});
// 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 SiliconFlow documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
siliconflow/baidu-ernie-4.5-300b-a47b | 131K | $0.28 | $1 | |||||
siliconflow/bytedance-seed-seed-oss-36b-instruct | 262K | $0.21 | $0.57 | |||||
siliconflow/deepseek-ai-deepseek-r1 | 164K | $0.50 | $2 | |||||
siliconflow/deepseek-ai-deepseek-r1-distill-qwen-14b | 131K | $0.10 | $0.10 | |||||
siliconflow/deepseek-ai-deepseek-r1-distill-qwen-32b | 131K | $0.18 | $0.18 | |||||
siliconflow/deepseek-ai-deepseek-r1-distill-qwen-7b | 33K | $0.05 | $0.05 | |||||
siliconflow/deepseek-ai-deepseek-v3 | 164K | $0.25 | $1 | |||||
siliconflow/deepseek-ai-deepseek-v3.1 | 164K | $0.27 | $1 | |||||
siliconflow/deepseek-ai-deepseek-v3.1-terminus | 164K | $0.27 | $1 | |||||
siliconflow/deepseek-ai-deepseek-v3.2-exp | 164K | $0.27 | $0.41 | |||||
siliconflow/deepseek-ai-deepseek-vl2 | 4K | $0.15 | $0.15 | |||||
siliconflow/inclusionai-ling-flash-2.0 | 131K | $0.14 | $0.57 | |||||
siliconflow/inclusionai-ling-mini-2.0 | 131K | $0.07 | $0.28 | |||||
siliconflow/inclusionai-ring-flash-2.0 | 131K | $0.14 | $0.57 | |||||
siliconflow/meta-llama-meta-llama-3.1-8b-instruct | 33K | $0.06 | $0.06 | |||||
siliconflow/minimaxai-minimax-m1-80k | 131K | $0.55 | $2 | |||||
siliconflow/minimaxai-minimax-m2 | 197K | $0.30 | $1 | |||||
siliconflow/moonshotai-kimi-dev-72b | 131K | $0.29 | $1 | |||||
siliconflow/moonshotai-kimi-k2-instruct | 131K | $0.58 | $2 | |||||
siliconflow/moonshotai-kimi-k2-instruct-0905 | 262K | $0.40 | $2 | |||||
siliconflow/moonshotai-kimi-k2-thinking | 262K | $0.55 | $3 | |||||
siliconflow/nex-agi-deepseek-v3.1-nex-n1 | 131K | $0.50 | $2 | |||||
siliconflow/openai-gpt-oss-120b | 131K | $0.05 | $0.45 | |||||
siliconflow/openai-gpt-oss-20b | 131K | $0.04 | $0.18 | |||||
siliconflow/qwen-qwen2.5-14b-instruct | 33K | $0.10 | $0.10 | |||||
siliconflow/qwen-qwen2.5-32b-instruct | 33K | $0.18 | $0.18 | |||||
siliconflow/qwen-qwen2.5-72b-instruct | 33K | $0.59 | $0.59 | |||||
siliconflow/qwen-qwen2.5-72b-instruct-128k | 131K | $0.59 | $0.59 | |||||
siliconflow/qwen-qwen2.5-7b-instruct | 33K | $0.05 | $0.05 | |||||
siliconflow/qwen-qwen2.5-coder-32b-instruct | 33K | $0.18 | $0.18 | |||||
siliconflow/qwen-qwen2.5-vl-32b-instruct | 131K | $0.27 | $0.27 | |||||
siliconflow/qwen-qwen2.5-vl-72b-instruct | 131K | $0.59 | $0.59 | |||||
siliconflow/qwen-qwen2.5-vl-7b-instruct | 33K | $0.05 | $0.05 | |||||
siliconflow/qwen-qwen3-14b | 131K | $0.07 | $0.28 | |||||
siliconflow/qwen-qwen3-235b-a22b | 131K | $0.35 | $1 | |||||
siliconflow/qwen-qwen3-235b-a22b-instruct-2507 | 262K | $0.09 | $0.60 | |||||
siliconflow/qwen-qwen3-235b-a22b-thinking-2507 | 262K | $0.13 | $0.60 | |||||
siliconflow/qwen-qwen3-30b-a3b | 131K | $0.09 | $0.45 | |||||
siliconflow/qwen-qwen3-30b-a3b-instruct-2507 | 262K | $0.09 | $0.30 | |||||
siliconflow/qwen-qwen3-30b-a3b-thinking-2507 | 262K | $0.09 | $0.30 | |||||
siliconflow/qwen-qwen3-32b | 131K | $0.14 | $0.57 | |||||
siliconflow/qwen-qwen3-8b | 131K | $0.06 | $0.06 | |||||
siliconflow/qwen-qwen3-coder-30b-a3b-instruct | 262K | $0.07 | $0.28 | |||||
siliconflow/qwen-qwen3-coder-480b-a35b-instruct | 262K | $0.25 | $1 | |||||
siliconflow/qwen-qwen3-next-80b-a3b-instruct | 262K | $0.14 | $1 | |||||
siliconflow/qwen-qwen3-next-80b-a3b-thinking | 262K | $0.14 | $0.57 | |||||
siliconflow/qwen-qwen3-omni-30b-a3b-captioner | 66K | $0.10 | $0.40 | |||||
siliconflow/qwen-qwen3-omni-30b-a3b-instruct | 66K | $0.10 | $0.40 | |||||
siliconflow/qwen-qwen3-omni-30b-a3b-thinking | 66K | $0.10 | $0.40 | |||||
siliconflow/qwen-qwen3-vl-235b-a22b-instruct | 262K | $0.30 | $2 | |||||
siliconflow/qwen-qwen3-vl-235b-a22b-thinking | 262K | $0.45 | $4 | |||||
siliconflow/qwen-qwen3-vl-30b-a3b-instruct | 262K | $0.29 | $1 | |||||
siliconflow/qwen-qwen3-vl-30b-a3b-thinking | 262K | $0.29 | $1 | |||||
siliconflow/qwen-qwen3-vl-32b-instruct | 262K | $0.20 | $0.60 | |||||
siliconflow/qwen-qwen3-vl-32b-thinking | 262K | $0.20 | $2 | |||||
siliconflow/qwen-qwen3-vl-8b-instruct | 262K | $0.18 | $0.68 | |||||
siliconflow/qwen-qwen3-vl-8b-thinking | 262K | $0.18 | $2 | |||||
siliconflow/qwen-qwq-32b | 131K | $0.15 | $0.58 | |||||
siliconflow/stepfun-ai-step3 | 66K | $0.57 | $1 | |||||
siliconflow/tencent-hunyuan-a13b-instruct | 131K | $0.14 | $0.57 | |||||
siliconflow/tencent-hunyuan-mt-7b | 33K | — | — | |||||
siliconflow/thudm-glm-4-32b-0414 | 33K | $0.27 | $0.27 | |||||
siliconflow/thudm-glm-4-9b-0414 | 33K | $0.09 | $0.09 | |||||
siliconflow/thudm-glm-4.1v-9b-thinking | 66K | $0.04 | $0.14 | |||||
siliconflow/thudm-glm-z1-32b-0414 | 131K | $0.14 | $0.57 | |||||
siliconflow/thudm-glm-z1-9b-0414 | 131K | $0.09 | $0.09 | |||||
siliconflow/z-ai-glm-4.5 | 131K | $0.40 | $2 | |||||
siliconflow/z-ai-glm-4.5-air | 131K | $0.14 | $0.86 | |||||
siliconflow/zai-org-glm-4.5 | 131K | $0.40 | $2 | |||||
siliconflow/zai-org-glm-4.5-air | 131K | $0.14 | $0.86 | |||||
siliconflow/zai-org-glm-4.5v | 66K | $0.14 | $0.86 | |||||
siliconflow/zai-org-glm-4.6 | 205K | $0.50 | $2 |
Advanced ConfigurationDirect link to Advanced Configuration
Custom HeadersDirect link to Custom Headers
const agent = new Agent({
name: "custom-agent",
model: {
url: "https://api.siliconflow.com/v1",
id: "siliconflow/baidu-ernie-4.5-300b-a47b",
apiKey: process.env.SILICONFLOW_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});
Dynamic Model SelectionDirect link to Dynamic Model Selection
const agent = new Agent({
name: "dynamic-agent",
model: ({ runtimeContext }) => {
const useAdvanced = runtimeContext.task === "complex";
return useAdvanced
? "siliconflow/zai-org-glm-4.6"
: "siliconflow/baidu-ernie-4.5-300b-a47b";
}
});