Get remaining credits
Sample request
curl -H "x-api-key: $ABYSSALE_API_KEY" \
https://api.abyssale.com/credits
# {"generation_credits":{"available":120,"limit":500,"consumed":380,"extra":0}, …}import abyssale from '@abyssale/sdk';
const { data, error } = await abyssale.getCredits();
if (error) console.error(error.id, error.message);
else console.log(data);from abyssale import Abyssale
with Abyssale() as client:
result = client.get_credits()
print(result)Example 200 response
{
"generation_credits": {
"available": 120,
"limit": 500,
"consumed": 380,
"extra": 0
},
"ai_credits": {
"available": 42,
"limit": 100,
"consumed": 58,
"extra": 0
}
}Example 401 error response
{
"message": "Unauthorized: missing or invalid API key.",
"id": "unauthorized"
}Remaining generation and AI credits for the caller's workspace, for the current billing period.
Response 200
The workspace's remaining credits.
generation_credits CreditBlock always
Image/video/PDF/HTML5 render credits.
Show child attributes
available integer | null always
Credits left this billing period. null means unlimited.
limit integer | null always
The plan's credit limit for this credit type. null means unlimited.
consumed integer always
Credits used this billing period.
extra integer always
Extra/top-up credits beyond the plan limit.
ai_credits CreditBlock always
AI feature credits — text_to_image, background removal, etc.
Show child attributes
available integer | null always
Credits left this billing period. null means unlimited.
limit integer | null always
The plan's credit limit for this credit type. null means unlimited.
consumed integer always
Credits used this billing period.
extra integer always
Extra/top-up credits beyond the plan limit.
Errors
Every failure uses the shared error envelope — {id, message, errors?}. Branch on id, never on message. See Errors.
| Status | When |
|---|---|
401 | Unauthorized — missing or invalid API key. |
429 | Too Many Requests. |
500 | Internal Server Error — an unexpected error occurred on our side. |
