ai
GET /v1/ai/credits
Zinn® credit balance, whether to offer more, and the packs for sale.
Tabbatar da Asali
Aika maɓallin API azaman alamar ɗauka (bearer token). Dole ne maɓallin ya kasance yana da izinin sites.view; idan babu shi, za a ƙi amfani da maɓallin tare da lambar 403, ba 404 ba.
Inda ID ɗin kungiyar ku ke zuwa
Wannan mahadar ta na daukar org_id a matsayin sigar tambaya. Bar shi kuma kiran zai shafi daukacin rukunin haya naka; aika shi don takaita kiran zuwa kungiya daya tak.
Ana samun lambar kungiyar ku a kan shafin maɓallan API a cikin madanninku, kusa da maɓallin kansa. Shi ne lambar da ta dace a kowane kiran da kuka yi.
Gwada
May gurbin komai da ke cikin kusurwa da ƙimar ka, kuma may gurbin maballi da maballi daga allon sarrafa ka.
curl -X GET https://api.zinndigital.com/v1/ai/credits \
-H "Authorization: Bearer zdk_live_…"An shiga? Na'urar sarrafa API da ke cikin sashin kulawarka tana cika ainihin lambar ƙungiyarka da maɓallinka naka, sannan tana gudanar da buƙatar a kan ainihin API don haka zaka iya ganin amsar gaske. Buɗe wannan tashar a cikin na'urar kula da API
Bayani
Everything the three credit surfaces need, in **one** request: the balance, whether this customer is genuinely short, and the packs they can buy. The AI page, the header chip and the upsell banner all read this endpoint rather than each deciding "is this customer low?" for itself. Two behaviours reading one fact is how a header comes to nag somebody the banner has decided is fine, so `state.is_low` is computed server-side and every surface renders it. `state.on_byo` is `true` only when a live customer key exists for **every** provider we route to, so credits genuinely cannot be spent. The banner must stay silent in that case: selling credit to somebody whose every call runs on their own key sells them something that will never be spent. It is **not** "this org has a key" — a customer holding one Anthropic key still pays us for Google, OpenAI and xAI. Amounts are USD **micros** (1 minor unit = 10,000 micros; 1 USD = 1,000,000), because one model call costs a fraction of a cent and rounding each one up to a penny over-bills by two orders of magnitude. `packs[].price_minor` is ordinary integer minor units, because that is what the customer is charged. Requires `sites.view`.
Sigogi
| Suna | Nau'i | Ana buƙata | Abin da yake |
|---|---|---|---|
org_id (query) | Uuid | A'a | Which organization this is about. Required when the caller belongs to more than one; a caller in exactly one may omit it. |
Martani
| Suna | Nau'i | Ana buƙata | Abin da yake |
|---|---|---|---|
state | AiCreditState | Eh | — |
packs | AiCreditPack[] | Eh | — |
settings | AiCreditSettings | Eh | The customer's standing instruction about topping up, and what has become of it. Owner, 2026-08-24, reading `/ai` on production: *"The auto top section doesnt allow you to selec… |
history | AiCreditHistoryLine[] | Eh | The 25 most recent movements, newest first. |
funding_routes | AiProviderFunding[] | Eh | Who pays for the next call, per provider. Read on the SAME request as the balance, so a screen cannot render a funding claim from one moment beside a balance from another. |
spends | AiCreditSpend[] | Eh | Everything this credit buys — the metered surfaces derived from the engine's own meter, the credit-only spends that write no usage row, and the fixed-price AI products. |
Kuskuren da wannan matsaya za ta iya maido wa
401 · 403 · 422 · 429