Databricks
Access 62 Databricks models through Mastra's model router. Authentication is handled automatically using the DATABRICKS_TOKEN environment variable. Configure DATABRICKS_HOST as well.
Learn more in the Databricks documentation.
.env
DATABRICKS_HOST=your-value
DATABRICKS_TOKEN=your-api-token
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: "databricks/databricks-claude-fable-5"
});
// 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 Databricks documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
databricks/databricks-claude-fable-5 | 1.0M | $10 | $50 | |||||
databricks/databricks-claude-fable-5-1 | 1.0M | $10 | $50 | |||||
databricks/databricks-claude-haiku-4-5 | 200K | $1 | $5 | |||||
databricks/databricks-claude-haiku-5-5 | 1.0M | $0.10 | $0.50 | |||||
databricks/databricks-claude-opus-4-1 | 200K | $15 | $75 | |||||
databricks/databricks-claude-opus-4-5 | 200K | $5 | $25 | |||||
databricks/databricks-claude-opus-4-6 | 1.0M | $5 | $25 | |||||
databricks/databricks-claude-opus-4-7 | 1.0M | $5 | $25 | |||||
databricks/databricks-claude-opus-4-8 | 1.0M | $5 | $25 | |||||
databricks/databricks-claude-opus-5 | 1.0M | $5 | $25 | |||||
databricks/databricks-claude-opus-5-5 | 1.0M | $4 | $20 | |||||
databricks/databricks-claude-sonnet-4-5 | 200K | $3 | $15 | |||||
databricks/databricks-claude-sonnet-4-6 | 1.0M | $3 | $15 | |||||
databricks/databricks-claude-sonnet-5 | 1.0M | $2 | $10 | |||||
databricks/databricks-claude-sonnet-5-5 | 1.0M | $2 | $10 | |||||
databricks/databricks-deepseek-v4-1-flash-1017 | 1.0M | $0.30 | $1 | |||||
databricks/databricks-gemini-3-1-flash-lite | 1.0M | $0.25 | $2 | |||||
databricks/databricks-gemini-3-1-pro | 1.0M | $2 | $12 | |||||
databricks/databricks-gemini-3-5-flash | 1.0M | $2 | $9 | |||||
databricks/databricks-gemini-3-5-flash-lite | 1.0M | $0.30 | $3 | |||||
databricks/databricks-gemini-3-7-flash | 1.0M | $0.75 | $4 | |||||
databricks/databricks-gemini-3-8-flash | 1.0M | $0.75 | $4 | |||||
databricks/databricks-gemini-3-flash | 1.0M | $0.50 | $3 | |||||
databricks/databricks-gemini-4-argon | 1.0M | $5 | $25 | |||||
databricks/databricks-gemma-3-12b | 131K | $0.15 | $0.50 | |||||
databricks/databricks-glm-5-3 | 1.0M | $1 | $4 | |||||
databricks/databricks-glm-5-3-flash | 1.0M | $0.15 | $0.50 | |||||
databricks/databricks-gpt-5-1 | 400K | $1 | $10 | |||||
databricks/databricks-gpt-5-2 | 400K | $2 | $14 | |||||
databricks/databricks-gpt-5-3-codex | 400K | $2 | $14 | |||||
databricks/databricks-gpt-5-4 | 1.1M | $3 | $15 | |||||
databricks/databricks-gpt-5-4-mini | 400K | $0.75 | $5 | |||||
databricks/databricks-gpt-5-4-nano | 400K | $0.20 | $1 | |||||
databricks/databricks-gpt-5-5 | 1.1M | $5 | $30 | |||||
databricks/databricks-gpt-5-5-pro | 1.1M | $30 | $180 | |||||
databricks/databricks-gpt-5-6-luna | 1.1M | $0.20 | $1 | |||||
databricks/databricks-gpt-5-6-sol | 1.1M | $5 | $30 | |||||
databricks/databricks-gpt-5-6-terra | 1.1M | $2 | $12 | |||||
databricks/databricks-gpt-6-1-sol | 1.1M | $2 | $10 | |||||
databricks/databricks-gpt-6-1-terra | 1.1M | $1 | $5 | |||||
databricks/databricks-gpt-6-astra | 1.1M | $10 | $50 | |||||
databricks/databricks-gpt-6-luna | 1.1M | $0.10 | $0.50 | |||||
databricks/databricks-gpt-6-sol | 1.1M | $2 | $10 | |||||
databricks/databricks-gpt-oss-120b | 131K | $0.15 | $0.60 | |||||
databricks/databricks-gpt-oss-20b | 131K | $0.07 | $0.30 | |||||
databricks/databricks-grok-4-6 | 500K | $2 | $6 | |||||
databricks/databricks-grok-4-7 | 500K | $2 | $6 | |||||
databricks/databricks-kimi-k3 | 1.0M | $3 | $15 | |||||
databricks/databricks-kimi-k3-1-pro | 1.0M | $2 | $10 | |||||
databricks/databricks-llama-4-maverick | 1.0M | $0.50 | $2 | |||||
databricks/databricks-meta-llama-3-1-8b-instruct | 128K | $0.15 | $0.45 | |||||
databricks/databricks-meta-llama-3-3-70b-instruct | 128K | $0.50 | $2 | |||||
databricks/system.ai.claude-fable-5-2 | 1.0M | $8 | $40 | |||||
databricks/system.ai.gemini-4-carbon | 1.0M | $5 | $25 | |||||
databricks/system.ai.gemini-4-hydrogen | 1.0M | $2 | $9 | |||||
databricks/system.ai.gemini-4-neon | 1.0M | $4 | $19 | |||||
databricks/system.ai.gpt-6-2-astra | 1.1M | $8 | $40 | |||||
databricks/system.ai.gpt-6-2-sol | 1.1M | $2 | $10 |
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://${DATABRICKS_HOST}/ai-gateway/mlflow/v1",
id: "databricks/databricks-claude-fable-5",
apiKey: process.env.DATABRICKS_TOKEN,
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
? "databricks/system.ai.gpt-6-2-sol"
: "databricks/databricks-claude-fable-5";
}
});