# Credits and rate limits

How calls are charged, how limits work and the headers that report them.

## Credits

Each successful call uses credits from your plan:

| Compute class | Credits per call |
|---|---|
| Light and standard | 1 |
| Heavy | 3 |
| Reports | 10 |
| AI readings | Metered from the same credits: typically 60-170 (fast), 250-750 (balanced), 1,500-4,000 (deep) |
| PDF of a report (`POST /v1/jobs/pdf`) | The report's 10, plus 120 |
| Spoken MP3 of a report (`POST /v1/jobs/audio`) | The report's 10, plus 800 a minute |

Every capability's cost is shown in the [API reference](https://96astroapi.com/docs/reference) and returned in `meta.credits_used`. An AI reading reserves its tier's ceiling before the call and is charged only what it used. Errors are never charged, and sandbox keys never use credits.

### Single endpoints

A [single endpoint](https://96astroapi.com/docs/single-endpoints.md) costs one price class less than the section it is cut from (never less than the cheapest class): one divisional chart is 1 where the whole set of charts is 3, and one section of a report is 3. A chart single with its drawing (`"include_image": true`) costs 3, listed in its `x-credits-by-input`.

### PDF, audio and photo readings

A [PDF or spoken MP3](https://96astroapi.com/docs/jobs-and-webhooks.md) of a report costs the report's credits plus a charge for the file: [Audio reports](https://96astroapi.com/docs/audio-reports.md) are priced by the minutes you ask for. `report-complete-kundli`, the longest report, costs ten times a report and twice the PDF charge; its own page shows the total. [Palm and face readings](https://96astroapi.com/docs/photo-readings.md) are metered by model cost, like AI readings. A job that fails is not charged.

### Capabilities priced by their input

Two capabilities cost more when you ask for more. Their operations in the [OpenAPI document](https://96astroapi.com/openapi/v1.json) list every price in `x-credits-by-input` (their `x-credits` is the price of one unit), and the price for your request is in `meta.credits_used`:

| Capability | Request | Credits |
|---|---|---|
| `regional-calendar` | `"view": "day"` (the default) | 1 (a standard calculation) |
| `regional-calendar` | `"view": "month"` (every day of the regional month) | 3 (a heavy calculation) |
| `match-one-to-many` | 1 to 250 candidates | 3 |
| `match-one-to-many` | each further started batch of 250, up to 1,000 candidates | 3 more per batch |

So a match of 251 candidates costs two batches and 1,000 candidates cost four. A candidate whose birth details cannot be computed appears as an `error` entry in `results`; the batch still answers and is charged. A request that is refused (for example more than 1,000 candidates) is refused before any credit or rate-limit unit is used. The [rate limit](#rate-limits) counts the same units: a month view counts as one heavy call, and each started batch of 250 candidates counts as one heavy call.

## Credit headers

Every successful capability call also reports its cost and your balance in headers, so you can watch the balance without a separate request:

```http
X-Credits-Used: 3
X-Credits-Remaining: 48217
```

| Header | Meaning |
|---|---|
| `X-Credits-Used` | What this call cost: always the same number as `meta.credits_used` (for an AI reading, the settled charge, not the reservation). An idempotent replay repeats the original charge and is not charged again |
| `X-Credits-Remaining` | Live secret keys only: your organization's spendable credits right after this call (plan credits, top-ups and any overage already taken). Not sent for sandbox or [publishable](https://96astroapi.com/docs/key-restrictions.md#publishable-keys) keys, so a browser never sees your balance |
| `X-Sandbox-Calls-Remaining` | Sandbox keys only: sandbox calls left in the last 24 hours |
| `X-Credits-Reserved` | `POST /v1/jobs/pdf` only: the credits reserved for the job (= `meta.credits_reserved`), alongside `X-Credits-Remaining` |

Errors carry none of these headers: they are never charged.

## When credits run out

The API returns `429 quota_exhausted`, never a silent failure or a surprise bill. You can:

- buy a **top-up** from the dashboard (on a paid plan);
- upgrade your plan; the new allowance applies immediately;
- wait for your monthly credits to renew;
- turn on **overage** with a monthly spending cap (below), so live calls continue instead of stopping.

## After the trial: Spark, the free plan

When the 14-day trial ends, or a paid subscription ends, the account moves to **Spark**, the free plan: 100 live credits on the 1st of every month (UTC), at 1 rate-limit unit per second. Unused Free credits do not carry over. Every family is included except AI readings, and PDF and audio jobs, which answer `403 plan_upgrade_required` on live keys; sandbox keys still test PDF jobs. Where Free-plan results appear publicly, show "Powered by 96Astro API" with a link to 96astroapi.com. Choosing a paid plan replaces Free at once.

## Project budgets

On Cosmos Apex, Observatory and the older Business plan, each [project](https://96astroapi.com/docs/teams-and-projects.md) can have a **monthly credit budget**: the most live credits its keys may use in a calendar month (UTC). It is checked at admission, under the same lock as your credits, so concurrent calls cannot overshoot it: a call that would take the project past its budget returns `429 project_budget_exceeded` and is not charged. Other projects keep working, and the budget resets on the 1st of the month. Failed calls do not count, and sandbox calls never do. Raise or clear the budget under **Projects** in the dashboard; a call can still stop earlier with `quota_exhausted` or `spend_cap_reached` when the organization's credits or overage cap run out first.

## Overage (opt-in, capped)

Overage is **off** unless the account owner turns it on under **Billing**. It needs an active paid plan and billing details, and a monthly cap of at least the price of the smallest top-up. The cap and the overage price exclude GST, like every price.

- **Order.** Plan credits are used first, then top-ups, then overage. A top-up bought later is used before any more overage.
- **Price.** Overage credits cost your plan's top-up rate per 1,000 credits (the cheapest top-up your plan can buy), shown in Billing.
- **Never past the cap.** Before each live call the credits it may use are reserved against the cap's remaining room, so concurrent calls cannot overshoot it. A call that does not fit returns `429 spend_cap_reached`; failed calls give their credits back.
- **Alerts.** An email (and, on plans with webhooks, the `overage.started`, `overage.threshold` and `overage.cap_reached` events) when overage starts and at 50 %, 80 % and 100 % of the cap, each once a month.
- **Billing.** Overage is billed with GST as soon as the cap is reached, and the rest after each monthly period ends; amounts under 1.00 are waived. You pay the bill from **Billing** within 7 days and the GST invoice is issued with the payment, with the line "Overage credits N at ₹x per 1,000". An unpaid bill past its due date pauses live calls (`402 payment_required`) until it is paid; the sandbox keeps working.
- **Sandbox** keys never use overage.

## Rate limits

Each plan has a **rate limit in units per second**, shared by every key of your organization (live and sandbox are counted apart); see [pricing](https://96astroapi.com/pricing). A call counts units by its compute class, so the limit follows the work a call asks for. For the capabilities [priced by their input](#capabilities-priced-by-their-input) it counts the same class and the same number of units it charges for:

| Call | Units |
|---|---|
| Light and standard | 1 |
| Heavy | 3 |
| Reports | 10 |
| AI readings | 10, on top of their per-key limit |
| PDF or MP3 of a report (`POST /v1/jobs/pdf`, `POST /v1/jobs/audio`) | 10, the report's; the render itself is queued |
| Polling a job (`GET /v1/jobs/{id}`) | 1 |

**Per minute.** Some providers state limits per minute, so here are both: a plan of *r* units a second sustains 60 × *r* units a minute. On a plan of 5 units a second that is 300 units a minute: 300 light or standard calls, or 100 heavy calls, or 30 report calls, at the unit counts in the table above. A heavy call counts more than a light one, and a call that is refused with `429` counts nothing.

Your allowance holds **10 seconds** of your plan's rate, so bursts are absorbed: on a 5-units-a-second plan up to 50 units can go at once (for example, many users opening your app together), and the allowance then refills continuously at 5 units a second. Over any longer period you get exactly the plan's rate. A call larger than the whole allowance is accepted when the allowance is full and then holds further calls back until it has refilled.

Successful responses report the current state in units:

```http
RateLimit-Limit: 50
RateLimit-Remaining: 47
RateLimit-Reset: 1
```

`RateLimit-Limit` is the whole allowance (the plan rate times 10 seconds), `RateLimit-Remaining` is the units you can spend now; `RateLimit-Reset` is the seconds until the allowance is full again. Exceeding the limit returns `429 rate_limited` with these headers and a `Retry-After` header: the seconds until that call would fit. The [official SDKs](https://96astroapi.com/docs/sdks.md) wait and retry a `429` for you; with plain HTTP, wait `Retry-After` seconds and send the same request again (use an [idempotency key](https://96astroapi.com/docs/idempotency.md) so a retry is never charged twice).

If our calculation service is briefly overloaded you get `503 unavailable` with `retryable: true` and a `Retry-After` header. It is never charged; retry after the time given.

## Other limits

| Limit | Applies to |
|---|---|
| AI readings a minute, per key: what your plan's rate allows (6 for each unit a second), and at least 10 | Live keys on a plan with AI |
| 30 calls a minute per visitor IP, per key | [Publishable keys](https://96astroapi.com/docs/key-restrictions.md#publishable-keys), which also have their own units-per-second allowance apart from your secret keys' |
| 500 calls a day | Sandbox keys, per organization |
| 5 PDF jobs a day | Sandbox keys, per organization |
| 10 calls a minute and 60 a day per visitor, and a daily limit for everyone together | The keyless [playground](https://96astroapi.com/playground), which runs light calculations only, and the Try-it boxes on capability pages. Both are free and never billed |

The daily sandbox limits count the last 24 hours and return `429 quota_exhausted` when reached.

AI features (AI readings and chat, palm and face readings, Vastu AI and audio reports) run only on a paid plan that includes AI, or a Comet Wallet: not on the free trial or Spark, and not on sandbox keys. A call without it is refused with `403 plan_upgrade_required` and nothing is charged.
