Skip to main content

Venice AI logoVenice 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);
}
info

Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the Venice AI documentation for details.

Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
venice/deepseek-coder-v2-lite131K$0.50$2
venice/deepseek-r1-671b131K$4$14
venice/dolphin-2.9.2-qwen2-72b33K$0.70$3
venice/llama-3.1-405b66K$2$6
venice/llama-3.2-3b131K$0.15$0.60
venice/llama-3.3-70b66K$0.70$3
venice/mistral-31-24b131K$0.50$2
venice/qwen-2.5-coder-32b33K$0.50$2
venice/qwen-2.5-qwq-32b33K$0.50$2
venice/qwen-2.5-vl33K$0.70$3
venice/qwen3-235b131K$2$6
venice/qwen3-4b33K$0.15$0.60
venice/venice-uncensored33K$0.50$2
venice/zai-org-glm-4.6203K$0.85$3
14 available models

Advanced Configuration

Custom Headers

const agent = new Agent({
name: "custom-agent",
model: {
url: "https://api.venice.ai/api/v1",
id: "venice/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";
}
});

On this page