ai
GET /v1/ai/credits
Zinn® credit balance, whether to offer more, and the packs for sale.
Ìfàṣẹ́pọ̀
Fi bọ́ọ̀lù (bearer token) ranṣẹ gẹ́gẹ́ bí kọ́kọ́rọ́ API. Kọ́kọ́rọ́ náà gbọ́dọ̀ ní ìyọ̀ǹda sites.view; a ó kọ̀ ọ́ silẹ pẹlu 403, kii ṣe 404, ti kọ́kọ́rọ́ náà kò bá ní i.
Ibùdó àmì ìdánimọ̀ ilé-iṣẹ́ rẹ sí
Oju-iwọle yii nlo org_id gẹgẹbi ayẹwo ibeere. Fi silẹ ni ita yoo si bo igi iyalo rẹ lapapọ; ranṣẹ si lati dín ibeere naa kù si ajọ kan.
Id àjọ rẹ wa lórí ojú-ìwákòòkò àwọn bọ́tìnnì API nínú daṣibọọdú rẹ, lẹ́gbẹ̀ẹ́ bọ́tìnnì náà gan-an. Ó jẹ́ ìd kan náà nínú gbogbo ìpè tí o bá ṣe.
Gbiyanju rẹ
Rọ́pọ̀ èyíkéyìí nínú àwọn àmì ìtọ́ka < > pẹ̀lú iye tirẹ̀, àti àmì ìdánimọ̀ bọ́tìnnì náà pẹ̀lú bọ́tìnnì kan láti inú dásibọ̀ọ̀dù rẹ.
curl -X GET https://api.zinndigital.com/v1/ai/credits \
-H "Authorization: Bearer zdk_live_…"Ṣé o ti wọlé? Iwọ̀n api ní nú ìgbékalẹ̀ rẹ kún id àjọ gidi rẹ ati bọtini tirẹ, o si nṣiṣẹ ibeere na lòdì si api gidi ki o le rii esi gidi na. Ṣí ojú abáná yìí sílẹ̀ nínú kọnsólù API
Àwọn kúlẹ̀kúlẹ̀
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`.
Àwọn ìpìlẹ̀
| Orúkọ | Iru | Tí a nílò | Kini o jẹ |
|---|---|---|---|
org_id (query) | Uuid | Bẹẹkọ | Which organization this is about. Required when the caller belongs to more than one; a caller in exactly one may omit it. |
Idahun
| Orúkọ | Iru | Tí a nílò | Kini o jẹ |
|---|---|---|---|
state | AiCreditState | Bẹẹni | — |
packs | AiCreditPack[] | Bẹẹni | — |
settings | AiCreditSettings | Bẹẹni | 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[] | Bẹẹni | The 25 most recent movements, newest first. |
funding_routes | AiProviderFunding[] | Bẹẹni | 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[] | Bẹẹni | 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. |
Awọn aṣiṣe ti ibudo ipari yii le da pada
401 · 403 · 422 · 429