Skip to content

Core concepts

Base URLs

There are two billing surfaces, and each one has its own base URL. Use the base URL that matches the key you were issued, because a key is only ever valid on one of them.

The two surfaces (permalink)

Credit surface
https://api.korlogic.com/v1

For keys that carry a balance in US dollars.

Token surface
https://api.korlogic.com/token/v1

For keys that carry a prepaid budget of tokens.

A key works on exactly one surface.

Both surfaces serve the same endpoints, the same request bodies and the same model catalogue. The only thing that changes is how your consumption is counted, and therefore which URL your key answers on.

How each one bills (permalink)

Credit keys

A credit key carries a balance in US dollars. Every request is priced from the input and output tokens it actually used, at the per-model rates set for your account, and that amount is deducted from the balance. Cheaper models therefore go further on the same balance. When the balance reaches zero the key returns 402 insufficient_credit until it is topped up.

Token keys

A token key carries a fixed budget of tokens, bought up front. Every request subtracts its actual total tokens, input plus output, from that budget, whichever model produced them. Price per model is irrelevant here: a thousand tokens costs a thousand tokens. When the budget is spent the key returns 402 token_budget_exhausted.

Credit and token surfaces compared
PropertyCreditToken
Base URLhttps://api.korlogic.com/v1https://api.korlogic.com/token/v1
UnitUS dollarsTokens
Cost of a requestPriced per model from input and output tokensInput plus output tokens, model makes no difference
Runs out with402 insufficient_credit402 token_budget_exhausted
  • Funds are checked before a request is forwarded, not reserved against it. A key with a little left can still make one large call that takes it past zero. The next call is the one that is refused.
  • A request that fails is never billed. If the provider rejects it, or the gateway cannot reach the provider, the request is recorded as an error at zero cost.
  • Rates are not published. What a model costs you depends on the key you hold, so ask whoever issued it. Your consumption to date is always visible in the usage checker.

Which one is mine (permalink)

Both kinds of key start with kl_live_, and the surface is not encoded in the key, so you cannot tell by looking at it. Two reliable ways to find out:

  • Ask whoever issued the key. They chose the surface when they created it.
  • Paste the key into the usage checker. It reports the mode as either credit or token, along with what is left.

To test from a terminal instead, call the catalogue endpoint. A 200 means you have the right base URL. A 401 on a key you know is valid means you are on the other one.

Shell
# Reaches the catalogue endpoint. 200 means the base URL is right.
curl https://api.korlogic.com/v1/models \
  -H "Authorization: Bearer kl_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

OpenAI vs Anthropic (permalink)

Clients disagree about who owns the /v1 segment. OpenAI-compatible clients treat the base URL as literal and append /chat/completions to it. Anthropic-style clients, meaning the Anthropic SDKs and Claude Code, append /v1/messages themselves, so they need the base URL with the trailing /v1 removed.

Base URL value by client style
Client styleCredit surfaceToken surface
OpenAI SDKs, curl, OpenAI-compatible appshttps://api.korlogic.com/v1https://api.korlogic.com/token/v1
Anthropic SDKs, Claude Codehttps://api.korlogic.comhttps://api.korlogic.com/token

Both rows resolve to the same endpoint. If a client returns 404 on its very first call, a doubled or missing /v1 is almost always the reason. Client setup lists the exact field and the exact value for each tool.

Building the full URL (permalink)

Take your surface’s base URL and append the endpoint path.

Composed URLs
EndpointFull URL on the credit surface
Chat completionshttps://api.korlogic.com/v1/chat/completions
Anthropic messageshttps://api.korlogic.com/v1/messages
Responseshttps://api.korlogic.com/v1/responses
Model cataloguehttps://api.korlogic.com/v1/models

For the token surface, substitute https://api.korlogic.com/token/v1 for the base. Query strings are forwarded as sent. Requests are always HTTPS: plain HTTP is not served.