Doubleword
Access 18 Doubleword models through Mastra's model router. Authentication is handled automatically using the DOUBLEWORD_API_KEY environment variable.
Learn more in the Doubleword documentation.
.env
DOUBLEWORD_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: "doubleword/Qwen/Qwen3-Embedding-8B"
});
// 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 Doubleword documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
doubleword/deepseek-ai/DeepSeek-V4-Flash-0731 | 1.0M | $0.09 | $0.18 | |||||
doubleword/deepseek-ai/DeepSeek-V4-Pro-0813 | 1.0M | $1 | $4 | |||||
doubleword/deepseek-ai/DeepSeek-V4.1-Flash | 1.0M | $0.15 | $0.60 | |||||
doubleword/deepseek-ai/DeepSeek-V4.1-Flash-1017 | 1.0M | $0.15 | $0.60 | |||||
doubleword/google/gemma-4-31B-it | 262K | $0.12 | $0.35 | |||||
doubleword/meta-models/Muse-Glimmer-30B | 131K | $0.11 | $0.32 | |||||
doubleword/meta/muse-spark-open | 1.0M | $1 | $4 | |||||
doubleword/moonshotai/kimi-k3 | 1.0M | $3 | $15 | |||||
doubleword/moonshotai/Kimi-K3.1-Pro | 1.0M | $2 | $10 | |||||
doubleword/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-NVFP4 | 1.0M | $0.50 | $2 | |||||
doubleword/Qwen/Qwen3-Embedding-8B | 33K | — | — | |||||
doubleword/Qwen/Qwen3-VL-235B-A22B-Instruct-FP8 | 131K | $0.21 | $2 | |||||
doubleword/Qwen/Qwen3.5-35B-A3B-FP8-dottxt | 262K | $0.35 | $1 | |||||
doubleword/Qwen/Qwen3.6-35B-A3B-FP8 | 262K | $0.14 | $1 | |||||
doubleword/Qwen/Qwen3.8-27B-FP8 | 262K | $0.45 | $3 | |||||
doubleword/zai-org/GLM-5.2-FP8 | 1.0M | $0.93 | $3 | |||||
doubleword/zai-org/GLM-5.3 | 1.0M | $1 | $4 | |||||
doubleword/zai-org/GLM-5.3-Flash | 1.0M | $0.15 | $0.50 |
Model availability, capabilities, context windows, and pricing are sourced from models.dev and may change.
Advanced configurationDirect link to Advanced configuration
Custom headersDirect link to Custom headers
src/mastra/agents/my-agent.ts
import { Agent } from "@mastra/core/agent";
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://api.doubleword.ai/v1",
id: "doubleword/Qwen/Qwen3-Embedding-8B",
apiKey: process.env.DOUBLEWORD_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});
Dynamic model selectionDirect link to Dynamic model selection
src/mastra/agents/my-agent.ts
import { Agent } from "@mastra/core/agent";
const agent = new Agent({
id: "dynamic-agent",
name: "Dynamic Agent",
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === "complex";
return useAdvanced
? "doubleword/zai-org/GLM-5.3-Flash"
: "doubleword/Qwen/Qwen3-Embedding-8B";
}
});