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

# Pricing

Every model page on [sunra.ai](https://sunra.ai/models) shows the price of each endpoint next to the model name — for example `$0.045-$0.09 per image`. Hovering the price shows a tooltip with the exact rule, such as which resolutions or options change the price.

For most models the price of a request is **fixed at submission time**: it is computed from your request parameters before the model runs, and that exact amount is what appears in your [billing history](https://sunra.ai/dashboard/billing). The same request parameters always cost the same amount, so you can budget deterministically. A few models (for example video models billed per output second) settle after completion based on actual usage; their tooltips say so.

## Pricing API

You can read prices programmatically — both as human-readable strings and as machine-readable rules.

| Endpoint                                                        | Auth    | Description                                                 |
| --------------------------------------------------------------- | ------- | ----------------------------------------------------------- |
| api.sunra.ai/v1/pricing                                         | API key | Lists all models with `display` and `tooltip` price strings |
| api.sunra.ai/v1/models                                          | none    | Lists all models; gives you the model `id`                  |
| api.sunra.ai/v1/pricing/model/\{model\_id}/endpoint/\{endpoint} | none    | Full machine-readable price rules for one endpoint          |

To compute the exact price of a request before sending it, first look up the model `id`:

```bash theme={null}
curl -s "https://api.sunra.ai/v1/models?limit=300" \
  | jq '.data[] | select(.alias == "bytedance/seedream-5.0-pro") | .id'
# "model_b63ac71d3992"
```

Then fetch the price rules for the endpoint you plan to call:

```bash theme={null}
curl -s "https://api.sunra.ai/v1/pricing/model/model_b63ac71d3992/endpoint/image-editing"
```

```json theme={null}
{
  "id": "mep_e5e2c1437feb",
  "object": "model_endpoint_price",
  "model_name": "seedream-5.0-pro",
  "model_endpoint": "image-editing",
  "display": "$0.045-$0.126 per image",
  "tooltip": "1K: $0.045, 2K: $0.09 per image, +$0.004 per reference image from the 2nd",
  "type": "pre_defined",
  "prices": [
    { "unit_amount": "0.045", "matches": { "resolution": "1K", "images": { "$size_lte": 1 } } },
    { "unit_amount": "0.049", "matches": { "resolution": "1K", "images": { "$size": 2 } } },
    { "unit_amount": "0.09",  "matches": { "images": { "$size_lte": 1 } } },
    { "unit_amount": "0.094", "matches": { "images": { "$size": 2 } } },
    { "unit_amount": "0.126" }
  ]
}
```

## How price rules are evaluated

The `prices` array is evaluated **top to bottom against your request payload**, and the first row whose `matches` conditions all hold determines the price. A row without `matches` always matches — it is the fallback.

Conditions compare your request parameters:

| Condition                               | Meaning                                                                                           |
| --------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `"resolution": "1K"`                    | Parameter equals the value exactly                                                                |
| `"duration": { "$gte": 5, "$lte": 10 }` | Numeric parameter is in range (`$gt`, `$gte`, `$lt`, `$lte`, `$in`, `$nin`)                       |
| `"images": { "$size": 3 }`              | Array parameter has exactly 3 items (`$size_gt`, `$size_gte`, `$size_lt`, `$size_lte` for ranges) |

A parameter that is **absent from your request never matches a condition** — defaults are not filled in before matching. Price tables are ordered so that omitting an optional parameter lands on the row for its default behavior.

Worked example, using the table above:

* `{"images": [a], "resolution": "1K"}` → first row → **\$0.045**
* `{"images": [a, b, c], "resolution": "1K"}` → 1K row with `$size: 3` → **\$0.053**
* `{"images": [a]}` (resolution omitted, model defaults to 2K) → skips the 1K rows, hits `$size_lte: 1` → **\$0.09**

If a matched row has a `usage_key`, the amount is `unit_amount × ` that parameter's value (for example price per second of requested duration).

LLM models (chat, messages, responses) are billed per token instead — see their price pages under [sunra.ai/models](https://sunra.ai/models?type=llm) and `GET /v1/pricing/model/{model_id}/endpoint/llm`.
