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

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Billing & Credits

> How AIsa bills usage: one prepaid balance, per-token model pricing, fixed or metered data-API pricing, free quotes, spend caps, and per-call cost reporting. Current prices live on aisa.one/models and aisa.one/api.

AIsa is usage-based. You fund one balance and every model call, data-API call, MCP `batch_use`, and CLI `call` draws on it. You can pay as you go or choose a subscription plan; see [aisa.one/pricing](https://aisa.one/pricing) for plans.

The docs explain **how** you are billed. They do not list prices, which change more often than the docs. Current prices:

* **Models:** [aisa.one/models](https://aisa.one/models) - input and output price per model, side by side.
* **Data APIs:** [aisa.one/api](https://aisa.one/api) - each provider page shows whether an endpoint is fixed or metered, its reference price, and its cost rules.

## Credits and top-ups

* New accounts start with free credit for testing.
* Top up in [Console → Billing](https://console.aisa.one/billing) (or `aisa topup` from the CLI). Payment completes on Stripe's hosted page.
* The balance is shared by all your keys and sessions. A key with a [spending limit](https://aisa.one/docs/guides/authentication.md#key-settings) can spend up to the lower of its remaining limit and the balance.
* When the balance or a key's limit runs out, requests fail with `402` (`insufficient_wallet_balance` or `insufficient_api_key_balance`) before any provider is called. A few premium endpoints also require a subscription; their `402` says so.

## Models

Model calls are billed by usage reported for that request:

| Model type | Billed by |
| - | - |
| Text, coding, and vision models | Per 1M tokens: input and output, plus cache read and cache write where the route reports them |
| Embedding, rerank, and classify models | Per 1M input tokens |
| Image models | Per request (one price however many images `n` asks for) or per token, depending on the model |
| Video models | Per second of output or per 1M tokens, with a separate rate per resolution |

For token models: `cost = input_tokens / 1,000,000 × input_price + output_tokens / 1,000,000 × output_price`, plus cache buckets when present. Streaming does not change the price. The response's `usage` object reports the tokens that were billed.

## Data APIs

Data APIs are billed per request under one of two models:

* **Fixed per call** - every successful request to the endpoint costs the same, regardless of response size. Examples: Open-Meteo, CoinGecko, Polymarket, Kalshi, Apollo, EDINET, FRED.
* **Metered** - the price follows what the request consumes (results, rows, pages, or provider credits), times your plan multiplier, so it grows with what the request returns. Examples: Twitter, Tavily, web search, Financial, YouTube, Scholar, Exa, Perplexity, Firecrawl, Semrush, Ahrefs, SimilarWeb, TikHub, DataForSEO.

Some endpoints, including SimilarWeb, use a credit formula. Read the endpoint's reference page for the formula before a paid request; if no maximum is documented, do not run it under an approval-first policy.

What counts as billable:

* A request that is processed and returns a result is billed. Each retry that succeeds is billed again, so make retries deliberate.
* A request rejected before processing - bad credentials, rate limiting, insufficient balance, a price above your cap - is not billed.
* Per-call rates can differ by plan or group; the amount actually applied is shown in Usage.

Through MCP, `search`, `list_categories`, `get_details`, and `batch_quote` are free; `batch_use` is billed per call at the same rates. Selected data endpoints also accept per-request payment through the Machine Payments Protocol (MPP) without an API key; see [Machine Payments](https://aisa.one/docs/integrations/machine-payments.md).

## Cost estimates, quotes, and charges

* **Catalog estimates:** `default_request_estimate_usd` in the catalog describes a reference request. It is not a guaranteed starting price, a maximum, or a bill.
* **Free quotes:** On endpoints that support `X-AISA-Cost-Mode: quote`, send the exact request with the API key that will run it. The quote reflects your current account pricing. It does not call the upstream provider or debit your balance.
* **Account multiplier:** `billing_multiplier_ppm` is your multiplier in parts per million; divide by 1,000,000. For example, 1,000,000 means 1×. A published reference multiplier does not replace the one in your authenticated quote.
* **Micro-USD units:** Cost fields use integer micro-USD (1 USD = 1,000,000 micro-USD).
* **Settled cost:** After execution, the REST response header `X-AISA-Customer-Cost-Micros-USD`, or a successful native Tool result's `customer_cost_micros_usd`, reports the customer cost when present. Missing cost metadata means unknown, not free. A Tool `cost_estimate` is still an estimate, and provider cost is not your debit. Reconcile charges with [Usage](https://aisa.one/docs/guides/dashboard/overview.md#usage) and your balance; see the [API reference](https://aisa.one/docs/api-reference.md#settled-call-cost) for parsing details.

## Quote, review, then execute

Use the complete URL and parameters from the current endpoint reference. The following GET example applies to endpoints that declare quote and maximum-price support. For POST or other methods, preserve the same method and body as well as the URL in both steps. Set `AISA_API_KEY` and `AISA_REQUEST_URL` in your environment; keep the same account and request parameters for both steps.

First, request a free quote:

```bash theme={null}
curl --fail-with-body --silent --show-error "${AISA_REQUEST_URL:?Set AISA_REQUEST_URL}" \
  --header "Authorization: Bearer ${AISA_API_KEY:?Set AISA_API_KEY}" \
  --header "X-AISA-Cost-Mode: quote" \
  --output quote.json
```

Check that the response has `object: cost_estimate`. Convert `estimated_cost_micros_usd` to USD by dividing by 1,000,000, without rounding down. Set `AISA_MAX_PRICE_USD` to the amount you approved. This is an admission check: if the execution estimate exceeds your limit, the gateway rejects the request with `402` before calling the upstream provider. It does not cap the final charge.

Only after review, execute the same request **without** the quote header:

```bash theme={null}
curl --fail-with-body --silent --show-error "${AISA_REQUEST_URL:?Set AISA_REQUEST_URL}" \
  --header "Authorization: Bearer ${AISA_API_KEY:?Set AISA_API_KEY}" \
  --header "X-AISA-Max-Price-USD: ${AISA_MAX_PRICE_USD:?Set AISA_MAX_PRICE_USD}"
```

MCP offers the same pair: `batch_quote` returns a quote for the exact calls without running them, and `batch_use` runs the same calls after review. Re-quote if the tools or arguments change.

### Idempotency for synchronous Similarweb calls

For the synchronous Similarweb routes that declare `Idempotency-Key`, generate one unique key for a logical execution and keep it with your request record. Add this header to the execution command above:

```bash theme={null}
--header "Idempotency-Key: ${AISA_IDEMPOTENCY_KEY:?Set AISA_IDEMPOTENCY_KEY}"
```

Reusing a key for an already admitted request returns 409, such as `{"error":"idempotent request already admitted"}`. This prevents duplicate admission; it does **not replay the original response**. If the first response was lost, check Usage and the recorded request ID when available. Do not change the key to bypass a conflict or blindly retry an uncertain paid operation. A deliberately new operation needs a new key. Async jobs and other API families have their own contracts.

For date inputs, follow the individual operation's constraints. Classic Similarweb Traffic & Engagement also accepts complete dates such as `2026-09-01` through `2026-09-30`; this does not extend the `YYYY-MM` month-only format of managed trend and snapshot requests. Some validation errors include a `supported` object with allowed values or bounds. Use those details when present, but do not assume every error contains this field.

## Budgeting an agent workflow

A multi-step agent usually incurs more than one charge: retrieval calls, model tokens, retries or fallbacks, enrichment of shortlisted records, and media generation. The cheapest single endpoint is not always the cheapest complete task if it needs more retries or follow-up calls.

Before scaling, define:

* A maximum cost per call and per task. On endpoints that declare maximum-price support, send the per-call maximum as `X-AISA-Max-Price-USD`; it rejects calls whose estimate is higher but does not cap the final charge. For model calls, bound output with `max_tokens`.
* A spending limit on the key the agent uses.
* Which amounts need a person's confirmation, and whether the agent may fall back to a more expensive route.
* What happens when the balance runs out.

Then run a small representative task, inspect its records in Usage, and measure the whole workflow rather than one call.

## Where to see what you spent

[Console → Usage](https://aisa.one/docs/guides/dashboard/overview.md#usage) lists every request with its endpoint, key, model, tokens, and the amount charged. `GET /v1/usage` returns daily totals for a key from code, and `aisa usage` does the same from the CLI.


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