Skip to main content
Docs menu

Billing

Markdown

Prepaid tokens: the balance, its ledger, buying a pack, the price sheet, the monthly budget, alerts and the usage breakdown. These operations exist only on deployments that sell tokens.

List billing alertsDeployment option

GET/v2/billing/alerts

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

The account's billing alerts, newest first, and how many are not acknowledged. unacknowledged=true lists only those.

Capability No capability is checked.

Parameters

NameLocationTypeDescription
cursorQueryDevCursorThe next_cursor of the previous page. Omit it to start from the first page.length 1..1024
limitQueryintegerHow many items a page holds at most: 1 to 100, 20 by default.1..100, default: 20
unacknowledgedQueryboolean

Responses

Response headers

  • Mirabase-Tokens-Charged Prepaid tokens only (deployments that sell them, accounts on them), on successful responses of operations that charge: tokens this request was charged. Final.
  • Mirabase-Tokens-Reserved Tokens held for this request's model calls that settle after the response; the ledger has the final amount.
  • Mirabase-Tokens-Remaining The account's spendable tokens after this request's last charge or hold, when it had one.

Error statuses

400 401 403 404 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl "https://api.mirabase.io/v2/billing/alerts" \
  -H "Authorization: Bearer $MIRABASE_API_KEY"

Example response

json
{
  "data": [
    {
      "id": "<id>",
      "kind": "low_balance",
      "data": {},
      "created_at": "2026-11-06T00:00:00Z",
      "delivery": {
        "email": "pending",
        "webhook": "pending"
      }
    }
  ],
  "unacknowledged": 1
}

Acknowledge all alertsDeployment option

POST/v2/billing/alerts/acknowledge

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

Marks every alert as read.

Capability No capability is checked.

Responses

Response headers

  • Mirabase-Tokens-Charged Prepaid tokens only (deployments that sell them, accounts on them), on successful responses of operations that charge: tokens this request was charged. Final.
  • Mirabase-Tokens-Reserved Tokens held for this request's model calls that settle after the response; the ledger has the final amount.
  • Mirabase-Tokens-Remaining The account's spendable tokens after this request's last charge or hold, when it had one.

Error statuses

400 401 402 403 404 408 409 410 412 413 415 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl -X POST "https://api.mirabase.io/v2/billing/alerts/acknowledge" \
  -H "Authorization: Bearer $MIRABASE_API_KEY"

Example response

json
{
  "acknowledged": 1
}

Acknowledge an alertDeployment option

POST/v2/billing/alerts/{alert_id}/acknowledge

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

Marks one alert as read. 404 for an alert this account does not have.

Capability No capability is checked.

Parameters

NameLocationTypeDescription
alert_idRequiredPathDevIdOpaque server-issued identifier. Clients compare it byte for byte.length 1..256

Responses

Response headers

  • Mirabase-Tokens-Charged Prepaid tokens only (deployments that sell them, accounts on them), on successful responses of operations that charge: tokens this request was charged. Final.
  • Mirabase-Tokens-Reserved Tokens held for this request's model calls that settle after the response; the ledger has the final amount.
  • Mirabase-Tokens-Remaining The account's spendable tokens after this request's last charge or hold, when it had one.

Error statuses

400 401 402 403 404 408 409 410 412 413 415 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl -X POST "https://api.mirabase.io/v2/billing/alerts/$ALERT_ID/acknowledge" \
  -H "Authorization: Bearer $MIRABASE_API_KEY"

Example response

json
{
  "acknowledged": 1
}

Read the balanceDeployment option

GET/v2/billing/balance

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

The account's token balance, debt, rate tier and price sheet. Requires tenant_admin, knowledge:manage and a key without Space or metadata restrictions (in the console: the team's owner or an admin); anything else is 403. Only on deployments that sell tokens; elsewhere 404.

Capability No capability is checked.

Responses

Response headers

  • Mirabase-Tokens-Charged Prepaid tokens only (deployments that sell them, accounts on them), on successful responses of operations that charge: tokens this request was charged. Final.
  • Mirabase-Tokens-Reserved Tokens held for this request's model calls that settle after the response; the ledger has the final amount.
  • Mirabase-Tokens-Remaining The account's spendable tokens after this request's last charge or hold, when it had one.

Error statuses

400 401 403 404 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl "https://api.mirabase.io/v2/billing/balance" \
  -H "Authorization: Bearer $MIRABASE_API_KEY"

Example response

json
{
  "billing": "prepaid",
  "plan": "free",
  "tokens": 24812345,
  "purchased_tokens": 0,
  "grant_tokens": 24812345,
  "held_tokens": 54000,
  "available_tokens": 24758345,
  "debt_tokens": 0,
  "writes_blocked": false,
  "tier": "grant",
  "low_balance": false,
  "next_expiry": {
    "at": "2026-12-20T03:00:00Z",
    "tokens": 24812345
  },
  "price_sheet": {
    "version": "2026-11-20.draft-1",
    "unit": "token",
    "packs": [
      {
        "id": "starter",
        "tokens": 100000000,
        "price_minor": 1000,
        "currency": "USD"
      }
    ],
    "signup_grant": {
      "tokens": 25000000,
      "valid_days": 30
    },
    "purchased_valid_days": 365,
    "requests": [
      {
        "operation": "search",
        "tokens": 500
      }
    ],
    "model_work": [
      {
        "operation": "index",
        "per_1k_input_tokens": 3000
      }
    ],
    "storage": {
      "free_bytes": 1073741824,
      "tokens_per_gib_day": 666667
    }
  }
}

Read budget and alert settingsDeployment option

GET/v2/billing/controls

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

The monthly budget, alert thresholds, low-balance threshold, email switch and alert webhook, with this month's usage. 409 billing_not_applicable for an account that is not on prepaid tokens.

Capability No capability is checked.

Responses

Response headers

  • Mirabase-Tokens-Charged Prepaid tokens only (deployments that sell them, accounts on them), on successful responses of operations that charge: tokens this request was charged. Final.
  • Mirabase-Tokens-Reserved Tokens held for this request's model calls that settle after the response; the ledger has the final amount.
  • Mirabase-Tokens-Remaining The account's spendable tokens after this request's last charge or hold, when it had one.

Error statuses

400 401 403 404 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl "https://api.mirabase.io/v2/billing/controls" \
  -H "Authorization: Bearer $MIRABASE_API_KEY"

Example response

json
{
  "monthly_budget_tokens": 500000000,
  "alert_thresholds": [
    50,
    80,
    100
  ],
  "low_balance_tokens": 2000000,
  "email_alerts": true,
  "webhook": {
    "url": "https://hooks.example.com/mirabase",
    "created_at": "2026-11-21T08:00:00Z"
  },
  "month": {
    "period": "2026-11",
    "used_tokens": 212000000,
    "starts_at": "2026-11-01T00:00:00Z",
    "resets_at": "2026-12-01T00:00:00Z"
  },
  "budget_reached": false
}

List balance changesDeployment option

GET/v2/billing/ledger

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

Every change of the balance, newest first. Same access as the balance. Only on deployments that sell tokens; elsewhere 404.

Capability No capability is checked.

Parameters

NameLocationTypeDescription
cursorQueryDevCursorThe next_cursor of the previous page. Omit it to start from the first page.length 1..1024
limitQueryintegerHow many items a page holds at most: 1 to 100, 20 by default.1..100, default: 20

Responses

Response headers

  • Mirabase-Tokens-Charged Prepaid tokens only (deployments that sell them, accounts on them), on successful responses of operations that charge: tokens this request was charged. Final.
  • Mirabase-Tokens-Reserved Tokens held for this request's model calls that settle after the response; the ledger has the final amount.
  • Mirabase-Tokens-Remaining The account's spendable tokens after this request's last charge or hold, when it had one.

Error statuses

400 401 403 404 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl "https://api.mirabase.io/v2/billing/ledger" \
  -H "Authorization: Bearer $MIRABASE_API_KEY"

Example response

json
{
  "data": [
    {
      "id": "<id>",
      "kind": "grant",
      "amount": 1,
      "operation": "<operation>",
      "created_at": "2026-11-06T00:00:00Z"
    }
  ]
}

Read the price sheetDeployment option

GET/v2/billing/prices

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

Every price the service charges by, in tokens, and the categories of the usage breakdown. Needs no credentials; cacheable for five minutes. Estimate a request before sending it, or reconcile the ledger after.

No credentials required

Responses

Error statuses

400 401 403 404 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl "https://api.mirabase.io/v2/billing/prices"

Example response

json
{
  "version": "<version>",
  "unit": "token",
  "packs": [
    {
      "id": "<id>",
      "tokens": 1,
      "price_minor": 1,
      "currency": "<currency>"
    }
  ],
  "signup_grant": {
    "tokens": 1,
    "valid_days": 1
  },
  "purchased_valid_days": 1,
  "requests": [
    {
      "operation": "<operation>",
      "tokens": 1
    }
  ],
  "model_work": [
    {
      "operation": "<operation>"
    }
  ],
  "storage": {
    "free_bytes": 1,
    "tokens_per_gib_day": 1
  },
  "categories": [
    {
      "category": "writes",
      "operations": [
        "<operations>"
      ]
    }
  ]
}

Read the token usage breakdownDeployment option

GET/v2/billing/usage

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

Tokens charged by day, API key, Space, category and operation (any combination, group_by), with filters, for up to 366 days. Rows are sorted by the grouping fields; limit is 1 to 1000 (default 100). The figures are the ledger's: they add up exactly to its usage entries.

Capability No capability is checked.

Parameters

NameLocationTypeDescription
group_byQuerystringComma-separated: day, api_key, space, category, operation. Default day.
fromQuerystringFirst day, YYYY-MM-DD (UTC). Default 29 days before to. The range is at most 366 days.
toQuerystringLast day, inclusive. Default today (UTC).
api_key_idQuerystring
space_idQuerystring
categoryQuerystringwrites, retrieval, context, answers, model_stages or storage.
limitQueryinteger
cursorQuerystring

Responses

Response headers

  • Mirabase-Tokens-Charged Prepaid tokens only (deployments that sell them, accounts on them), on successful responses of operations that charge: tokens this request was charged. Final.
  • Mirabase-Tokens-Reserved Tokens held for this request's model calls that settle after the response; the ledger has the final amount.
  • Mirabase-Tokens-Remaining The account's spendable tokens after this request's last charge or hold, when it had one.

Error statuses

400 401 403 404 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl "https://api.mirabase.io/v2/billing/usage" \
  -H "Authorization: Bearer $MIRABASE_API_KEY"

Example response

json
{
  "data": [
    {
      "tokens": 1,
      "charges": 1
    }
  ],
  "group_by": [
    "day"
  ],
  "from": "<from>",
  "to": "<to>"
}

Export the token usage breakdownDeployment option

GET/v2/billing/usage/export

This endpoint needs prepaid tokens (billing) enabled on the deployment. Where it is not enabled, the endpoint does not exist and returns 404.

The same rows as CSV, at most 50,000 (422 beyond: narrow the range or the grouping).

Capability No capability is checked.

Parameters

NameLocationTypeDescription
group_byQuerystringComma-separated: day, api_key, space, category, operation. Default day.
fromQuerystringFirst day, YYYY-MM-DD (UTC). Default 29 days before to. The range is at most 366 days.
toQuerystringLast day, inclusive. Default today (UTC).
api_key_idQuerystring
space_idQuerystring
categoryQuerystringwrites, retrieval, context, answers, model_stages or storage.

Responses

  • 200 text/csv string

Response headers

  • Mirabase-Tokens-Charged Prepaid tokens only (deployments that sell them, accounts on them), on successful responses of operations that charge: tokens this request was charged. Final.
  • Mirabase-Tokens-Reserved Tokens held for this request's model calls that settle after the response; the ledger has the final amount.
  • Mirabase-Tokens-Remaining The account's spendable tokens after this request's last charge or hold, when it had one.

Error statuses

400 401 403 404 422 429 500 503 See Errors for the error shape and Error codes for what each code means.

Example request

curl
curl "https://api.mirabase.io/v2/billing/usage/export" \
  -H "Authorization: Bearer $MIRABASE_API_KEY"