LLM provider API keys
At least one LLM provider API key is required.OpenAI
gpt-4ogpt-4o-minigpt-4-turboo1,o1-mini
Anthropic
claude-3-5-sonnet-20241022anthropic/claude-opus-4-20250514claude-3-opus-20240229
Google Gemini
gemini/gemini-progemini/gemini-1.5-flashgemini/gemini-1.5-pro
vertex_ai/gemini-3-flash-preview), use GCP authentication instead.
Google Cloud Platform
Authentication
Option 1: Application Default Credentials (recommended)~/.config/gcloud/application_default_credentials.json.
Option 2: Service account key
Project configuration
cooperbench config gcp.
Redis (for cooperative mode)
redis://localhost:6379.
Override with --redis flag:
Agent configuration
mini_swe_agent
swe_agent
openhands
External agents
Logging
LITELLM_LOG=ERROR by default to reduce noise.
HuggingFace (optional)
.env file
Create a.env file in your project root:
.env
Example .env file
CooperBench provides.env.example:
.env and fill in your API keys:
.env.example
GCP-specific variables
When using--backend gcp:
Precedence
Environment variables override configuration files:- Command-line flags (highest priority)
- Environment variables
- Configuration files (
~/.config/cooperbench/config.json) - Built-in defaults (lowest priority)
Validation
CooperBench validates required variables on startup:Security best practices
-
Never commit
.envfiles:.gitignore -
Use restrictive permissions:
- Rotate API keys regularly: Generate new keys periodically and revoke old ones.
- Use service accounts for GCP: Avoid using personal credentials in production.
- Limit key scopes: Create API keys with minimal required permissions.
Troubleshooting
”No API key found"
"GCP authentication failed"
"Redis connection refused”
Variables not loading from .env
Reference table
| Variable | Purpose | Required | Default |
|---|---|---|---|
OPENAI_API_KEY | OpenAI API key | One of 3 LLM keys | - |
ANTHROPIC_API_KEY | Anthropic API key | One of 3 LLM keys | - |
GEMINI_API_KEY | Gemini API key | One of 3 LLM keys | - |
REDIS_URL | Redis connection URL | No | redis://localhost:6379 |
GOOGLE_CLOUD_PROJECT | GCP project ID | For GCP backend | - |
GOOGLE_APPLICATION_CREDENTIALS | GCP service account key path | For GCP backend | - |
HF_TOKEN | HuggingFace token | No | - |
GITHUB_TOKEN | GitHub personal access token | No | - |
MSWEA_GLOBAL_COST_LIMIT | Max cost in USD | No | 0 (unlimited) |
MSWEA_GLOBAL_CALL_LIMIT | Max LLM API calls | No | 0 (unlimited) |
LITELLM_LOG | LiteLLM log level | No | ERROR |
LOG_LEVEL | OpenHands log level | No | INFO |