This Worker serves the static frontend and stores anonymous cloud performance history in D1. It deliberately stores endpoint hosts and performance metrics only. API keys, raw prompts, and model responses are not persisted.
-
Install Wrangler and authenticate:
npm install npx wrangler login
-
Create the D1 database and copy its ID into
wrangler.toml:npx wrangler d1 create llm_api
-
Set
account_id,ALLOWED_ORIGIN, and the D1database_idinwrangler.toml. -
Initialize the schema and deploy the frontend plus API:
npx wrangler d1 execute llm_api --remote --file=schema.sql npx wrangler deploy
-
Open the deployed Worker URL, for example
https://llm-api-test-history.example.workers.dev.
The Worker exposes GET, POST, and DELETE routes under /api/runs.
The browser-generated anonymous client ID is hashed before it is stored in D1.