Files
Richard SolomouandGitHub 6f690bae1a feat(examples): add Dedalus Labs and Cloudflare AI Gateway examples (#3391)
* 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
2026-04-16 13:48:27 +03:00

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