Core concepts
Pricing and quotes
Spending ceilings, quotes and how prices are worked out.
Prices are in USD and depend on the model and its input. A five-second video costs less than a ten-second one, for example. You always set a ceiling, and you can ask for the exact price before running anything.
The spending ceiling
max_charge_amount is the most a single job may cost. It is a six-decimal string such as "0.500000". It is not the price: the API works out the price, and if it fits under your ceiling the job is accepted at that price.
| Ceiling | Price for this input | Result |
|---|---|---|
0.500000 | 0.320000 | Accepted. 0.320000 is set aside. |
0.500000 | 0.600000 | 402 price_limit_exceeded. Nothing is charged. |
Send max_charge_amount. Without it you get 400 spend_limit_required, unless the key has a per-request spend limit (the console doesn't offer these yet; ask Astorie support). With such a limit, the ceiling is the lower of the limit and your max_charge_amount. The clients never fill the field in for you.
Quotes
A quote tells you the exact price of an input without running it. It costs nothing and sets nothing aside. Use it to show a price to your users, or to check a model's price before you set a ceiling.
import { Astorie } from "@astorie/client";
const client = new Astorie();
const input = {
prompt: "A red chair in a sunlit studio",
aspect_ratio: "1:1",
resolution: "1K",
output_format: "png",
};
const quote = await client.quote("google/nano-banana-2", input);
console.log(quote.quoted_amount, quote.expires_at);A quote expires after five minutes. To lock in the quoted price, pass its ID as quote_id when you create the job, with the same input. A quote can be used once. An expired quote gets 410 quote_expired, and a used one gets 409 quote_already_used.
Price units
A quote's unit is output (priced per image, unit_count images) or job (one price for the whole job). A video is one job whose price already includes its length. The catalog lists video rates per second so you can compare models, but quotes and jobs don't use that unit.
Batches
Some models make several outputs in one job. When the provider reports how many of them it delivered and that is fewer than you asked for, you pay only for those. For example, a job priced at 1.000000 that delivers 2 of 3 images is charged 0.666666 and 0.333334 is returned. When the provider sends no batch counts at all, a job that returns at least one output is charged in full.