-
Notifications
You must be signed in to change notification settings - Fork 1
LLM Providers and Configuration
github-actions[bot] edited this page Jun 1, 2026
·
3 revisions
Canary is designed to be LLM-agnostic. You can switch between different AI backends without changing the core test generation logic.
The ProviderFactory selects the appropriate backend based on the
CANARY_LLM_PROVIDER environment variable.
| Provider | Description | Required Configuration |
|---|---|---|
anthropic (Default) |
Uses Claude Sonnet for high-quality test generation. | ANTHROPIC_API_KEY |
gemini |
Google Gemini Flash for fast, low-cost generation. | GEMINI_API_KEY |
openai |
Uses GPT-4o-mini, retained as an alternative. | OPENAI_API_KEY |
mock |
Returns static test templates. Used by tests and CI. | None |
To switch to a non-default provider:
export CANARY_LLM_PROVIDER='gemini'The default is anthropic (Claude) — no env-var needed to use it.
Canary uses lazy initialization: it only loads the provider SDK and
checks for an API key when generation actually runs. The CLI can run
version or --recommend-only commands with no key set, and missing
optional SDKs (e.g. google-generativeai) only break the provider
that needs them, not the rest of the system.
export ANTHROPIC_API_KEY='your-key-here'To add a new LLM backend:
- Create a new file in
agent/llm/providers/. - Inherit from
BaseProviderand implementgenerate(messages). - Register the new provider in
_PROVIDER_REGISTRYinagent/llm/factory.pyas(module_path, class_name).