跳至主要內容

Venice AI 標誌Venice AI

透過 Mastra 的模型路由器存取 25 個 Venice AI 模型。系統會自動使用 VENICE_API_KEY 環境變數完成身分驗證。

如需進一步了解,請參閱Venice AI 文件

VENICE_API_KEY=your-api-key
import { Agent } from '@mastra/core/agent'

const agent = new Agent({
id: 'my-agent',
name: 'My Agent',
instructions: 'You are a helpful assistant',
model: 'venice/claude-opus-45',
})

// 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 使用與 OpenAI 相容的 /chat/completions endpoint。部分 Provider 特有功能可能無法使用,詳情請參閱Venice AI 文件

模型
「模型」的直接連結

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
venice/claude-opus-45203K$6$30
venice/claude-sonnet-45203K$4$19
venice/deepseek-v3.2164K$0.40$1
venice/gemini-3-flash-preview262K$0.70$4
venice/gemini-3-pro-preview203K$3$15
venice/google-gemma-3-27b-it203K$0.12$0.20
venice/grok-41-fast262K$0.50$1
venice/grok-code-fast-1262K$0.25$2
venice/hermes-3-llama-3.1-405b131K$1$3
venice/kimi-k2-thinking262K$0.75$3
venice/llama-3.2-3b131K$0.15$0.60
venice/llama-3.3-70b131K$0.70$3
venice/minimax-m21203K$0.40$2
venice/mistral-31-24b131K$0.50$2
venice/openai-gpt-52262K$2$18
venice/openai-gpt-52-codex262K$2$18
venice/openai-gpt-oss-120b131K$0.07$0.30
venice/qwen3-235b-a22b-instruct-2507131K$0.15$0.75
venice/qwen3-235b-a22b-thinking-2507131K$0.45$4
venice/qwen3-4b33K$0.05$0.15
venice/qwen3-coder-480b-a35b-instruct262K$0.75$3
venice/qwen3-next-80b262K$0.35$2
venice/qwen3-vl-235b-a22b262K$0.25$2
venice/venice-uncensored33K$0.20$0.90
venice/zai-org-glm-4.7203K$0.55$3
25 available models

進階設定
「進階設定」的直接連結

自訂標頭
「自訂標頭」的直接連結

const agent = new Agent({
id: 'custom-agent',
name: 'custom-agent',
model: {
url: 'https://api.venice.ai/api/v1',
id: 'venice/claude-opus-45',
apiKey: process.env.VENICE_API_KEY,
headers: {
'X-Custom-Header': 'value',
},
},
})

動態選擇模型
「動態選擇模型」的直接連結

const agent = new Agent({
id: 'dynamic-agent',
name: 'Dynamic Agent',
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === 'complex'
return useAdvanced ? 'venice/zai-org-glm-4.7' : 'venice/claude-opus-45'
},
})