ai

GET /v1/ai/credits

Zinn® credit balance, whether to offer more, and the packs for sale.

Tous les points de terminaison ai

Authentification

Envoyez une clé API en tant que jeton du porteur. La clé doit posséder l'autorisation sites.view ; une clé qui ne l'a pas est refusée avec le code 403, et non 404.

Où insérer l'ID de votre organisation

Cet point de terminaison prend org_id comme paramètre de requête. Omettez-le et l'appel couvrira l'ensemble de votre sous-arbre de location ; envoyez-le pour restreindre l'appel à une seule organisation.

L'identifiant de votre organisation se trouve sur l'écran des clés API de votre tableau de bord, à côté de la clé elle-même. Il s'agit du même identifiant pour chaque appel que vous effectuez.

Essayer

Remplacez tout ce qui se trouve entre crochets par vos propres valeurs, et le espace réservé à la clé par une clé de votre tableau de bord.

curl -X GET https://api.zinndigital.com/v1/ai/credits \
  -H "Authorization: Bearer zdk_live_…"

Connecté ? La console d'API de votre tableau de bord saisit votre véritable ID d'organisation ainsi que votre propre clé, et exécute la requête sur l'API de production afin que vous puissiez voir la réponse réelle. Ouvrir ce point de terminaison dans la console API

Détails

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`.

Paramètres

NomTypeObligatoireQu'est-ce que c'est
org_id (query)UuidNonWhich organization this is about. Required when the caller belongs to more than one; a caller in exactly one may omit it.

Réponse

NomTypeObligatoireQu'est-ce que c'est
stateAiCreditStateOui
packsAiCreditPack[]Oui
settingsAiCreditSettingsOuiThe 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…
historyAiCreditHistoryLine[]OuiThe 25 most recent movements, newest first.
funding_routesAiProviderFunding[]OuiWho 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.
spendsAiCreditSpend[]OuiEverything 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.

Erreurs que cet point de terminaison peut renvoyer

401 · 403 · 422 · 429