Skip to main content

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​

BindingTypePurpose
ASSETSFetcherWorkers Static Assets: the built SPA in frontend/dist, with single-page-application fallback. /api/* runs the Worker first.
DBD1DatabaseThe D1 database claimpilot-chat. Used when DATABASE_PROVIDER is d1.

Variables​

VariableKindDefault in codePinned in wrangler.jsoncNotes
DATABASE_PROVIDERvard1d1 (default env), neon (env.neon)d1, neon or none
DATABASE_URLsecretnonenoNeon connection string
AI_PROVIDERvarGemininoazure for Azure AI Foundry (chat and generation; voice stays on Gemini). scripted for tests only
AZURE_AI_ENDPOINTvarnonenoFoundry resource endpoint; /openai/v1 is added
AZURE_AI_API_KEYsecretnonenoFoundry resource key
AZURE_AI_DEPLOYMENTvarnonenoChat deployment name
AZURE_AI_GENERATOR_DEPLOYMENTvarAZURE_AI_DEPLOYMENTnoClaim generator deployment
AZURE_AI_REASONING_EFFORTvarmodel defaultnolow, medium, high, or off for a deployment without reasoning
GEMINI_API_KEYsecretnonenoGoogle AI Studio key
GEMINI_MODELvargemini-3.1-flash-liteyesText chat
GEMINI_LIVE_MODELvargemini-3.1-flash-live-previewyesVoice
GENERATOR_MODELvarGEMINI_MODELyesClaim generator
GEMINI_THINKING_LEVELvarmodel defaultno (commented example)low, medium, high; anything else is ignored
GEMINI_VOICEvarCharonyesPrebuilt Live voice
VOICE_ENABLEDvaronnofalse, off, no or 0 turns voice off: /api/voice answers 503 and the widget shows no microphone
AI_GATEWAY_ACCOUNT_IDvarnoneyesWith AI_GATEWAY_ID, turns the gateway on
AI_GATEWAY_IDvarnoneyes (claimpilot-chat)Blank values count as unset
CF_AIG_TOKENsecretnonenoRequired when the gateway is authenticated
ALLOWED_ORIGINSvarunset: no cross-origin embeddingyesComma-separated; :* matches any numeric port
EMBED_KEYsecretunset: opennoGates chat, voice and feedback
ATTACHMENTSvarallno (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_OVERRIDESvaronno (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​

VariableDefaultPurpose
DOCS_URLhttp://localhost:3000The site's public URL, for canonical links and the sitemap
DOCS_BASE_URL/The path it is served under