Billing

AI is billed per token and deducted from credits per request — input and output tokens at the model’s rate. The live catalog lists chat-model rates; embedding prices are on the live rate card. Each request with nonzero usage rounds up to a whole cent, with a $0.01 minimum. Every model’s rate is on /pricing. Playground messages are billed exactly like API requests.

Watch your usage

AI Gateway → Usage breaks down requests, tokens, and cost. From the terminal: setcloud api GET /api/ai/usage.

Error codes worth knowing

Code Meaning Fix
401 Missing or invalid key Send Authorization: Bearer sk-sc-...
400 model_not_found Unknown model id GET /v1/models lists what you can call
403 model_not_allowed Key restricted to other models Use an allowed model, or loosen the key
402 insufficient_credits Balance is zero Top up, or turn on auto-reload
402 spend_budget_reached Monthly spend cap reached with auto-pause on Raise the cap or disable auto-pause in spend management
429 rate_limit_exceeded Key over its per-minute limit Honor Retry-After, or raise the key’s limit

Spend caps and zero balance

Two things stop /v1 requests and playground messages before you run out of tokens to send:

  • Your spend cap trips. If auto-pause is on and your monthly spend reaches the cap, both the API and the playground return 402 spend_budget_reached with a message telling you to raise the cap or turn off auto-pause. See spend caps and pause behavior.
  • Your balance hits zero. Requests fail immediately with 402 insufficient_credits — AI draws from the balance in real time, so there’s nothing left to bill against.

Either way, the fix takes effect within minutes: raise the cap, top up, or turn off auto-pause, and the next request goes through.

Custom models

Fine-tune on your own data under AI Gateway → Fine-tuning: upload a CSV with a header row, start the job, and track it in the dashboard. Ready models appear in the playground picker and via the API as custom-* model ids. Review and accept a fixed dataset-size quote for two passes before starting; successful training charges it once. Custom model storage bills until deletion, and inference bills separately at the model rate. Current prices are on Pricing.