Quickstart

Quickstart

Five steps. The first four are copy-paste; the last one proves it worked against the
real API rather than a mock.

1. Get a key

Open the dashboard, go to API keys, and create one. The plaintext is shown once, so
copy it immediately. A key starts with sk-.

2. Check your balance

Every call is billed, so an empty wallet answers 402 before the model is ever reached.
Read it first:

curl https://hisoka.ai/api/v1/balance \
  -H "Authorization: Bearer $HISOKA_API_KEY"
{
  "object": "balance",
  "currency": "USD",
  "balance_usd": 4.82,
  "balance_micro_usd": 4820000,
  "credits": "4820",
  "credit_value_usd": 0.001
}
Free models still need a small balance

A model marked is_free settles at zero per call, but it still needs a small standing
balance, because a free call consumes upstream capacity. A drained account is refused
even on a free model, with a message that names the floor. Top up, or link Telegram
where a reward is available.

3. List the models

No key required. This is the same list the public price page renders.

curl https://hisoka.ai/api/v1/models

Read id (the string you send), pricing (USD per million tokens), and
capabilities.modalities (what you may send).

4. Send your first request

curl https://hisoka.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $HISOKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3-flash",
    "messages": [
      { "role": "user", "content": "Name three prime numbers." }
    ]
  }'

The reply is an ordinary OpenAI chat completion, plus a hisoka block:

{
  "id": "chatcmpl-01M73N2HP4HDDZH803J1C120HT",
  "object": "chat.completion",
  "model": "glm-5.3-flash",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "2, 3, 5." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 18, "completion_tokens": 8, "total_tokens": 26 },
  "hisoka": {
    "model": "glm-5.3-flash",
    "usd_charged": 0.000014,
    "usd_micro_charged": 14,
    "balance": "4.819986",
    "max_tokens": null,
    "cap_raised_from": null,
    "client": "curl"
  }
}

usd_micro_charged is the integer the wallet actually moved. Read that one when you are
reconciling, not the rounded dollar figure.

5. Prove it charged what it said

The balance should have dropped by exactly the micro-USD in the response.

curl "https://hisoka.ai/api/v1/transactions?limit=1" \
  -H "Authorization: Bearer $HISOKA_API_KEY"

You should see one usage row whose amount_micro_usd matches
hisoka.usd_micro_charged, negative because money left the wallet.

Where to go next