Deep Infra
通过 Mastra 的模型路由器访问 51 个 Deep Infra 模型。系统会自动使用 DEEPINFRA_API_KEY 环境变量完成身份验证。
更多信息请参阅Deep Infra 文档。
.env
DEEPINFRA_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: 'deepinfra/MiniMaxAI/MiniMax-M2.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)
}
模型模型的直接链接
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
deepinfra/deepseek-ai/DeepSeek-R1-0528 | 164K | $0.50 | $2 | |||||
deepinfra/deepseek-ai/DeepSeek-V3 | 164K | $0.32 | $0.89 | |||||
deepinfra/deepseek-ai/DeepSeek-V3.1 | 164K | $0.25 | $0.95 | |||||
deepinfra/deepseek-ai/DeepSeek-V3.2 | 164K | $0.26 | $0.38 | |||||
deepinfra/deepseek-ai/DeepSeek-V4-Flash | 1.0M | $0.09 | $0.18 | |||||
deepinfra/deepseek-ai/DeepSeek-V4-Flash-0731 | 1.0M | $0.09 | $0.18 | |||||
deepinfra/deepseek-ai/DeepSeek-V4-Pro | 1.0M | $1 | $3 | |||||
deepinfra/google/gemma-4-26B-A4B-it | 262K | $0.07 | $0.34 | |||||
deepinfra/google/gemma-4-31B-it | 262K | $0.13 | $0.38 | |||||
deepinfra/google/gemma-4-E4B-it | 131K | $0.02 | $0.10 | |||||
deepinfra/meta-llama/Llama-3.3-70B-Instruct-Turbo | 131K | $0.10 | $0.32 | |||||
deepinfra/meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8 | 1.0M | $0.20 | $0.80 | |||||
deepinfra/meta-llama/Llama-4-Scout-17B-16E-Instruct | 328K | $0.10 | $0.30 | |||||
deepinfra/MiniMaxAI/MiniMax-M2.7 | 197K | $0.25 | $1 | |||||
deepinfra/MiniMaxAI/MiniMax-M3 | 524K | $0.28 | $1 | |||||
deepinfra/moonshotai/Kimi-K2.5 | 262K | $0.45 | $2 | |||||
deepinfra/moonshotai/Kimi-K2.6 | 262K | $0.75 | $4 | |||||
deepinfra/moonshotai/Kimi-K2.7-Code | 262K | $0.68 | $3 | |||||
deepinfra/moonshotai/Kimi-K3 | 1.0M | $3 | $14 | |||||
deepinfra/nvidia/Nemotron-3-Nano-30B-A3B | 262K | $0.05 | $0.20 | |||||
deepinfra/openai/gpt-oss-120b | 131K | $0.04 | $0.17 | |||||
deepinfra/openai/gpt-oss-20b | 131K | $0.03 | $0.14 | |||||
deepinfra/Qwen/Qwen3-235B-A22B-Instruct-2507 | 262K | $0.09 | $0.55 | |||||
deepinfra/Qwen/Qwen3-32B | 41K | $0.08 | $0.28 | |||||
deepinfra/Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo | 262K | $0.30 | $1 | |||||
deepinfra/Qwen/Qwen3-Max | 256K | $1 | $6 | |||||
deepinfra/Qwen/Qwen3-Next-80B-A3B-Instruct | 262K | $0.09 | $1 | |||||
deepinfra/Qwen/Qwen3.5-122B-A10B | 262K | $0.29 | $2 | |||||
deepinfra/Qwen/Qwen3.5-27B | 262K | $0.26 | $3 | |||||
deepinfra/Qwen/Qwen3.5-35B-A3B | 262K | $0.14 | $1 | |||||
deepinfra/Qwen/Qwen3.5-397B-A17B | 262K | $0.45 | $3 | |||||
deepinfra/Qwen/Qwen3.5-9B | 262K | $0.10 | $0.15 | |||||
deepinfra/Qwen/Qwen3.6-27B | 262K | $0.32 | $3 | |||||
deepinfra/Qwen/Qwen3.6-35B-A3B | 262K | $0.10 | $0.95 | |||||
deepinfra/Qwen/Qwen3.7-Max | 256K | $3 | $8 | |||||
deepinfra/Qwen/Qwen3.8-Max | 256K | $2 | $5 | |||||
deepinfra/stepfun-ai/Step-3.7-Flash | 262K | $0.20 | $1 | |||||
deepinfra/tencent/Hy3 | 262K | $0.14 | $0.58 | |||||
deepinfra/thinkingmachines/Inkling | 524K | $0.95 | $4 | |||||
deepinfra/thinkingmachines/Inkling-Small | 524K | $0.45 | $1 | |||||
deepinfra/XiaomiMiMo/MiMo-V2.5 | 262K | $0.40 | $2 | |||||
deepinfra/XiaomiMiMo/MiMo-V2.5-Pro | 1.0M | $1 | $3 | |||||
deepinfra/zai-org/GLM-4.6 | 203K | $0.50 | $2 | |||||
deepinfra/zai-org/GLM-4.7 | 203K | $0.40 | $2 | |||||
deepinfra/zai-org/GLM-4.7-Flash | 203K | $0.06 | $0.40 | |||||
deepinfra/zai-org/GLM-5 | 203K | $0.60 | $2 | |||||
deepinfra/zai-org/GLM-5.1 | 203K | $1 | $4 | |||||
deepinfra/zai-org/GLM-5.2 | 1.0M | $0.75 | $2 |
高级配置高级配置的直接链接
自定义请求头自定义请求头的直接链接
src/mastra/agents/my-agent.ts
const agent = new Agent({
id: 'custom-agent',
name: 'custom-agent',
model: {
id: 'deepinfra/MiniMaxAI/MiniMax-M2.5',
apiKey: process.env.DEEPINFRA_API_KEY,
headers: {
'X-Custom-Header': 'value',
},
},
})
动态选择模型动态选择模型的直接链接
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 ? 'deepinfra/zai-org/GLM-5.2' : 'deepinfra/MiniMaxAI/MiniMax-M2.5'
},
})
直接安装 Provider直接安装 Provider的直接链接
你也可以直接将此 Provider 安装为独立 package,用它代替 Mastra 模型路由字符串。详情请参阅package 文档。
- npm
- pnpm
- Yarn
- Bun
npm install @ai-sdk/deepinfra
pnpm add @ai-sdk/deepinfra
yarn add @ai-sdk/deepinfra
bun add @ai-sdk/deepinfra
有关此 Provider 的详细说明,请参阅 AI SDK Deep Infra Provider 文档。