ai
GET /v1/ai/credits
Zinn® credit balance, whether to offer more, and the packs for sale.
પ્રમાણીકરણ
એપીઆઈ કી (API key) ને બેરર ટોકન તરીકે મોકલો. કી પાસે sites.view પરવાનગી હોવી આવશ્યક છે; તેના વગરની કીને 404 ને બદલે 403 સાથે અસ્વીકાર કરવામાં આવશે.
જ્યાં તમારી સંસ્થા આઈડી જાય છે
આ એન્ડપૉઇન્ટ ક્વેરી પેરામીટર તરીકે org_id લે છે. તેને છોડી દો અને આ કૉલ તમારા આખા ટેનન્સી સબટ્રીને આવરી લેશે; તેને એક સંસ્થા સુધી કૉલ મર્યાદિત કરવા માટે મોકલો.
તમારી સંસ્થાની આઈડી તમારા ડેશબોર્ડ પર API કી સ્ક્રીન પર, કી ની બાજુમાં જ છે. તે તમે કરો છો તે દરેક કૉલમાં સમાન આઈડી છે.
આયમાવો
કોઈપણ કૌંસમાં રહેલી બાબતને તમારા પોતાના મૂલ્યોથી બદલો અને કી પ્લેસહોલ્ડરને તમારા ડેશબોર્ડની કીથી બદલો.
curl -X GET https://api.zinndigital.com/v1/ai/credits \
-H "Authorization: Bearer zdk_live_…"साइन ઇન કરેલ છે? તમારા ડેશબોર્ડમાં આવેલું API કન્સોલ તમારી વાસ્તવિક સંસ્થાની આઈડી અને તમારી પોતાની કી ભરે છે, અને લાઇવ API સામે વિનંતી ચલાવે છે જેથી તમે વાસ્તવિક પ્રતિસાદ જોઈ શકો. આ અંતિમબિંદુને API કન્સોલમાં ખોલો
વિગતો
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`.
પેરામીટર્સ
| નામ | પ્રકાર | જરૂરી | તે શું છે |
|---|---|---|---|
org_id (query) | Uuid | ના | Which organization this is about. Required when the caller belongs to more than one; a caller in exactly one may omit it. |
જવાબ
| નામ | પ્રકાર | જરૂરી | તે શું છે |
|---|---|---|---|
state | AiCreditState | હા | — |
packs | AiCreditPack[] | હા | — |
settings | AiCreditSettings | હા | 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[] | હા | The 25 most recent movements, newest first. |
funding_routes | AiProviderFunding[] | હા | 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[] | હા | 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. |
આ એન્ડપોઇન્ટ જે ભૂલો પરત કરી શકે છે
401 · 403 · 422 · 429