halfoff.devDocs
Get a key
Get started

Quickstart

Get a key, send a GPT, Claude or Gemini request at half the official price with your existing SDK, stream it, and see what it cost.

This page takes you from an empty account to a streamed answer and a line in your usage log. It uses the OpenAI SDK because most code already has it, but the same key works with the Anthropic and Google SDKs.

  1. Get a key

    Create an account, go to API keys and press New key. The key begins with ho- and appears only this once, so copy it before closing the dialog.

    Keep it out of your source files by exporting it:

    Shell
    export HALFOFF_API_KEY="ho-..."

    You also need a positive balance. Top up from the dashboard with PayPal; see Billing.

  2. Point your client at Half Off Dev

    Point the client at https://halfoff.dev/v1 and pass your key. Nothing else in the call changes.

    curl https://halfoff.dev/v1/chat/completions \
      -H "Authorization: Bearer $HALFOFF_API_KEY" \
      -H "content-type: application/json" \
      -d '{
        "model": "gpt-6.1-sol",
        "messages": [{"role": "user", "content": "Explain a race condition in two sentences."}]
      }'

    Prefer the native SDKs? Claude through the Anthropic SDK is in Anthropic Messages, Gemini through the Google SDK in Gemini.

  3. Stream tokens as they arrive

    Set stream to true and read the chunks. The event format is exactly what the vendor's own API sends.

    curl -N https://halfoff.dev/v1/chat/completions \
      -H "Authorization: Bearer $HALFOFF_API_KEY" \
      -H "content-type: application/json" \
      -d '{"model": "gpt-6.1-sol", "stream": true,
           "messages": [{"role": "user", "content": "List the planets, one per line."}]}'

    More detail in Streaming.

  4. See what you paid

    Open Logs. Each call shows up within seconds with its input and output tokens, the amount charged, time to first token and tokens per second. Every response also has an x-halfoff-request-id header; quote it if you ever ask support about that call.

Finding model ids#

GET /v1/models needs no key and returns every model with its context window and price. The model list page shows the same data.

cURL
curl https://halfoff.dev/v1/models

Ids are matched loosely, so claude-sonnet-5.5, claude-sonnet-5-5 and anthropic/claude-sonnet-5.5 all reach the same model.

Where to go from here#