This page is generated from the same OpenAPI 3.1 document that /assets/hisoka.openapi.json serves, so it cannot drift from the specification or from
the pages beside it.
Use it as a lookup: find the endpoint, read the request and response fields, then copy the
curl. The prose pages explain why; this one lists what.
Prefer a machine-readable copy
Download the raw specification and point any OpenAPI tool at it:
Authentication. Send your key as Authorization: Bearer sk-.... Anthropic clients may send x-api-key instead; the SDKs accept either.
Which endpoint to use. Pick the one your client already speaks. /chat/completions for OpenAI-style clients (Cline, Roo, Continue, aider), /responses for Codex CLI, /messages for Claude Code, Cursor and Zed. There is no fallback in those clients, so the endpoint is not optional.
Billing. Every call settles against your prepaid wallet in micro-USD, priced from the model you asked for. The hisoka block in a response tells you what that call cost and what is left. A model with is_free true settles at zero, but a free call still needs a small standing balance because it consumes upstream capacity.
Errors. Every failure returns the same nested envelope with a stable code, a request_id, and x-should-retry. Branch on the code, never on the message text.
Downloadable spec. This page is generated from /openapi.json. Agents that prefer text can read /llms.txt (one line per operation) or /llms-full.txt (request and response fields with a runnable curl).
GET / - Discover the API
GET/
Discover the API
Answers with the base URL and every endpoint, so a client that only knows the host can find the rest. Safe to poll as a liveness check.
Responses
Status
Description
200
The endpoint map.
object
200 body
application/json
Field
Type
Description / Example
object
string
name
string
api_version
string
base_url
string
endpoints
map[string, string]
Description
Absolute URLs, so a client does not have to join paths itself.
wire_formats
array[string]
auth
object
docs
string
GET /models - List models
GET/models
List models
Every model you can call, with its price and capabilities. No key required: this is the same list the public price page shows.
An out-of-stock model is absent rather than listed and failing, so a buyer never pays for a dead pool.
Responses
Status
Description
200
The catalogue.
object
200 body
application/json
Field
Type
Description / Example
object
"list"
data
array[object]Show fields
Field
Type
Description / Example
id
string
Description
The id you send in a request. This is the only spelling a client needs.
object
"model"
owned_by
string
label
string
Description
Display name, for a picker.
api_model
string
Description
Upstream id. Informational: send id, not this.
is_free
boolean
Description
A free model settles at zero. It still needs the standing balance floor described in Getting started.
pricing
objectShow fields
Field
Type
Description / Example
input_per_mtok
number
Description
USD per million input tokens. Exactly 0.0 on a free model, so a client computing its own cost cannot show a charge that never happened.
output_per_mtok
number
Description
USD per million output tokens.
currency
"USD"
capabilities
objectShow fields
Field
Type
Description / Example
modalities
array["text" | "image" | "video" | "audio"]
Description
What you may send. Sending a modality the model does not list is refused with 400 before it reaches the provider.
label
string
vision
boolean
tools
boolean
Description
Whether a tool schema may be sent at all.
reasoning
boolean
prompt_cache
boolean
multiplier
number
Description
Legacy display coefficient. Ignore it and use pricing.
max_output
integer
Description
Completion ceiling for this model.
context_window
integer
Description
Input and output share this window. Size your own budget from it.
max_input_tokens
integer
Description
Prompt budget. Equal to the window: a completion cap is a ceiling, not a reservation.
GET /models/{model} - Retrieve one model
GET/models/{model}
Retrieve one model
The same row as the list entry. OpenAI SDKs call this from models.retrieve(id); without it the SDK raises NotFoundError on a route that only exists in its own client.
Parameters
Name
In
Type
Description / Example
model*
path
string
Description
The public model id.
Responses
Status
Description
200
One model.
object
200 body
application/json
Field
Type
Description / Example
id
string
Description
The id you send in a request. This is the only spelling a client needs.
object
"model"
owned_by
string
label
string
Description
Display name, for a picker.
api_model
string
Description
Upstream id. Informational: send id, not this.
is_free
boolean
Description
A free model settles at zero. It still needs the standing balance floor described in Getting started.
pricing
objectShow fields
Field
Type
Description / Example
input_per_mtok
number
Description
USD per million input tokens. Exactly 0.0 on a free model, so a client computing its own cost cannot show a charge that never happened.
output_per_mtok
number
Description
USD per million output tokens.
currency
"USD"
capabilities
objectShow fields
Field
Type
Description / Example
modalities
array["text" | "image" | "video" | "audio"]
Description
What you may send. Sending a modality the model does not list is refused with 400 before it reaches the provider.
label
string
vision
boolean
tools
boolean
Description
Whether a tool schema may be sent at all.
reasoning
boolean
prompt_cache
boolean
multiplier
number
Description
Legacy display coefficient. Ignore it and use pricing.
max_output
integer
Description
Completion ceiling for this model.
context_window
integer
Description
Input and output share this window. Size your own budget from it.
max_input_tokens
integer
Description
Prompt budget. Equal to the window: a completion cap is a ceiling, not a reservation.
404
No such model id.
object
404 body
application/json
Field
Type
Description / Example
error
objectShow fields
Field
Type
Description / Example
message
string
Description
Human sentence. The code appears inside it too, because a pasted screenshot carries the sentence and not the field.
Stable machine code. Branch on this, never on the message.
support
string
Description
Contact address for an account or billing problem.
docs
string
Description
Where the current reference lives.
request_id
string
Description
Quote this in any report. It matches the X-Request-Id header.
GET /quota - Read the quota shape
GET/quota
Read the quota shape
Kept for clients that expect a quota object. It mirrors the wallet balance, which is the only limit that applies: there is no separate request allowance.
Responses
Status
Description
200
The quota view.
object
200 body
application/json
Field
Type
Description / Example
object
string
balance
string
credits
objectShow fields
Field
Type
Description / Example
remaining
string
used
integer
limit
string
unlimited
boolean
window
string | null
401
Missing, revoked or expired key.
object
401 body
application/json
Field
Type
Description / Example
error
objectShow fields
Field
Type
Description / Example
message
string
Description
Human sentence. The code appears inside it too, because a pasted screenshot carries the sentence and not the field.
Stable machine code. Branch on this, never on the message.
support
string
Description
Contact address for an account or billing problem.
docs
string
Description
Where the current reference lives.
request_id
string
Description
Quote this in any report. It matches the X-Request-Id header.
GET /balance - Read your balance
GET/balance
Read your balance
The same figures the dashboard shows. Reported in dollars and in micro-USD, so a client reconciling cent-level rounding has the exact integer instead of a float.
Responses
Status
Description
200
The wallet.
object
200 body
application/json
Field
Type
Description / Example
object
"balance"
currency
"USD"
balance_usd
number
balance_micro_usd
integer
Description
What the wallet actually holds, as an integer.
credits
string
Description
The same balance expressed in credits.
credit_value_usd
number
Description
What one credit is worth, so the two numbers can be reconciled.
401
Missing, revoked or expired key.
object
401 body
application/json
Field
Type
Description / Example
error
objectShow fields
Field
Type
Description / Example
message
string
Description
Human sentence. The code appears inside it too, because a pasted screenshot carries the sentence and not the field.
Stable machine code. Branch on this, never on the message.
support
string
Description
Contact address for an account or billing problem.
docs
string
Description
Where the current reference lives.
request_id
string
Description
Quote this in any report. It matches the X-Request-Id header.
GET /transactions - List transactions
GET/transactions
List transactions
Per-call rows from your ledger, newest first. Negative is money out, positive is money in, matching the wallet, so you never have to learn a per-type sign convention.
Stable machine code. Branch on this, never on the message.
support
string
Description
Contact address for an account or billing problem.
docs
string
Description
Where the current reference lives.
request_id
string
Description
Quote this in any report. It matches the X-Request-Id header.
GET /transactions/{publicId} - Retrieve one transaction
GET/transactions/{publicId}
Retrieve one transaction
One row, by its public id or its numeric id. Scoped to your own ledger: another account’s id answers 404 rather than 403, so the endpoint cannot be used to probe for ids.
Parameters
Name
In
Type
Description / Example
publicId*
path
string
Responses
Status
Description
200
One ledger row.
Transaction
200 body
application/json
Field
Type
Description / Example
id
string
Description
Public id. Also accepted by the single-transaction endpoint.
Stable machine code. Branch on this, never on the message.
support
string
Description
Contact address for an account or billing problem.
docs
string
Description
Where the current reference lives.
request_id
string
Description
Quote this in any report. It matches the X-Request-Id header.
POST /chat/completions - Create a chat completion
POST/chat/completions
Create a chat completion
The OpenAI chat wire. Most clients use this one.
[!TIP]
Leave max_tokens out unless you need a specific ceiling. Input and output share one window, so sending the model ceiling leaves no room for your prompt and the provider answers 400.
[!NOTE]
stream: true sends server-sent events. The final frame carries the same hisoka block, so billing is readable on a stream too.
A reasoning model may answer with empty content and finish_reason: stop after spending its whole budget thinking. That is a finished turn, not an outage: check finish_reason before retrying, or you pay twice for an answer already given.
Request Body *
application/json
Field
Type
Description / Example
model
string
Description
A model id from GET /models. Omit it and the gateway uses the first published model.
messages*
array[object]
minItems: 1
Show fields
Field
Type
Description / Example
role*
"system" | "user" | "assistant" | "tool"
content*
string | array[object]Show fields
One of:
stringarray[object]
Array items: object
Description
A string, or an array of content parts for multimodal input.
tool_calls
array[object]
Description
Assistant turn carrying tool calls. function.arguments may be a JSON string or an object; both are accepted.
tool_call_id
string
Description
On a tool message: the id being answered.
name
string
max_tokens
integer
Description
Completion ceiling. Leave it out and the provider applies its own default; sending the model ceiling usually overflows the window.
temperature
number
top_p
number
stop
any
Description
A string or an array of strings.
stream
boolean
Description
Server-sent events. Our billing frames still apply.
tools
array[object]
Description
Tool schemas. Only send these to a model whose capabilities.tools is true.
tool_choice
any
Description
auto, none, required, or an object naming one function. Omit it and the model decides.
reasoning_effort
string
Description
Level of effort for a reasoning model. Supported values come from the model row and are clipped to what it implements.
Example
{
"model": "glm-5.3-flash",
"messages": [
{
"role": "system",
"content": "You are terse."
},
{
"role": "user",
"content": "Name three prime numbers."
}
],
"temperature": 0.2
}
Responses
Status
Description
200
The completion.
ChatCompletionResponse
200 body
application/json
Field
Type
Description / Example
id
string
object
"chat.completion"
created
integer
model
string
Description
The public id you asked for.
choices
array[object]Show fields
Field
Type
Description / Example
index
integer
message
objectShow fields
Field
Type
Description / Example
role
string
content
string | null
Description
Empty is legitimate on a reasoning model that spent its whole budget thinking. Check finish_reason rather than treating an empty body as a failure.
tool_calls
array[object]
finish_reason
string
Description
stop, length, or tool_calls. Read length before deciding to continue: an upstream stop on a truncated answer is corrected to length.
usage
objectShow fields
Field
Type
Description / Example
prompt_tokens
integer
completion_tokens
integer
total_tokens
integer
hisoka
objectShow fields
Field
Type
Description / Example
model
string
usd_charged
number
Description
What this call cost, in dollars.
usd_micro_charged
integer
Description
The same figure in micro-USD, the exact integer the wallet moved.
balance
string
Description
Balance after the call, as the gateway formats it.
max_tokens
integer | null
Description
The completion cap actually applied. Read it instead of assuming yours was honoured.
cap_raised_from
integer | null
Description
Set when a reasoning model needed a higher floor than you asked for, so a raised cap is visible rather than silent.
client
string
Description
Detected client family, for support.
Description
Our own additions to the response envelope. Absent on a pure proxy, so treat it as optional.
400
Malformed body, empty messages, a modality the model does not take, or a context that overflows the window.
object
400 body
application/json
Field
Type
Description / Example
error
objectShow fields
Field
Type
Description / Example
message
string
Description
Human sentence. The code appears inside it too, because a pasted screenshot carries the sentence and not the field.
Stable machine code. Branch on this, never on the message.
support
string
Description
Contact address for an account or billing problem.
docs
string
Description
Where the current reference lives.
request_id
string
Description
Quote this in any report. It matches the X-Request-Id header.
POST /messages - Create a message
POST/messages
Create a message
The Anthropic Messages wire, which Claude Code, Cursor and Zed speak. Auth accepts x-api-key as well as a bearer token.
[!WARNING]
Set your base URL to the host root, not to this path. The SDKs append their own /v1, so https://hisoka.ai/api/v1 reaches this endpoint correctly while also using it twice breaks the path. The gateway collapses a repeated version segment but will never strip a single one.
Errors use the Anthropic envelope: {"type": "error", "error": {...}} with an Anthropic error.type beside our own code.
tool_choice left unspecified stays unspecified. It is never rewritten to required, which would force a tool call forever and make an agent loop on 200 responses.