AI Provider Configuration
Choose and configure the LLM provider that powers Donobu's autonomous test flows, including Donobu hosted, Anthropic, OpenAI, and Google Gemini.
Donobu delegates all AI reasoning to an external large language model. You choose the provider by setting environment variables before running your tests. No code changes are required to switch providers.
tip
If you are running tests locally and have the Donobu Studio desktop app installed, Donobu will automatically pick up your LLM configuration from the app — no environment variables needed.
Supported providers
Donobu hosted (recommended)
The simplest option is to use a Donobu API key. Obtain one from the Donobu website and set it:
export DONOBU_API_KEY=your_key_here
Using the Donobu-hosted provider also enables automatic result syncing to the Donobu cloud.
Anthropic
export ANTHROPIC_API_KEY=your_key_here
# Optional: pin a specific model (defaults to the latest recommended model)
export ANTHROPIC_MODEL_NAME=claude-sonnet-4-5
Google Gemini
export GOOGLE_GENERATIVE_AI_API_KEY=your_key_here
# Optional: pin a specific model (defaults to the latest recommended model)
export GOOGLE_GENERATIVE_AI_MODEL_NAME=gemini-2.5-flash
OpenAI
export OPENAI_API_KEY=your_key_here
# Optional: pin a specific model (defaults to the latest recommended model)
export OPENAI_API_MODEL_NAME=gpt-5.1
Priority order
When multiple provider keys are present, Donobu selects the provider in this order:
DONOBU_API_KEYANTHROPIC_API_KEYGOOGLE_GENERATIVE_AI_API_KEYOPENAI_API_KEY
To avoid ambiguity, set only the variables for the provider you intend to use.
Per-test and per-call overrides
You can override the provider for an entire test file using test.use():
import { anthropicClientFixture, test } from 'donobu';
// All tests in this file use the Anthropic client
test.use({ gptClient: anthropicClientFixture('claude-sonnet-4-6') });
test('my test', async ({ page }) => {
await page.ai('Complete the checkout flow');
});
The following fixture factories are available for this purpose:
| Factory | Provider | GptClient class |
|---|---|---|
donobuGptClientFixture(apiKey?) | Donobu hosted | DonobuGptClient |
anthropicClientFixture(modelName, apiKey?) | Anthropic | AnthropicGptClient |
googleGeminiClientFixture(modelName, apiKey?) | Google Gemini | GoogleGeminiGptClient |
openAiClientFixture(modelName, apiKey?) | OpenAI | OpenAiGptClient |
Or override for a single page.ai() call using the gptClient option:
import { AnthropicGptClient, test } from 'donobu';
test('my test', async ({ page }) => {
await page.ai('Complete the checkout flow', {
gptClient: new AnthropicGptClient({
type: 'ANTHROPIC',
modelName: 'claude-sonnet-4-6',
apiKey: process.env.ANTHROPIC_API_KEY!,
}),
});
});
Storing API keys securely
Never commit API keys to version control. Use:
- Local development: a
.envfile — see Playwright's guide to.envfiles for details - CI/CD: repository secrets — see CI/CD Integration for GitHub Actions examples