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 | azure for Azure AI Foundry (chat and generation; voice stays on Gemini). scripted for tests only |
AZURE_AI_ENDPOINT | var | none | no | Foundry resource endpoint; /openai/v1 is added |
AZURE_AI_API_KEY | secret | none | no | Foundry resource key |
AZURE_AI_DEPLOYMENT | var | none | no | Chat deployment name |
AZURE_AI_GENERATOR_DEPLOYMENT | var | AZURE_AI_DEPLOYMENT | no | Claim generator deployment |
AZURE_AI_REASONING_EFFORT | var | model default | no | low, medium, high, or off for a deployment without reasoning |
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 |
VOICE_ENABLED | var | on | no | false, off, no or 0 turns voice off: /api/voice answers 503 and the widget shows no microphone |
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 |
ATTACHMENTS | var | all | no (commented) | Files a question may carry: all (every kind the adapter reads), text (text files only: no images, PDFs, audio or video, which reach the model as they are) or off. See Attached files |
PROMPT_OVERRIDES | var | on | no (commented) | off (or false, no, 0) stops the browser's Prompt Lab versions applying to chat and voice. While on, anyone who can reach the API can change the prompts. system.safety is never overridable |
/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, the gateway variables and, with AI_PROVIDER=azure, the AZURE_AI_* 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 |