GreenTokens

Search

Search models, guides, docs and the FAQ.

Getting started

Authentication

Send your API key, read request IDs, and how spend limits affect requests.

API keys

Every API request needs a GreenTokens key. Keys start with sk-gt-, are created on the API Keys page of the dashboard, and are shown in full only once. We store only a hash.

Send the key in either header. Use whichever your SDK or tool sends by default:

curl https://api.greentokens.io/v1/models \
  -H "Authorization: Bearer $GREENTOKENS_API_KEY"
Sending both headers with different keys is rejected with 401. Never put a key in frontend code or a public repository: anyone holding it can spend your balance.

Spend limits, pausing and revoking

Each key can carry its own controls, set on the API Keys page:

  • Daily and monthly spend limits. Once a limit is reached, requests with that key return 402 until the period resets.
  • Pause. A paused key returns 401 until you resume it.
  • Revoke. Permanent. Create a new key to replace it.

A good default is one key per application, agent or environment, each with its own limit, so one runaway loop can't drain your whole balance.

Request IDs

Every response carries an x-request-id header. The same ID appears in the Requests log of your dashboard. Include it when you contact support so we can find the exact call.

curl -i https://api.greentokens.io/v1/chat/completions \
  -H "Authorization: Bearer $GREENTOKENS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-5", "messages": [{"role": "user", "content": "Hi"}]}'

# HTTP/2 200
# x-request-id: 3f9c2a1e-…