Quickstart
Make your first request in a few minutes: create a key, set the base URL, call a model.
1. Get a key
- Sign in with your email and add funds from the Billing page.
- Create a key on the API Keys page. It starts with
sk-gt-and is shown only once, so store it straight away. - Export it so the examples below can read it:
export GREENTOKENS_API_KEY="sk-gt-…"
2. Point your client at GreenTokens
GreenTokens speaks the OpenAI and Anthropic formats, so the official SDKs work unchanged. Only the base URL differs between them:
- OpenAI SDKs and OpenAI-compatible tools:
https://api.greentokens.io/v1 - Anthropic SDKs and Claude Code:
https://api.greentokens.io
3. Make your first request
curl 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": "Say hello in five words."}]
}'Prefer the Anthropic SDK? The same call through the Messages API:
# pip install anthropic
import os
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.greentokens.io",
api_key=os.environ["GREENTOKENS_API_KEY"],
)
message = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(message.content[0].text)Use any model ID from the models page or
GET /v1/models. Responses echo the same ID you sent.