From 6f19808f153523a6ab7fe9a23f0faad1176d7a1a Mon Sep 17 00:00:00 2001 From: Mike Wichers Date: Sun, 22 Feb 2026 10:43:08 -0500 Subject: [PATCH] fix: Clarify budget is text-only; Imagen cover cost (~$0.12 max) is separate --- ai/setup.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ai/setup.py b/ai/setup.py index 44b63df..6042392 100644 --- a/ai/setup.py +++ b/ai/setup.py @@ -94,10 +94,16 @@ def select_best_models(force_refresh=False): (planning, state tracking, consistency checks, director treatments per chapter) Writer role total: ~450,000 input tokens + ~135,000 output tokens (drafting, evaluation, refinement per chapter — 2 passes max) - Artist role total: ~20,000 input tokens + ~5,000 output tokens (cover + marketing copy) + Artist role total: ~30,000 input tokens + ~8,000 output tokens + (cover art prompt design, cover layout, blurb, image quality evaluation — text calls only) + + NOTE: Cover IMAGE generation uses the Imagen API (billed per image, not per token). + Imagen costs are fixed at ~$0.04/image × up to 3 attempts = ~$0.12 max. This is SEPARATE + from the text token budget below and cannot be reduced by model selection. COST FORMULA: cost = (input_tokens / 1,000,000 * input_price) + (output_tokens / 1,000,000 * output_price) - HARD BUDGET: Logic_cost + Writer_cost + Artist_cost must be < $2.00 total. + HARD BUDGET: Logic_cost + Writer_cost + Artist_cost (text only) must be < $1.85 + (leaving $0.15 headroom for Imagen cover generation, total book target: $2.00). SELECTION RULES (apply in order): 1. FREE FIRST: If a free/exp model exists (any tier, any quality), pick it for Logic. Cost = $0. @@ -222,7 +228,7 @@ def init_models(force=False): models.pro_model_name = pro_name utils.log("SYSTEM", f"Models: Logic={logic_name} ({logic_cost}, {logic_book}/book) | Writer={writer_name} ({writer_cost}, {writer_book}/book) | Artist={artist_name} | Pro-Rewrite={pro_name} ({pro_cost})") - utils.log("SYSTEM", f"💰 Estimated book generation cost: {total_book_cost} (budget: $2.00)") + utils.log("SYSTEM", f"💰 Estimated book cost: {total_book_cost} text + ~$0.00-$0.12 Imagen cover (budget: $2.00 total)") utils.update_pricing(logic_name, logic_cost) utils.update_pricing(writer_name, writer_cost)