Skip to content
NotHolyDocs

API reference

Credits API

GET /v1/credits returns the organization balance, and the spend and budgets of the key you call with.

View as Markdown

Read your balance without spending anything. The call is free and holds nothing.

GEThttps://api.notholy.com/v1/credits
curl
curl https://api.notholy.com/v1/credits -H "Authorization: Bearer $NOTHOLY_API_KEY"

Response

JSON
{
  "object": "credits",
  "currency": "USD",
  "balance": "24.913402",
  "reserved": "0.004000",
  "available": "24.909402",
  "key": { "spent": "0.086598", "daily_budget": "5.000000" }
}
FieldTypeNotes
objectstringAlways credits
currencystringAlways USD
balancestringCredits minus usage already charged
reservedstringHeld right now by requests in flight. Each hold is the worst-case cost of its request; the unused part returns when it settles
availablestringWhat a new request can reserve: balance minus reserved
key.spentstringTotal spent with this key
key.total_budget, key.daily_budgetstringPresent when the key has budgets

Amounts are decimal strings with 6 decimal places. Inside NotHoly they are integers in billionths of a dollar, so no rounding happens between requests.

Every request reserves its worst case (prompt plus max_tokens) before it starts. When available is lower than that, the output limit shrinks to fit, and below 16 tokens the request returns 402 insufficient_credits. Check available before long generations.

JavaScript
const r = await fetch('https://api.notholy.com/v1/credits', { headers: { Authorization: `Bearer ${process.env.NOTHOLY_API_KEY}` } });
const c = await r.json();
console.log(c.available);

Errors

StatusCodeMeaning
401invalid_api_keyMissing, invalid, revoked or expired key
500internal_errorThe balance could not be read. Retry with backoff