/grok3-api-cf

Grok 3 via API with Cloudflare for free

Primary LanguageJavaScript

Grok3 API Cloudflare Worker

A Cloudflare Worker implementation for the Grok3 API.

Deployment

npx wrangler deploy
npx wrangler secret put AUTH_TOKEN
npx wrangler secret put GROK3_COOKIE

Explain

  • AUTH_TOKEN: The token you will be using like an OPENAI API token, see below in the curl command
  • GROK3_COOKIE: It looks like sso=ey...; sso-rw=ey..., you can copy it from your browser

Usage

curl -H "Authorization: Bearer AUTH_TOKEN" \
-X POST 'https://your-worker-url.workers.dev/v1/chat/completions' \
-H 'Content-Type: application/json' \
-d '{"messages": [{"role": "user", "content": "Hello"}], "model": "grok-3"}'

Special Thanks

License

MIT