Quickstart

Make your first Claud request in a few minutes.

1. Get an API key#

Sign in and open API keys in the dashboard. Click Create key, give it a name, and copy the key that starts with sk-. The full key is shown once; Claud only stores a hash of it.

Store it as an environment variable rather than pasting it into source code:

Shell
export CLAUD_API_KEY="sk-..."
Warning:

New accounts must verify their email address before the API accepts requests. Check your inbox for the verification link or resend it from Settings.

2. Send a chat completion#

curl https://api.claudkey.com/v1/chat/completions \
  -H "Authorization: Bearer $CLAUD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claud-5.1",
    "messages": [
      { "role": "system", "content": "You are a concise assistant." },
      { "role": "user", "content": "Explain what a mutex is in two sentences." }
    ]
  }'

A successful response looks like this:

JSON
{
  "id": "chatcmpl-01J9X3Q5K7M2N8P4R6T0V2W4Y6",
  "object": "chat.completion",
  "created": 1789467600,
  "model": "claud-5.1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A mutex is a lock that lets only one thread at a time enter a critical section of code. Other threads that try to acquire it wait until the holder releases it, which prevents concurrent modification of shared state."
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 31,
    "completion_tokens": 47,
    "total_tokens": 78,
    "prompt_tokens_details": { "cached_tokens": 0 },
    "completion_tokens_details": { "reasoning_tokens": 0 },
    "claud_tokens_debited": "83",
    "claud_cost_usd": "0.000164"
  },
  "system_fingerprint": "fp_claud"
}

The usage object includes two Claud-specific fields: claud_tokens_debited (what the request cost from your balance) and claud_cost_usd (the same amount in dollars). The response headers carry the same information as x-claud-tokens-debited and your remaining balance as x-claud-balance.

3. Stream the response#

Set "stream": true to receive tokens as they are generated. The OpenAI SDKs handle the event stream for you:

curl https://api.claudkey.com/v1/chat/completions \
  -H "Authorization: Bearer $CLAUD_API_KEY" \
  -H "Content-Type: application/json" \
  -N \
  -d '{
    "model": "claud-5.1",
    "stream": true,
    "messages": [{ "role": "user", "content": "Write a haiku about compilers." }]
  }'

See Streaming for the exact chunk format, including the final usage and billing events.

4. Check your balance and usage#

Shell
curl https://api.claudkey.com/v1/billing/balance \
  -H "Authorization: Bearer $CLAUD_API_KEY"
JSON
{
  "object": "balance",
  "available_tokens": "25998200",
  "purchased_tokens": "20000000",
  "subscription_tokens": "5998200",
  "reserved_tokens": "0",
  "approx_value_usd": "52.00",
  "token_rate": { "micro_usd_per_token": 2, "tokens_per_usd": 500000 }
}

The Usage page in the dashboard shows the same data with charts and a per-request log, and GET /v1/usage exposes it programmatically.

Where to go next#