> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diagramkit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Credits

The API is paid in credits, from the same balance as the app and the MCP connector:

| What | Credits a page | Pay as you go |
| - | - | - |
| A new diagram (`POST /diagrams`) | 5 | \$0.50 |
| A change to a diagram (`POST /diagrams/{id}/revisions`), for each page it changes | 2 | \$0.20 |
| An animation (`animate: true`, or `POST /diagrams/{id}/animate`) | 8 | \$0.80 |
| Edits without the AI (`POST /diagrams/{id}/edits`), downloads, reading and listing | 0 | free |

Most diagrams are one page. A diagram with several pages is priced by its pages: a new three-page diagram is 15 credits, and a change that redraws two of its pages is 4. A request is charged once, when its result is kept; a retry with the same `Idempotency-Key` is not charged again. Your plan's credits are used first, then bought credits. Buy credits or turn on automatic top-up at [https://app.diagramkit.ai/settings/api](https://app.diagramkit.ai/settings/api), where you also see your balance and this month's use. When the balance cannot pay for a request, it is refused with `402 no_credits` before any work starts, and nothing is charged.

![Flowchart of a request's credits: edits without the AI, downloads, reading and listing are free. An AI request that reuses an Idempotency-Key returns the earlier job with no repeat charge. Otherwise all pages are planned: more than max\_pages (default 30) fails with too\_many\_pages, and a balance that cannot cover every page fails with no\_credits (402), with nothing drawn or charged in either case. Otherwise it is drawn and, when the result is kept, charged once from plan credits first, then bought credits. A new three-page diagram is 15 credits; a change to two pages is 4.](https://mintcdn.com/diagramkit/sWlxT_qLaDK7vTGW/images/credits-charge.png?fit=max\&auto=format\&n=sWlxT_qLaDK7vTGW\&q=85\&s=8b75c2121bc341a1109f23ec81387659)

A request is checked before anything is drawn, and charged once, when its result is kept.

A set of pages (slides, a carousel, "one page per step") has as many pages as the prompt asks for. It is planned first, and its whole cost is checked before any page is drawn: a set the balance cannot pay for fails with `error.type` `no_credits`, a message saying how many pages were planned, the credits they need and the balance, and nothing drawn or charged. The API never asks before drawing, so a set of more than 30 pages needs your yes: send `max_pages` with the most pages you accept. Without it, a longer set fails with `error.type` `too_many_pages` and a message naming its page count and cost; send the request again with `max_pages`. A job's time limit grows with its pages.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.