This document lists the key configuration needed to run David safely and reliably.
Create from src/secrets.h.example and keep it local only.
WIFI_SSID: Wi-Fi network name used by the M5StickCWIFI_PASSWORD: Wi-Fi passwordAPI_BASE_URL: deployed worker URL (for examplehttps://m5stick-api-gate.<subdomain>.workers.dev)DEVICE_ID: stable identifier for this device (for exampledavid-01)DEVICE_SHARED_SECRET: shared secret used for HMAC request signing
Security note:
src/secrets.his gitignored and must never be committed.
Where values come from:
WIFI_SSID/WIFI_PASSWORD: your local Wi-Fi or hotspotAPI_BASE_URL: your deployed worker URL (https://<name>.<subdomain>.workers.dev)DEVICE_ID: your chosen stable ID (for exampledavid-01)DEVICE_SHARED_SECRET: generate locally (openssl rand -hex 32)
Set these in production with Wrangler:
OPENAI_API_KEY: project API key used server-side by the workerDEVICE_SHARED_SECRET: shared secret matching firmware for signed request validation
Optional hardened mode:
- Store per-device shared secrets in KV (
device:<deviceId>) and rotate centrally.
Where values come from:
OPENAI_API_KEY: OpenAI dashboard -> project API keysDEVICE_SHARED_SECRET: must match firmwareDEVICE_SHARED_SECRET
wrangler.toml should stay local/ignored.
Use the committed template cloudflare-worker/wrangler.toml.example and copy it locally before deploy.
cp cloudflare-worker/wrangler.toml.example cloudflare-worker/wrangler.tomlCore runtime controls:
CHAT_MODEL: LLM for response generationTRANSCRIBE_MODEL: speech-to-text modelTRANSCRIBE_LANGUAGE: language hint for transcription (defaulten)TRANSCRIBE_PROMPT: optional custom transcription prompt for long-utterance behaviorTTS_MODEL: text-to-speech modelTTS_VOICE: selected voiceTTS_INSTRUCTIONS: voice style guidanceRATE_LIMIT_PER_MIN: per-device request capMAX_TEXT_CHARS: incoming text guardrailMAX_REPLY_CHARS: response length capREPLY_MAX_TOKENS: token cap for generated repliesMAX_BODY_BYTES: max signed request payload accepted by worker (default 2,000,000)
Observability:
[observability] enabled = truehead_sampling_ratecontrols sampled invocation logs
For this project, allow only what the worker uses:
- Responses (
/v1/responses) - Text-to-speech (
/v1/audio/speech) - Speech-to-text (
/v1/audio/transcriptions) or equivalent transcription capability shown in your project settings - List models (optional but useful for diagnostics)
Recommended hardening:
- Restrict model access to only your selected chat/transcribe/tts models
- Set project budget caps and usage alerts
- Keep the API key only in worker secrets, never firmware
Before commit/push:
git status --shortdoes not showsrc/secrets.hgit status --shortdoes not showcloudflare-worker/.envgit status --shortdoes not showcloudflare-worker/wrangler.toml- No plaintext API keys or shared secrets in tracked files
Verify ignore rules:
git check-ignore -v src/secrets.h cloudflare-worker/.env cloudflare-worker/wrangler.tomlQuick scan:
rg -n "sk-|OPENAI_API_KEY|DEVICE_SHARED_SECRET|WIFI_PASSWORD" .Review hits before pushing.