--- name: price-check description: Check shuut prices, credits and refunds - quote a paid shuut call with dry_run before making it, cap what it may spend, read the balance, usage and refunds. Use when the user asks what something costs, how many credits they have or used, or why a job was refunded, wants to see the price before deciding, or sets a budget. --- # Prices, credits and refunds shuut bills the signed-in user's credits (100 credits = US$1). Paid tools make the job and charge as soon as they are called: price a call first only when the user asks for the price, wants to see it before deciding, or sets a budget, and tell the user prices, credits spent or the balance only when they ask or a call fails. Every paid tool takes `dry_run`, `idempotency_key` and `max_spend_credits`. 1. Call `balance` to see the credits, expiring lots, whether the account can create, and its concurrent job limit. 2. Call the create tool you plan to use with `dry_run: true` and an `idempotency_key`. It returns `cost_credits`, `balance_credits` and `sufficient_balance`; nothing runs and nothing is charged. A batch returns `total_cost_credits`. `quote.seconds_adjusted` is true when the length was fitted to what the model or account allows. `job_slots_free` 0 means the real call would fail with too_many_jobs until a running job ends. 3. Tell the user the price. When they agree (or it fits their budget), call the same tool again without `dry_run`, with `max_spend_credits` set to the dry_run `cost_credits` (batches: `total_cost_credits`) so a higher price is refused (nothing is charged); a new or the same `idempotency_key` both work. The real call prices the job again, so without that cap the user could pay more than they agreed to. For a budget across several calls, set each call's `max_spend_credits` to what is left of it. 4. Keep the `idempotency_key` when you retry the same request: the same key and the same input return the same job instead of charging twice. If that job failed or was canceled (`new_key_required: true`), the same key only returns it again: use a new `idempotency_key` to try again. In a batch, resend only the failed items (`new_key_indices`) as a new call with a new key; the others are already made, and sending them again with a new key charges them again. Example arguments for `generate_image`: ```json { "prompt": "A red sneaker on wet asphalt at night", "idempotency_key": "sneaker-1", "dry_run": true } ``` ## Credits used and refunds - `usage_get` summarizes credits charged and refunded over the last N days, and `subscription_get` shows the user's plan, renewal date and this period's subscription credits. - A failed or cancelled job is refunded in full (see `refunded_credits`). To retry a failed job, call the create tool again with a new `idempotency_key`. - The exception is error.code outcome_unknown: the provider's outcome is still being checked, so the unconfirmed part stays charged until it is confirmed (refunded_credits shows any part already returned; a result may still arrive, or the rest is refunded then). Check the same job_id again later with `jobs_get`; do not submit a replacement job. - `jobs_cancel` cancels a job that has not started running and refunds it in full. ## When it fails - insufficient_credits: nothing was charged. Tell the user the price and their balance, and show the `top_up_url` from the error (the shuut page with credits and plans for their account). Follow the error's `next_step`. Retry with the same `idempotency_key` only when the user asks. - max_spend_exceeded: nothing was charged. Ask the user before raising `max_spend_credits`.