Environment and configuration
The typed list is Env in api/src/env.ts. See Configuration for how the three sources (wrangler.jsonc, .dev.vars, secrets) fit together.
Bindings
| Binding | Type | Purpose |
|---|---|---|
ASSETS | Fetcher | Workers Static Assets: the built SPA in frontend/dist, with single-page-application fallback. /api/* runs the Worker first. |
DB | D1Database | The D1 database claimpilot-chat. Used when DATABASE_PROVIDER is d1. |
Variables
| Variable | Kind | Default in code | Pinned in wrangler.jsonc | Notes |
|---|---|---|---|---|
DATABASE_PROVIDER | var | d1 | d1 (default env), neon (env.neon) | d1, neon or none |
DATABASE_URL | secret | none | no | Neon connection string |
AI_PROVIDER | var | Gemini | no | scripted for tests only |
GEMINI_API_KEY | secret | none | no | Google AI Studio key |
GEMINI_MODEL | var | gemini-3.1-flash-lite | yes | Text chat |
GEMINI_LIVE_MODEL | var | gemini-3.1-flash-live-preview | yes | Voice |
GENERATOR_MODEL | var | GEMINI_MODEL | yes | Claim generator |
GEMINI_THINKING_LEVEL | var | model default | no (commented example) | low, medium, high; anything else is ignored |
GEMINI_VOICE | var | Charon | yes | Prebuilt Live voice |
AI_GATEWAY_ACCOUNT_ID | var | none | yes | With AI_GATEWAY_ID, turns the gateway on |
AI_GATEWAY_ID | var | none | yes (claimpilot-chat) | Blank values count as unset |
CF_AIG_TOKEN | secret | none | no | Required when the gateway is authenticated |
ALLOWED_ORIGINS | var | unset: no cross-origin embedding | yes | Comma-separated; :* matches any numeric port |
EMBED_KEY | secret | unset: open | no | Gates chat, voice and feedback |
/api/health reports the models, the store and the gateway actually in use.
The e2e Worker
The Playwright suite runs its own Worker with e2e/worker.env, which sets AI_PROVIDER=scripted, DATABASE_PROVIDER=d1, blanks every key, URL and gateway id, and allows one test origin (http://allowed.example). It holds no secrets and stops wrangler reading api/.dev.vars.
The CLI
npm run generate and npm run copy-claims run in plain Node. They read GEMINI_API_KEY, GENERATOR_MODEL, DATABASE_URL and the gateway variables from the environment, or from api/.dev.vars for anything unset (loadDevVars). db/migrate.mjs reads DATABASE_URL the same way.
The docs site
| Variable | Default | Purpose |
|---|---|---|
DOCS_URL | http://localhost:3000 | The site's public URL, for canonical links and the sitemap |
DOCS_BASE_URL | / | The path it is served under |