Skip to content

Commit ce5f0c0

Browse files
committed
config: support Anthropic, OpenAI, Gemini, and OpenCode Zen providers
- Add ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY to .env.schema - OPENCODE_ZEN_API_KEY no longer required (any one provider suffices) - start.sh auto-detects provider and picks model: - Orchestration/coding: opus-4-6 / gpt-5.3-codex / gemini-3-pro - Triage (sentry): haiku-4-5 / gpt-5-mini / gemini-3-flash - install.sh prompts for all four providers - Remove hardcoded defaultProvider/defaultModel from settings.json - Update control-agent skill with model selection tables - Update CI simulated input for new prompt order
1 parent 2224280 commit ce5f0c0

11 files changed

Lines changed: 176 additions & 24 deletions

File tree

.env.schema

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,26 @@
99
# ---
1010

1111
# ── LLM Access ───────────────────────────────────────────────────────────────
12+
# Set at least one. Multiple can coexist — switch models at runtime.
1213

13-
# API key for the LLM provider (Anthropic, OpenAI, or a proxy)
14-
# @required @type=string
15-
# @docs(https://docs.anthropic.com/en/api/getting-started)
14+
# Anthropic API key (Claude models)
15+
# @type=string(startsWith=sk-ant-)
16+
# @docs(https://console.anthropic.com/settings/keys)
17+
ANTHROPIC_API_KEY=
18+
19+
# OpenAI API key (GPT, o-series models)
20+
# @type=string(startsWith=sk-)
21+
# @docs(https://platform.openai.com/api-keys)
22+
OPENAI_API_KEY=
23+
24+
# Google Gemini API key
25+
# @type=string
26+
# @docs(https://aistudio.google.com/apikey)
27+
GEMINI_API_KEY=
28+
29+
# OpenCode Zen API key (multi-provider router)
30+
# @type=string
31+
# @docs(https://opencode.ai)
1632
OPENCODE_ZEN_API_KEY=
1733

1834
# ── GitHub ───────────────────────────────────────────────────────────────────

.pi/todos/89b135dc.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"id": "89b135dc",
3+
"title": "Add ANTHROPIC_API_KEY and OPENAI_API_KEY to .env.schema",
4+
"tags": [
5+
"providers"
6+
],
7+
"status": "done",
8+
"created_at": "2026-02-17T11:57:40.435Z"
9+
}
10+
11+
Pi has built-in `anthropic` and `openai` providers that activate when the env vars are set. No extension needed.
12+
13+
Add to `.env.schema` under LLM Access:
14+
- `ANTHROPIC_API_KEY`@type=string(startsWith=sk-ant-), @docs(https://console.anthropic.com/settings/keys)
15+
- `OPENAI_API_KEY`@type=string(startsWith=sk-), @docs(https://platform.openai.com/api-keys)
16+
17+
Make `OPENCODE_ZEN_API_KEY` optional (no longer @required) since users can use any of the three providers. None of the three should be @required — at least one must be set but we can't express that in varlock.

.pi/todos/c3058270.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"id": "c3058270",
3+
"title": "Update install.sh to prompt for all three LLM providers",
4+
"tags": [
5+
"providers"
6+
],
7+
"status": "open",
8+
"created_at": "2026-02-17T11:57:52.746Z",
9+
"assigned_to_session": "381813d9-c69a-4472-9a00-e232ffb746d1"
10+
}
11+
12+
The installer currently prompts for a single LLM key. Update to prompt for all three, all optional:
13+
14+
1. Anthropic API key (sk-ant-...)
15+
2. OpenAI API key (sk-...)
16+
3. OpenCode Zen API key (any string)
17+
18+
Validate prefixes where applicable. Write all non-empty values to .env.
19+
20+
Also update the CI scripts (setup-ubuntu.sh, setup-arch.sh) simulated input to match the new prompt order.

.pi/todos/f60a332a.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"id": "f60a332a",
3+
"title": "Update CONFIGURATION.md for three LLM providers",
4+
"tags": [
5+
"providers"
6+
],
7+
"status": "done",
8+
"created_at": "2026-02-17T11:57:47.187Z"
9+
}
10+
11+
Rewrite the "LLM Access" section in CONFIGURATION.md to list all three providers:
12+
13+
| Variable | Provider | How to get it |
14+
|---|---|---|
15+
| `ANTHROPIC_API_KEY` | Anthropic (Claude) | console.anthropic.com/settings/keys |
16+
| `OPENAI_API_KEY` | OpenAI (GPT, o-series) | platform.openai.com/api-keys |
17+
| `OPENCODE_ZEN_API_KEY` | OpenCode Zen (multi-provider router) | opencode.ai |
18+
19+
Note: set at least one. Multiple can coexist — switch models at runtime.
20+
21+
Update the example .env file to show all three (commented out with a note to uncomment one).

CONFIGURATION.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ Baudbot uses [Varlock](https://varlock.dev) to validate environment variables at
1212

1313
### LLM Access
1414

15-
| Variable | Description | How to get it |
16-
|----------|-------------|---------------|
17-
| `OPENCODE_ZEN_API_KEY` | API key for the LLM provider | Your LLM provider dashboard (e.g. Anthropic, OpenAI, or a proxy like OpenCode Zen) |
15+
Set at least one. Multiple can coexist — switch models at runtime via `/model`.
16+
17+
| Variable | Provider | How to get it |
18+
|----------|----------|---------------|
19+
| `ANTHROPIC_API_KEY` | Anthropic (Claude) | [console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys) |
20+
| `OPENAI_API_KEY` | OpenAI (GPT, o-series) | [platform.openai.com/api-keys](https://platform.openai.com/api-keys) |
21+
| `GEMINI_API_KEY` | Google Gemini | [aistudio.google.com/apikey](https://aistudio.google.com/apikey) |
22+
| `OPENCODE_ZEN_API_KEY` | OpenCode Zen (multi-provider router) | [opencode.ai](https://opencode.ai) |
1823

1924
### GitHub
2025

@@ -90,8 +95,11 @@ Set during `setup.sh` via env vars (or edit `~/.gitconfig` after):
9095
## Example `.env` File
9196

9297
```bash
93-
# LLM
94-
OPENCODE_ZEN_API_KEY=sk-...
98+
# LLM (set at least one)
99+
ANTHROPIC_API_KEY=sk-ant-...
100+
# OPENAI_API_KEY=sk-...
101+
# GEMINI_API_KEY=...
102+
# OPENCODE_ZEN_API_KEY=...
95103

96104
# GitHub
97105
GITHUB_TOKEN=ghp_...

bin/ci/setup-arch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sudo -u baudbot_admin bash -c 'cd ~/baudbot && git init -q && git config user.em
2020

2121
echo "=== Running install.sh ==="
2222
# Simulate interactive input: admin user, required secrets, skip optionals, decline launch
23-
printf 'baudbot_admin\nsk-test-key\nghp_testtoken\nxoxb-test\nxapp-test\nU01TEST\n\n\n\n\n\nn\n' \
23+
printf 'baudbot_admin\nsk-ant-testkey\n\n\n\nghp_testtoken\nxoxb-test\nxapp-test\nU01TEST\n\n\n\n\n\nn\n' \
2424
| bash /home/baudbot_admin/baudbot/install.sh
2525

2626
echo "=== Verifying install ==="
@@ -32,7 +32,7 @@ test "$(stat -c '%U' /home/baudbot_agent/.config/.env)" = "baudbot_agent"
3232
test -f /home/baudbot_agent/runtime/start.sh
3333
test -d /home/baudbot_agent/.pi/agent/extensions
3434
# Required secrets written
35-
grep -q "OPENCODE_ZEN_API_KEY=sk-test-key" /home/baudbot_agent/.config/.env
35+
grep -q "ANTHROPIC_API_KEY=sk-ant-testkey" /home/baudbot_agent/.config/.env
3636
grep -q "SLACK_BOT_TOKEN=xoxb-test" /home/baudbot_agent/.config/.env
3737
grep -q "BAUDBOT_SOURCE_DIR=" /home/baudbot_agent/.config/.env
3838
echo " ✓ install.sh verification passed"

bin/ci/setup-ubuntu.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ sudo -u baudbot_admin bash -c 'cd ~/baudbot && git init -q && git config user.em
3131

3232
echo "=== Running install.sh ==="
3333
# Simulate interactive input: admin user, required secrets, skip optionals, decline launch
34-
printf 'baudbot_admin\nsk-test-key\nghp_testtoken\nxoxb-test\nxapp-test\nU01TEST\n\n\n\n\n\nn\n' \
34+
printf 'baudbot_admin\nsk-ant-testkey\n\n\n\nghp_testtoken\nxoxb-test\nxapp-test\nU01TEST\n\n\n\n\n\nn\n' \
3535
| bash /home/baudbot_admin/baudbot/install.sh
3636

3737
echo "=== Verifying install ==="
@@ -43,7 +43,7 @@ test "$(stat -c '%U' /home/baudbot_agent/.config/.env)" = "baudbot_agent"
4343
test -f /home/baudbot_agent/runtime/start.sh
4444
test -d /home/baudbot_agent/.pi/agent/extensions
4545
# Required secrets written
46-
grep -q "OPENCODE_ZEN_API_KEY=sk-test-key" /home/baudbot_agent/.config/.env
46+
grep -q "ANTHROPIC_API_KEY=sk-ant-testkey" /home/baudbot_agent/.config/.env
4747
grep -q "SLACK_BOT_TOKEN=xoxb-test" /home/baudbot_agent/.config/.env
4848
grep -q "BAUDBOT_SOURCE_DIR=" /home/baudbot_agent/.config/.env
4949
echo " ✓ install.sh verification passed"

install.sh

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,38 @@ prompt_secret() {
237237
echo -e "${BOLD}Required${RESET} ${DIM}(agent won't start without these)${RESET}"
238238
echo ""
239239

240+
echo -e "${BOLD}LLM provider${RESET} ${DIM}(set at least one)${RESET}"
241+
echo ""
242+
243+
prompt_secret "ANTHROPIC_API_KEY" \
244+
"Anthropic API key" \
245+
"https://console.anthropic.com/settings/keys" \
246+
"" \
247+
"sk-ant-"
248+
249+
prompt_secret "OPENAI_API_KEY" \
250+
"OpenAI API key" \
251+
"https://platform.openai.com/api-keys" \
252+
"" \
253+
"sk-"
254+
255+
prompt_secret "GEMINI_API_KEY" \
256+
"Google Gemini API key" \
257+
"https://aistudio.google.com/apikey"
258+
240259
prompt_secret "OPENCODE_ZEN_API_KEY" \
241-
"LLM API key (Anthropic/OpenAI)" \
242-
"https://docs.anthropic.com/en/api/getting-started" \
243-
"required"
260+
"OpenCode Zen API key (multi-provider router)" \
261+
"https://opencode.ai"
262+
263+
HAS_LLM_KEY=false
264+
for k in ANTHROPIC_API_KEY OPENAI_API_KEY GEMINI_API_KEY OPENCODE_ZEN_API_KEY; do
265+
if [ -n "${ENV_VARS[$k]:-}" ]; then HAS_LLM_KEY=true; break; fi
266+
done
267+
if [ "$HAS_LLM_KEY" = false ]; then
268+
warn "No LLM key set — agent needs at least one to work"
269+
fi
270+
271+
echo ""
244272

245273
prompt_secret "GITHUB_TOKEN" \
246274
"GitHub personal access token" \
@@ -321,6 +349,9 @@ ENV_CONTENT="# Baudbot agent configuration
321349

322350
# Write in a sensible order
323351
ordered_keys=(
352+
ANTHROPIC_API_KEY
353+
OPENAI_API_KEY
354+
GEMINI_API_KEY
324355
OPENCODE_ZEN_API_KEY
325356
GITHUB_TOKEN
326357
SLACK_BOT_TOKEN
@@ -358,7 +389,14 @@ header "Launch"
358389

359390
# Check if we have the minimum required secrets
360391
MISSING=""
361-
for key in OPENCODE_ZEN_API_KEY GITHUB_TOKEN SLACK_BOT_TOKEN SLACK_APP_TOKEN SLACK_ALLOWED_USERS; do
392+
HAS_LLM=false
393+
for k in ANTHROPIC_API_KEY OPENAI_API_KEY GEMINI_API_KEY OPENCODE_ZEN_API_KEY; do
394+
if [ -n "${ENV_VARS[$k]:-}" ]; then HAS_LLM=true; break; fi
395+
done
396+
if [ "$HAS_LLM" = false ]; then
397+
MISSING+=" - LLM key (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, or OPENCODE_ZEN_API_KEY)\n"
398+
fi
399+
for key in GITHUB_TOKEN SLACK_BOT_TOKEN SLACK_APP_TOKEN SLACK_ALLOWED_USERS; do
362400
if [ -z "${ENV_VARS[$key]:-}" ]; then
363401
MISSING+=" - $key\n"
364402
fi

pi/settings.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
22
"lastChangelogVersion": "0.52.12",
3-
"defaultProvider": "opencode-zen",
4-
"defaultModel": "claude-opus-4-6",
53
"skills": [
64
"~/.pi/agent/skills"
75
],

pi/skills/control-agent/SKILL.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,21 @@ If dev-agent reports repeated failures (e.g. CI failing after 3+ fix attempts, o
8686

8787
## Spawning Sub-Agents
8888

89-
When launching a new pi session (e.g. dev-agent), use `tmux` with the `PI_SESSION_NAME` env var:
89+
When launching a new pi session (e.g. dev-agent), use `tmux` with the `PI_SESSION_NAME` env var.
90+
91+
Pick the model based on which API key is available (check env vars in this order):
92+
93+
**Coding / orchestration (top-tier):**
94+
95+
| API key | Model |
96+
|---------|-------|
97+
| `ANTHROPIC_API_KEY` | `anthropic/claude-opus-4-6` |
98+
| `OPENAI_API_KEY` | `openai/gpt-5.3-codex` |
99+
| `GEMINI_API_KEY` | `google/gemini-3-pro-preview` |
100+
| `OPENCODE_ZEN_API_KEY` | `opencode-zen/claude-opus-4-6` |
90101

91102
```bash
92-
tmux new-session -d -s dev-agent "export PATH=\$HOME/.varlock/bin:\$HOME/opt/node-v22.14.0-linux-x64/bin:\$PATH && export PI_SESSION_NAME=dev-agent && varlock run --path ~/.config/ -- pi --session-control --skill ~/.pi/agent/skills/dev-agent"
103+
tmux new-session -d -s dev-agent "export PATH=\$HOME/.varlock/bin:\$HOME/opt/node-v22.14.0-linux-x64/bin:\$PATH && export PI_SESSION_NAME=dev-agent && varlock run --path ~/.config/ -- pi --session-control --skill ~/.pi/agent/skills/dev-agent --model <MODEL_FROM_TABLE_ABOVE>"
93104
```
94105

95106
**Important**:
@@ -216,13 +227,22 @@ The script:
216227

217228
### Spawning sentry-agent
218229

219-
The sentry-agent triages Sentry alerts and investigates critical issues via the Sentry API. It runs on **Haiku 4.5** (cheap) via OpenCode Zen.
230+
The sentry-agent triages Sentry alerts and investigates critical issues via the Sentry API. It runs on a cheap model to save tokens.
231+
232+
Pick the model based on which API key is available (check env vars in this order):
233+
234+
| API key | Model |
235+
|---------|-------|
236+
| `ANTHROPIC_API_KEY` | `anthropic/claude-haiku-4-5` |
237+
| `OPENAI_API_KEY` | `openai/gpt-5-mini` |
238+
| `GEMINI_API_KEY` | `google/gemini-3-flash-preview` |
239+
| `OPENCODE_ZEN_API_KEY` | `opencode-zen/claude-haiku-4-5` |
220240

221241
```bash
222-
tmux new-session -d -s sentry-agent "export PATH=\$HOME/.varlock/bin:\$HOME/opt/node-v22.14.0-linux-x64/bin:\$PATH && export PI_SESSION_NAME=sentry-agent && varlock run --path ~/.config/ -- pi --session-control --skill ~/.pi/agent/skills/sentry-agent --model opencode-zen/claude-haiku-4-5"
242+
tmux new-session -d -s sentry-agent "export PATH=\$HOME/.varlock/bin:\$HOME/opt/node-v22.14.0-linux-x64/bin:\$PATH && export PI_SESSION_NAME=sentry-agent && varlock run --path ~/.config/ -- pi --session-control --skill ~/.pi/agent/skills/sentry-agent --model <MODEL_FROM_TABLE_ABOVE>"
223243
```
224244

225-
**Model note**: Use `opencode-zen/*` models for headless agents. `github-copilot/*` models reject Personal Access Tokens and will fail in non-interactive sessions.
245+
**Model note**: `github-copilot/*` models reject Personal Access Tokens and will fail in non-interactive sessions.
226246

227247
The sentry-agent operates in **on-demand mode** — it does NOT poll. Sentry alerts arrive via the Slack bridge in real-time and are forwarded by you. The sentry-agent uses `sentry_monitor get <issue_id>` to investigate when asked.
228248

0 commit comments

Comments
 (0)