GET /v1/credits
Current wallet snapshot - balance, period usage, per-format estimates.
GET
/v1/creditsPhase 1stable
- Auth
- Bearer
Returns the calling org's current credit balance, billing period usage, and a per-format estimate partners can use for pre-flight checks before firing a generate call. Light read - safe to call on every boot + periodically during a session.
The canonical shape is shared with /v1/whoami, which echoes creditBalance as a single field so you don't need two RTTs on boot.
Example request
curl https://api.layers.com/v1/credits \
-H "Authorization: Bearer $LAYERS_API_KEY"const res = await fetch("https://api.layers.com/v1/credits", {
headers: { "Authorization": `Bearer ${process.env.LAYERS_API_KEY}` },
});
const wallet = await res.json();
if (wallet.balance < wallet.estimatedCreditsPerFormat["slideshow_builder"]) {
throw new Error("Low credit balance; top up before generating.");
}import os, requests
res = requests.get(
"https://api.layers.com/v1/credits",
headers={"Authorization": f"Bearer {os.environ[\'LAYERS_API_KEY\']}"},
)
wallet = res.json()Response
200OK
{
"organizationId": "org_2481fa5c-a404-44ed-a561-565392499abc",
"balance": 6000,
"available": 5880,
"includedRemaining": 600,
"prepaidBalance": 5400,
"reservedCredits": 120,
"includedThisPeriod": 1000,
"usedThisPeriod": 400,
"currentPeriod": {
"start": "2026-04-01T00:00:00.000Z",
"end": "2026-05-01T00:00:00.000Z",
"usedCredits": 400
},
"subscriptionTier": "pro",
"billingStatus": "active",
"estimatedCreditsPerFormat": {
"slideshow_builder": 50,
"slideshow_remix": 50,
"video_remix": 120,
"ugc_remix": 120,
"auto": 120
},
"ingestCostsBilled": {
"github": false,
"website": false,
"appstore": false
}
}Field notes
balance=includedRemaining + prepaidBalance(gross).available=balance - reservedCredits, floored at 0 - what you can actually spend on new work right now. Gate a generate call againstavailable, notbalance: generations reserve credits the moment a workflow starts, soavailablecan dip belowbalancewhile work is in flight.reservedCreditsis credit committed to in-flight generations. It exists sobalance - reservedCredits === availablereconciles client-side. When nothing is running, it's 0 andavailable === balance.includedRemainingis the portion of your subscription's monthly included credits still available in the current period. Rolls over atcurrentPeriod.end.prepaidBalanceis topped-up credits that don't expire.estimatedCreditsPerFormatis a defensive upper bound - real cost at render time is model-dependent (smaller if the generation lands on a cheaper model, larger for higher-quality video). Use these numbers for UI "you'll spend ~N credits" prompts; the authoritative deduction happens server-side after generation.ingestCostsBilledflags whether an ingest call debits partner credits. Today all three arefalse. If that changes, the flag flips totruebefore billing begins.
Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing or invalid key. |
| 503 | KILL_SWITCH | Key or org disabled. |