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

# Billing & Quotas

> How we price requests, rate limits, credits, and what happens when your balance runs out.

## Getting started

Creating an API key needs no card. Sign up, create a workspace (see [quickstart step 2](/inference-api/quickstart) — signup does not make one for you, and keys live inside it), then mint a key from **Workspace home** in the dashboard. It exists, authenticates, and appears in your key list immediately.

Spending is what needs funding. Every request is checked against your balance before it reaches a model, and a new account's balance is zero, so until you add funds your requests come back `402 Payment Required` (the exact body is [below](#when-credit-runs-out)). Having no card, and having no balance, are both fine at key-creation time — so you can distribute the key, commit the integration and run your deploy pipeline before any payment detail exists. (Key creation is still refused in a few other cases: your role in the workspace, a workspace you are not an active member of, a workspace that has been suspended or archived, the per-workspace limit on how many keys may be live at once, and an account frozen over a payment dispute. Organization-level ownership is not a substitute for workspace membership — if you administer the organization but are not a member of the workspace, you cannot mint a key in it.)

There are two ways to get a balance. Add a card and top up — see [Adding a card](#adding-a-card) — or carry credit — from the [FlexAI Startup Program](https://www.flex.ai/startups), a negotiated offer, or the verified first top-up match, which doubles your first top-up up to \$100 on US-dollar accounts once you have verified your identity. See the [credits FAQ](/faq/credits#how-does-the-first-top-up-match-work) for the terms and how to claim it. Credit draws down before your card is charged, so a credited account bills nothing until the credit is spent. New accounts do not come with an automatic credit grant; see the [credits FAQ](/faq/credits) for where credits come from.

<Note>
  Funds are **workspace-level** — one wallet per workspace, topped up once, and
  every key in that workspace draws on the whole balance. There is no per-key
  allowance. Three things can still bound what a key spends, all set by someone
  else: a per-member spend cap set by a workspace admin, a monthly ceiling on the
  organization, and a cap we apply directly in rare cases. Rate limits, by
  contrast, really are per-key, and run out independently of money.
</Note>

## How we bill

Dollar-denominated, per-request. We don't sell token bundles, we don't subscribe you — we meter what you use:

| Model type | Unit |
| - | - |
| Text / chat / completions / reasoning | Per million input tokens, per million output tokens. |
| Embeddings | Per million input tokens. |

Per-model pricing is in [the catalog](https://flex.ai/models). Spend appears in the dashboard within a few minutes of each request.

<Note>
  Streaming a chat completion and stopping early still bills for the tokens that were generated before you closed the connection — the model did the work. Set `max_tokens` to cap worst-case spend.
</Note>

### Per-request cost in the response

Chat completion responses carry what the request cost you, in the `usage` block:

| Field | Meaning |
| - | - |
| `usage.cost` | Our charge for this request, in USD. It equals the two fields below added together. |
| `usage.cost_details.upstream_inference_prompt_cost` | The part of that charge for input tokens, at the model's input rate (and its cached-input rate for tokens served from the prompt cache). |
| `usage.cost_details.upstream_inference_completions_cost` | The part of that charge for output tokens, including reasoning tokens. |

These are **FlexAI's charge to you**, not an upstream provider's cost to us. The `upstream_inference_*` names follow OpenRouter's usage-accounting fields, so tools that already read them work unchanged.

Where they appear:

* **Non-streaming:** on the response's `usage`.
* **Streaming:** on the `usage` of the final chunk. Send `stream_options: { "include_usage": true }` to get that chunk.

Values are USD numbers rounded to 8 decimal places. The fields are absent, not `0`, when the response cannot state the charge yet. That happens when the gateway has no per-token price for the model, or when a stream's final chunk reports zero tokens and the count is corrected after the stream ends. The request is still billed. To read the recorded charge for one request, call `GET /v1/flex/usage/request/{request_id}` with the `x-litellm-call-id` response header.

`GET /v1/pricing` is the published price list. These charges are computed from it.

## Rate limits

Per-API-key, per-minute. Limits are set by tier:

| Tier | Requests per minute |
| - | - |
| Free (default on signup) | 10 |
| Paid | 100 |
| Custom | [Contact FlexAI](mailto:support@flex.ai) for higher limits |

A key minted on an account with no card on file starts on the free tier. Adding a card moves the account's keys to the paid tier — it is having the card, not having spent anything, that makes the difference, and it is the only tier change you can make yourself. It is not instantaneous: the promotion is applied by a reconciler shortly after the card is added, so allow a minute before judging the limit from the headers. Keys an admin has given an explicit per-member rate limit keep that limit, and so do disabled keys and suspended members. Beyond the paid tier, limits are set by hand: email [support@flex.ai](mailto:support@flex.ai) and tell us the rate you need.

Every response from the API carries rate-limit headers:

| Header | Meaning |
| - | - |
| `x-ratelimit-limit-requests` | RPM ceiling for this key. |
| `x-ratelimit-remaining-requests` | Requests left in the current window. |
| `x-ratelimit-reset-requests` | Unix timestamp when the window resets. |

When you exceed the limit you get `429 Too Many Requests` with a `Retry-After` header (seconds to wait). Don't retry in a tight loop — back off until the header's deadline.

## When credit runs out

Our API returns `402 Payment Required`:

```json theme={null}
{
  "error": {
    "message": "You exceeded your budget. Please add credits to continue.",
    "type": "insufficient_quota",
    "code": "insufficient_quota"
  }
}
```

Chat and completions answer a little differently — that path checks the request's worst-case cost against your balance before generating, so the code is `insufficient_balance` and the useful numbers arrive under `error.provider_specific_fields`. [Errors](/inference-api/reference/errors#402--payment-required) has both shapes in full; render the fields rather than matching on the sentence.

Once you add credit, subsequent requests succeed immediately — no key regeneration needed.

## Adding a card

From the [billing page](https://platform.flex.ai/billing):

1. Click **Add payment method**.
2. Enter card details (processed by Stripe; we never see the number).
3. Top up by any amount between \$5 and \$500 — or €5 to €500 if your account bills in euros, which is a native range rather than a converted one.

The amount you enter is the credit you receive. **Any sales tax or VAT is added on top of it**, so a €100 top-up credits €100 of balance and charges your card €100 plus the VAT for your country. The exact total is shown before you confirm. Your balance is credited once the payment settles, which is usually seconds but is not instant — the dashboard shows the top-up as pending until then.

You can also set an **auto-recharge** rule on the same page: pick a balance threshold and a top-up amount, and we charge the card on file when the balance falls below it, which makes a long-running job much less likely to stop at `402`. With no rule set, nothing is charged automatically.

It is not a guarantee, and it is worth knowing why. The rule is evaluated when something moves your balance rather than on a timer, so an account that is already below the threshold and has just come off a short cooldown waits for its next balance-moving event instead of being swept up. Attempts are bounded too: by default no more than three in any rolling 24 hours, with a short cooldown between them — or, if you set a monthly spending cap on the rule, by that cap instead. And the card still has to clear. If your balance reaches zero with a rule in place, one of those is why.

The emails differ depending on which you are on. **With no auto-recharge rule**, we warn you once your balance drops under a fifth of what it was straight after the credit that started the current run — usually a top-up, but a promotional bonus or an adjustment we apply counts too — so a run starting at \$50 warns below \$10. We write again when the balance reaches zero. **With auto-recharge on**, we send only the second one, because a balance that reaches zero with a rule in place means a recharge did not go through — usually a declined card or a cap being hit.

Accounts in the EU region are charged and invoiced in euros rather than dollars; see [Regions](/inference-api/reference/regions#billing-currency).


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