Credits and usage
How a call is priced, reserved and charged, and where you see what each case and each person spent.
What a call costs
A model has a price for each million tokens it reads and each million it writes; some charge less for tokens they read again soon after (Caching). A call costs:
tokens read × read price + tokens written × write price
In Sypnia Cloud the prices are in credits and shown in the catalog (ai models). Self-hosted, the gateway uses your providers’ prices, in their currency, from its price table.
Reserved first, charged after
- Before the call, the most it could cost (what it reads, plus its longest possible answer,
max_output_tokens) is reserved from your prepaid credits. If your balance cannot cover it, the call still runs during the 7 days of grace and is taken from your next top-up; after them it stops with402 insufficient_creditsand costs nothing. - After the call, the real tokens are charged and the rest of the reservation returns to your balance at once.
A smaller max_output_tokens reserves less, so many calls at the same time fit in the same balance.
Where you see it
| Where | What it shows |
|---|---|
| App, project board and ledger | AI spending per case, next to the rest of the project’s spending |
ai.app.sypnia.com | usage by day, and by case, task, key, person and model, with the month’s pace |
npx @sypnia/ai usage --by case --since 30d | the same in your terminal; --csv to export |
GET /v1/usage?group_by=case | the same through the API |
Usage of La Espiga for one month, by case:
| Case | Calls | Tokens read | Tokens written | Share of credits |
|---|---|---|---|---|
ask-about-a-product | 1,840 | 760,000 | 71,000 | 71 % |
publish-bread-of-the-day | 30 | 5,500 | 1,900 | 4 % |
find-products | 2,410 | 96,000 | — | 25 % |