Skip to main content

Volcengine Ark logoVolcengine Ark

Access 15 Volcengine Ark models through Mastra's model router. Authentication is handled automatically using the ARK_API_KEY environment variable.

Learn more in the Volcengine Ark documentation.

.env
ARK_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: "volcengine/deepseek-v4-flash-ga-260731"
});

// 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);
}
note

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

Models
Direct link to Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
volcengine/deepseek-v4-flash-ga-2607311.0M$0.45$1
volcengine/deepseek-v4-pro-ga-2608131.0M$1$4
volcengine/doubao-seed-1-6-251015256K$0.12$1
volcengine/doubao-seed-1-6-flash-250828256K$0.02$0.22
volcengine/doubao-seed-1-6-vision-250815256K$0.12$1
volcengine/doubao-seed-1-8-251228256K$0.12$1
volcengine/doubao-seed-2-0-code-preview-260215262K$0.47$2
volcengine/doubao-seed-2-0-lite-260428256K$0.09$0.53
volcengine/doubao-seed-2-0-mini-260428256K$0.03$0.30
volcengine/doubao-seed-2-0-pro-260215256K$0.47$2
volcengine/doubao-seed-2-1-pro-260628256K$0.89$4
volcengine/doubao-seed-2-1-turbo-260628256K$0.45$2
volcengine/doubao-seed-character-260628256K$0.12$0.30
volcengine/doubao-seed-evolving256K$0.89$4
volcengine/glm-5-2-2606171.0M$1$4
15 available models

Advanced configuration
Direct link to Advanced configuration

Custom headers
Direct link to Custom headers

src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://ark.cn-beijing.volces.com/api/v3",
id: "volcengine/deepseek-v4-flash-ga-260731",
apiKey: process.env.ARK_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});

Dynamic model selection
Direct link to Dynamic model selection

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
? "volcengine/glm-5-2-260617"
: "volcengine/deepseek-v4-flash-ga-260731";
}
});
On this page