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 or one character wrong: story-episode recipe, step 5. 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, state the price in the same message as your ask, wait for a go naming THIS purchase (SPENDING RULES: get_recipe spending-rules).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"draft_id": "<draft_id>"
},
"name": "generate_cast_portraits"
}
}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). |