Thinking Machines
Access 38 Thinking Machines models through Mastra's model router. Authentication is handled automatically using the TINKER_API_KEY environment variable.
Learn more in the Thinking Machines documentation.
.env
TINKER_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: "thinkingmachines/Qwen/Qwen3-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 Thinking Machines documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
thinkingmachines/deepseek-ai/DeepSeek-V3.1 | 33K | $2 | $4 | |||||
thinkingmachines/deepseek-ai/DeepSeek-V4.1-Flash-1017:peft:262144 | 262K | $0.60 | $4 | |||||
thinkingmachines/deepseek-ai/DeepSeek-V4.1-Flash:peft:262144 | 262K | $0.60 | $4 | |||||
thinkingmachines/moonshotai/Kimi-K2.6 | 33K | $2 | $5 | |||||
thinkingmachines/moonshotai/Kimi-K2.6:peft:131072 | 131K | $2 | $5 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16 | 66K | $0.20 | $0.49 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16 | 66K | $0.57 | $1 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16:peft:262144 | 262K | $0.57 | $1 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16 | 66K | $2 | $6 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16:peft:262144 | 262K | $2 | $6 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16 | 66K | $0.18 | $0.49 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16:peft:262144 | 262K | $0.18 | $0.49 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-BF16 | 66K | $0.57 | $1 | |||||
thinkingmachines/nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-BF16:peft:262144 | 262K | $0.57 | $1 | |||||
thinkingmachines/openai/gpt-oss-120b | 33K | $0.33 | $0.84 | |||||
thinkingmachines/openai/gpt-oss-120b:peft:131072 | 131K | $0.33 | $0.84 | |||||
thinkingmachines/openai/gpt-oss-20b | 33K | $0.18 | $0.45 | |||||
thinkingmachines/Qwen/Qwen3-8B | 33K | $0.20 | $0.60 | |||||
thinkingmachines/Qwen/Qwen3.5-35B-A3B-Base | 66K | $0.54 | $1 | |||||
thinkingmachines/Qwen/Qwen3.5-397B-A17B | 66K | $2 | $8 | |||||
thinkingmachines/Qwen/Qwen3.5-397B-A17B:peft:262144 | 262K | $2 | $8 | |||||
thinkingmachines/Qwen/Qwen3.5-4B | 66K | $0.33 | $1 | |||||
thinkingmachines/Qwen/Qwen3.5-4B:peft:262144 | 262K | $0.33 | $1 | |||||
thinkingmachines/Qwen/Qwen3.5-9B | 66K | $0.30 | $0.81 | |||||
thinkingmachines/Qwen/Qwen3.5-9B-Base | 66K | $0.30 | $0.81 | |||||
thinkingmachines/Qwen/Qwen3.6-27B | 66K | $2 | $6 | |||||
thinkingmachines/Qwen/Qwen3.6-35B-A3B | 66K | $0.45 | $1 | |||||
thinkingmachines/Qwen/Qwen3.6-35B-A3B:peft:262144 | 262K | $0.45 | $1 | |||||
thinkingmachines/Qwen/Qwen3.8-27B | 66K | $0.70 | $6 | |||||
thinkingmachines/Qwen/Qwen3.8-27B:peft:262144 | 262K | $0.70 | $6 | |||||
thinkingmachines/thinkingmachines/Inkling | 66K | $2 | $5 | |||||
thinkingmachines/thinkingmachines/Inkling-Small | 66K | $0.58 | $1 | |||||
thinkingmachines/thinkingmachines/Inkling-Small:peft:262144 | 262K | $0.58 | $1 | |||||
thinkingmachines/thinkingmachines/Inkling-Small:peft:262144:sampling-nvfp4 | 262K | $0.30 | $1 | |||||
thinkingmachines/thinkingmachines/Inkling:peft:262144 | 262K | $2 | $5 | |||||
thinkingmachines/thinkingmachines/Inkling:peft:262144:sampling-nvfp4 | 262K | $1 | $4 | |||||
thinkingmachines/zai-org/GLM-5.3-Flash:peft:262144 | 262K | $0.84 | $2 | |||||
thinkingmachines/zai-org/GLM-5.3:peft:262144 | 262K | $4 | $12 |
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://tinker.thinkingmachines.dev/services/tinker-prod/anthropic/api/v1",
id: "thinkingmachines/Qwen/Qwen3-8B",
apiKey: process.env.TINKER_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
? "thinkingmachines/zai-org/GLM-5.3:peft:262144"
: "thinkingmachines/Qwen/Qwen3-8B";
}
});