AI credits

AI & MCP

AI credits

Meter AI usage against a monthly cap.

Each AI generation consumes a credit; when the balance runs out, generation is blocked until the next month. Usage starts again at zero on the first of each month (UTC). Check the balance or consume programmatically:

bash
GET  /v3/ai-credits            → { used, limit, remaining }
POST /v3/ai-credits/consume    { "amount": 1 }   → 200, or 429 when exhausted

Every workspace starts with a monthly cap of 1,000 credits. See also plans & entitlements.

Settings & webhooks#

bash
GET  /v3/ai-credits/settings               → { monthly_limit, alert_threshold, webhook_secret }
PUT  /v3/ai-credits/settings               { "monthly_limit": 5000, "alert_threshold": 0.5 }
POST /v3/ai-credits/settings/rotate-secret → { webhook_secret }

How consume behaves

  • amount is optional and defaults to 1. A value below 1 counts as 1.
  • A request that would go over the limit is refused as a whole: the API returns 429 with allowed: false and deducts nothing, even when a few credits are left. Check remaining first when you consume several at once.
  • Both responses carry allowed, used, limit and remaining.
bash
POST /v3/ai-credits/consume   { "amount": 5 }
→ 429 { "allowed": false, "used": 998, "limit": 1000, "remaining": 2 }

Settings rules

  • Every route needs a secret server key (sk_live_…); any other token gets 401.
  • Until you change them, monthly_limit is 1000 and alert_threshold is 0.8.
  • monthly_limit must be above 0. A 0 is ignored and the old limit stays; decimals are rounded down.
  • alert_threshold is a fraction, kept between 0 and 1.
  • The webhook secret starts with aiwh_. Rotating it replaces the old secret at once.