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);
}
OpenAI Compatibility
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 | Image | Audio | Video | Tools | Streaming | Context Window |
|---|---|---|---|---|---|---|
venice/dolphin-2.9.2-qwen2-72b | ✗ | ✗ | ✗ | ✗ | ✗ | 32,768 |
venice/mistral-31-24b | ✓ | ✗ | ✗ | ✓ | ✗ | 131,072 |
venice/venice-uncensored | ✗ | ✗ | ✗ | ✗ | ✗ | 32,768 |
venice/qwen-2.5-vl | ✓ | ✗ | ✗ | ✗ | ✗ | 32,768 |
venice/qwen3-235b | ✗ | ✗ | ✗ | ✓ | ✗ | 131,072 |
venice/qwen-2.5-qwq-32b | ✗ | ✗ | ✗ | ✗ | ✗ | 32,768 |
venice/deepseek-coder-v2-lite | ✗ | ✗ | ✗ | ✗ | ✗ | 131,072 |
venice/qwen3-4b | ✗ | ✗ | ✗ | ✓ | ✗ | 32,768 |
venice/llama-3.3-70b | ✗ | ✗ | ✗ | ✓ | ✗ | 65,536 |
venice/qwen-2.5-coder-32b | ✗ | ✗ | ✗ | ✗ | ✗ | 32,768 |
venice/deepseek-r1-671b | ✗ | ✗ | ✗ | ✗ | ✗ | 131,072 |
venice/llama-3.2-3b | ✗ | ✗ | ✗ | ✓ | ✗ | 131,072 |
venice/llama-3.1-405b | ✗ | ✗ | ✗ | ✗ | ✗ | 65,536 |
Advanced Configuration
Custom Headers
const agent = new Agent({
name: "custom-agent",
model: {
url: "https://api.venice.ai/api/v1",
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/venice-uncensored"
: "venice/deepseek-coder-v2-lite";
},
});