# ![Databricks logo](https://models.dev/logos/databricks.svg)Databricks Access 25 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](https://docs.databricks.com/aws/en/machine-learning/foundation-models/). ```bash DATABRICKS_HOST=your-value DATABRICKS_TOKEN=your-api-token ``` ```typescript 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-haiku-4-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); } ``` > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Databricks documentation](https://docs.databricks.com/aws/en/machine-learning/foundation-models/) for details. ## Models | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M | | --------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- | | `databricks/databricks-claude-haiku-4-5` | 200K | | | | | | $1 | $5 | | `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-sonnet-4` | 200K | | | | | | $3 | $15 | | `databricks/databricks-claude-sonnet-4-5` | 200K | | | | | | $3 | $15 | | `databricks/databricks-claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 | | `databricks/databricks-gemini-2-5-flash` | 1.0M | | | | | | $0.30 | $3 | | `databricks/databricks-gemini-2-5-pro` | 1.0M | | | | | | $1 | $10 | | `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-flash` | 1.0M | | | | | | $0.50 | $3 | | `databricks/databricks-gemini-3-pro` | 1.0M | | | | | | $2 | $12 | | `databricks/databricks-gpt-5` | 400K | | | | | | $1 | $10 | | `databricks/databricks-gpt-5-1` | 400K | | | | | | $1 | $10 | | `databricks/databricks-gpt-5-2` | 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-mini` | 400K | | | | | | $0.25 | $2 | | `databricks/databricks-gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 | | `databricks/databricks-gpt-oss-120b` | 131K | | | | | | $0.07 | $0.28 | | `databricks/databricks-gpt-oss-20b` | 131K | | | | | | $0.05 | $0.20 | ## Advanced configuration ### Custom headers ```typescript const agent = new Agent({ id: "custom-agent", name: "custom-agent", model: { url: "https://${DATABRICKS_HOST}/ai-gateway/mlflow/v1", id: "databricks/databricks-claude-haiku-4-5", apiKey: process.env.DATABRICKS_TOKEN, headers: { "X-Custom-Header": "value" } } }); ``` ### Dynamic model selection ```typescript const agent = new Agent({ id: "dynamic-agent", name: "Dynamic Agent", model: ({ requestContext }) => { const useAdvanced = requestContext.task === "complex"; return useAdvanced ? "databricks/databricks-gpt-oss-20b" : "databricks/databricks-claude-haiku-4-5"; } }); ```