Venice AI
Access 13 Venice AI models through Mastra’s model router. Authentication is handled automatically using the VENICE_API_KEY
environment variable.
Learn more in the Venice AI documentation .
VENICE_API_KEY=your-api-key
import { Agent } from "@mastra/core";
const agent = new Agent({
name: "my-agent",
instructions: "You are a helpful assistant",
model: "venice/deepseek-coder-v2-lite"
});
// 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 Venice AI documentation for details.
Models
Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
---|---|---|---|---|---|---|---|---|
venice/dolphin-2.9.2-qwen2-72b | 33K | $0.70 | $3 | |||||
venice/mistral-31-24b | 131K | $0.50 | $2 | |||||
venice/venice-uncensored | 33K | $0.50 | $2 | |||||
venice/qwen-2.5-vl | 33K | $0.70 | $3 | |||||
venice/qwen3-235b | 131K | $2 | $6 | |||||
venice/qwen-2.5-qwq-32b | 33K | $0.50 | $2 | |||||
venice/deepseek-coder-v2-lite | 131K | $0.50 | $2 | |||||
venice/qwen3-4b | 33K | $0.15 | $0.60 | |||||
venice/llama-3.3-70b | 66K | $0.70 | $3 | |||||
venice/qwen-2.5-coder-32b | 33K | $0.50 | $2 | |||||
venice/deepseek-r1-671b | 131K | $4 | $14 | |||||
venice/llama-3.2-3b | 131K | $0.15 | $0.60 | |||||
venice/llama-3.1-405b | 66K | $2 | $6 |
Advanced Configuration
Custom Headers
const agent = new Agent({
name: "custom-agent",
model: {
url: "https://api.venice.ai/api/v1/chat/completions",
modelId: "deepseek-coder-v2-lite",
apiKey: process.env.VENICE_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
? "venice/deepseek-coder-v2-lite"
: "venice/deepseek-r1-671b";
}
});