Generate the cast's portraits (paid)
generate_cast_portraitsBUYS the portraits for a cast draft: one image generation per member that still needs a face, at the chosen image model's rate, then saves every member to the user's character library. The cast's paid step (the webapp's 'Generate cast' button). WHEN: the user has READ the draft from generate_cast, accepted it, and said go to the price. Take the figures from the draft's own portrait_models (per_portrait_tokens, total_tokens), never from memory (a cast portrait prices differently from an ordinary image): 'portraits: 3 on = <total_tokens> T, or at <per_portrait_tokens> each. Go?'. estimate_only: true re-prices against the CURRENT catalog if the draft has sat a while. OFFER THE IMAGE MODEL ONCE, in a line you are already writing (not an interview): name the model that draws the pictures in plain words with its default and price; no preference means the series' default. THE CARD: this call already put the aicut cast card up, each portrait filling in as it generates: do not poll or call show_generation (one get_image read of portrait_image_id if asked). No card (a terminal)? Poll each generating member's portrait_image_id with wait_for_generation (media image) and give the urls. AFTER: portraits generate asynchronously, only for members that needed one. portrait_status: "ready" with a null portrait_image_id was NOT generated and NOT charged (it arrived photographed, or already had a face): not missing. A member whose id is null could not be saved and cannot be a cast_member_id. charged_tokens is what moved. One face wrong: regenerate_cast_portrait; one CHARACTER wrong: describe_cast_member; a fresh generate_cast is a different cast and a new charge. THE DRAFT IS SPENT once this succeeds: a repeat with the same draft_id answers 404 cast_draft_not_found or a 201 with charged_tokens: 0 (nothing bought): report it as 'already done', never as a second purchase. IF IT REFUSES PART WAY (402 or a cap): the portraits already generated WERE charged (partial_cast: true, portraits_minted, charged_tokens): tell the user that number, never 'nothing was charged'. Retrying the SAME draft_id generates and charges only the missing members. A 400 naming draft_id means what you passed is not a cast draft id (a job id, a member id): re-read generate_cast's response; there is no other route to a draft. SPENDS TOKENS: price with estimate_only: true, ask in the SAME message as the price, and wait for a go that names THIS purchase (SPENDING RULES, this server's instructions).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| draft_id | Yes | The `draft_id` from `generate_cast`. | |
| estimate_only | No | Price only; creates nothing. | |
| portrait_model | No | One of the draft's `portrait_models` ids. It draws the faces: name it with the price (see OFFER THE IMAGE MODEL), then omit it if the user has no preference (`default: true` is what the series is tuned for). |