mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-11-03 00:53:53 +00:00
* feat(examples): add Dedalus Labs and Cloudflare AI Gateway examples * docs: include POSTHOG_API_KEY in Cloudflare example README * fix(examples): use cf-aig-authorization header for Cloudflare AI Gateway auth The gateway requires the upstream provider key as the main API key and the CF AI Gateway token via the cf-aig-authorization header. * fix(examples): update Cloudflare .env.example to use CF_AIG env vars
568 B
568 B
Cloudflare AI Gateway + PostHog AI Examples
Track Cloudflare AI Gateway API calls with PostHog via the OpenAI-compatible unified endpoint.
Setup
pnpm install
cp .env.example .env
# Fill in your API keys in .env
POSTHOG_API_KEY, OPENAI_API_KEY, CF_AIG_TOKEN, CF_AIG_ACCOUNT_ID, and CF_AIG_GATEWAY_ID are required. CF_AIG_TOKEN is your Cloudflare AI Gateway API token, passed via the cf-aig-authorization header.
Examples
- chat.ts - Chat completions via Cloudflare AI Gateway
Run
source .env
npx tsx chat.ts