TokenLab

Getting Started

Quickstart

Make your first TokenLab API request with cURL, Python, JavaScript, Go, or PHP. Set up your API key, configure the endpoint, and verify a Chat Completions response.

Get an API key

Create an account

Sign up at tokenlab.sh using your email, Gmail, or GitHub account.

Create and save an API key

Open API Keys in your workspace. Create a key and save the full value immediately; it is shown only once. If you already saved a full key, use that value. The prefix shown or copied from the list cannot authenticate requests.

Check the workspace balance

Check your available balance in Billing. This request is billed at the selected model’s current price; add funds if needed.

Keep the API key secret. Do not put it in client-side code or a public repository.

Set the key for this terminal

The commands below keep the key out of the command itself. They set it only for the current terminal and its child processes. Use a secret manager for deployed applications.

printf 'TokenLab API key: '
read -r -s TOKENLAB_API_KEY
printf '\n'
export TOKENLAB_API_KEY

Install a client

pip install openai

Send your first request

For most new integrations, start with Chat Completions on POST /v1/chat/completions.

curl https://api.tokenlab.sh/v1/chat/completions \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-terra","messages":[{"role":"user","content":"Reply only with OK."}]}'

Save one SDK example as quickstart.py, quickstart.mjs, main.go, or quickstart.php, then run python quickstart.py, node quickstart.mjs, go run ., or php quickstart.php. Python, JavaScript, and Go use official OpenAI SDKs; PHP uses the community-maintained OpenAI PHP client (PHP 8.2+).

Use POST /v1/responses only when you need Responses-specific behavior. Support for Responses-only fields depends on the selected model.

Confirm the result

A successful request returns a non-empty answer. Open Requests in the same workspace to check its model, status, and usage. For errors, follow troubleshooting. Changing the model or adding streaming is a separate next step in the SDK guide.

Keep building

On this page