Spend & limits
How a request is charged
Two payment paths, one per request.
Balance debit (the default). You pre-fund USDC into your own embedded wallet. Aile reserves an estimate before dispatch, then commits the real cost when the response completes and refunds the difference. Caller funds are never pooled server-side; the only account debited is your own.
x402. If your client can sign an x402 payment, USDC goes straight to the
serving sharer on chain. Aile touches no key and takes no platform cut on this
path. The payment is the whole quote, with no refund, so x402 refuses with a 400
what it cannot bound: a route that sends no output cap upstream (codex), n other
than 1, a thinking budget or tool floor above max_tokens, or an attachment Aile
cannot measure. With no max_tokens, x402 sends upstream the 4,096 it priced.
max_tokens is the lever you hold
A reservation is taken against the output ceiling your request authorises, not
against the reply that comes back. Set max_tokens to bound the bill where the route
sends it upstream (codex does not); tools and thinking can raise that cap, and a key's
balance is billed up to it. It bounds output only: cache writes the provider reports
bill at up to 2x input, so they can take the input side past the quote too.
With no max_tokens, the quote assumes 4,096 output tokens, but a key's balance is
billed on the provider's reported usage, up to the cap the route actually sent (the
model's context window when it sends none) and never past what your balance could
spend when the request started. Self-hosted capacity never bills past the quote.
The difference is refunded, so an over-large ceiling does not cost you, but it does hold more of your balance while the request is in flight.
1aile price gpt-5.2 --max-tokens 10242aile price gpt-5.2 --in 3000
aile price sends nothing. It prices the next request across every sharer,
cheapest first, at the ceiling you name, so you can watch the number move before
you commit to it.
Attachments
A PDF is priced per page, and a video on a Gemini model per second. A linked file, or one Aile cannot
read, holds the model's full context window until the provider reports usage; send
the bytes as a data URI instead. A balance that cannot cover that hold is a 402
saying why. Over x402 such a file is refused.
Long prompts
Some models publish a long-context price. Once the whole prompt, cached tokens
included, reaches that line, the whole request bills at the higher band, and
x-aile-max-price is checked at the band the request reaches. /catalog lists the
bands as longContext. GET /v1/models publishes the dearest band as
max_usd_per_mtok_in / _out, so an x-aile-max-price at or above both _in and
_out is never refused at a band.
Prompt caching and audio output
Cached prompt tokens bill as the provider bills them: a cache read at the model's
cache-read rate, never above input, and a cache write at its write rate, never
below input (a 1-hour write on Claude at 2x input). GET /v1/models lists both as
max_usd_per_mtok_cache_read and max_usd_per_mtok_cache_write where the model
publishes them (the 1-hour write where the route bills one). The quote prices every input token at the input rate, so a
reported cache write can bill past x-aile-price.
A chat request asking for audio output (modalities naming audio) is quoted and
held at the model's audio output rate where that is dearer, so a reply that is all
audio is covered. Under a dollar x-aile-max-price, no audio token bills above it
either.
Non-chat endpoints
Images, audio, video, music, rerank, moderation, OCR, web search and scrape bill per
unit, at the model's list price × the serving sharer's margin: per image, per 1,000
characters of speech, per minute of audio, per second of video, per track, per search
of up to 100 document chunks, per input, per page, per query, per webpage. The reply's x-aile-units / x-aile-unit (x-aile-images on images) say what
was billed, and a reply with nothing usable is not charged. Embeddings and
decisions bill tokens. See each endpoint's page under Calling.
What you have spent
1aile spend2aile spend --json
Counted from your own served requests, so a sharer who was cheap but timed out a third of the time looks worse here than any listing can show.
Keyed on the sharer's handle rather than their machine, so their history follows them across boxes, and a bad record cannot be shed by re-enrolling a node.
The same view is in the dashboard under Account → Usage, alongside sharing earnings if you do both.
Each buffered reply carries what it cost: an x-aile-cost header ($0.0007) and,
on a JSON body with a usage object, usage.cost in USD. Both are the figure
the request committed, after any discount. A stream carries no usage.cost and no header (the figure is not
known when its headers go out), and nor do the non-chat endpoints; look those up as
below.
Look up a request
1curl "https://api.aile.sh/v1/generation?id=req_a1b2c3d4e5f6" \2 -H "Authorization: Bearer $AILE_API_KEY"
id is the reply's x-request-id header (the OpenAI SDK's response._request_id),
not the body's id. GET /v1/generation/{id} is the same. It is scoped to your
account and answers 404 for anyone else's id, and until the request's row is
written, a moment after the reply for a stream.
data follows OpenRouter's generation object: total_cost and usage are the USD
committed (0 when a stake window covered it; under a staker discount, the
discounted share you paid),
tokens_prompt is the whole prompt with cache included, native_tokens_cached
is the cached part of it, native_tokens_reasoning the reasoning part of the completion, latency is the first token in ms and
generation_time the total. A key aile has no source for is null. The aile
block adds the request's status, surface, attempts, the serving lender
handle, cost_micros, and settlement (rail balance or x402, its status
and tx).
Per-key limits
A spend limit belongs to a key, not to the account. When a key reaches its limit it stops serving rather than drawing further on your balance, so one runaway integration cannot spend what the rest of the account holds.
Combine with a price cap for a hard ceiling on both dimensions:
1x-aile-max-price: 8
Keeping the bill down
- Cap
max_tokens. The single most effective lever, because it bounds the reservation itself. A key's balance is billed up to the cap sent upstream. - Set
x-aile-max-price. Refuses anything above your number rather than serving it at a price you did not expect. - Do not over-pin. Pinning one node means one machine's price and one machine's availability. Naming just the provider, which every chat request must, and letting the router pick the sharer usually costs less, because price is the primary sort.
- Check the catalogue is live.
GET /v1/modelsreflects who can serve now; a model that vanished means nobody is sharing it this minute.
Funding
Deposit to the address in Wallet. USDC, USDT, SOL and $AILE are all accepted; all of them are swapped to USDC inside your own wallet and credited at 0% fee. A swap whose outcome cannot be confirmed is not credited until someone checks it. A card top-up, where the deployment enables it, carries a 5% fee on the USDC that arrives.
A $AILE deposit additionally grants a discount tab of the same value. Requests it covers are priced 2% below list × margin. It is funded out of Aile's own fee, and the sharer is unaffected. Money has the arithmetic.
Crypto top-ups are never charged a fee
No crypto asset carries a deposit fee; only a card top-up does. The platform fee applies to settlement, out of the sharer's share, and is never added to your price.