Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

Merge branch 'main' into aldegad/subscription-route

Soohong Kim72e8f9163dfc
diff --cc CHANGELOG.md
index bcfea76,07bad14..f4639ab
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -4,10 -4,16 +4,19 @@@ All notable public changes to `sprite-g
## Unreleased
+- **Behavior change: `pixel-draw` runs on your Claude subscription first, and on `ANTHROPIC_API_KEY` only without one** — the order `codex` and `grok` keep. When `claude auth status` says Claude Code is signed in with a subscription (`claude.ai` or `oauth_token`), every call — the drawings, the row repairs, the pick — goes through the unmodified `claude` binary in print mode, from an empty directory, with no tool, no session written and no CLAUDE.md, hook, skill, plugin or MCP server loaded, and costs nothing per call: `report.json` says `auth_source: claude-login`, each call's `mode` is `subscription` and its `cost_usd` `0`, its usage kept. The child never sees `ANTHROPIC_API_KEY`, which print mode would use instead of the login. Without a subscription login the run uses the key as before, billed per call and said on stderr; with neither it is refused naming both, before the run folder is made. A login that refuses a call, has expired or has reached its usage limit fails the call; the run never switches to the key on its own. `--batch` is the API's Message Batches and runs on the key even when signed in. An answer the binary cuts at the output cap is read as `stop_reason: max_tokens`, so the one redraw one effort lower happens on either route. One call may take up to `SPRITE_GEN_CLAUDE_CALL_TIMEOUT_SECONDS` (1800). A `--resume` that reads every call back no longer prints the billing line ([pixel-draw](docs/pixel-draw.md#which-credential-a-call-runs-on)).
+- **Behavior change: every metered call says so on the terminal, and every report names what a call ran on.** How codex is signed in is one reading, `codex_provider.codex_login` (`codex login status`), for the default provider resolution, `gen --provider codex`, the codex facing check and `workflow`: a codex signed in with an API key used to run with no word about it and the workflow called it a subscription; it now prints the per-call charge line before `codex exec` runs, its report records `extra.auth_source: codex-api-key` (`codex-login` on ChatGPT), and `workflow` asks to confirm the API credit. A codex that is not signed in is refused with the reason before it runs. `gen-set` and `video-set` keep each item's output in its log, but a child's billing line and a default provider switch now also print on the terminal as they happen (`base.run_logged`), each `gen-set` row records `auth_source`, and each `video-set` clip result too. `sound` prints the same billing line as every other metered route (it printed its own) and its receipt records `auth_source`. One function reads a provider key from the environment (`base.env_api_key`: a key, none, or a refusal of an empty one) for Anthropic, OpenAI, xAI and ElevenLabs; one function says what to do when xAI rejects a credential (`xai.rejected_fix`), so `gen --provider grok` now gives the same `grok models` refresh as `video`. `workflow` probes a provider once for its images and videos (they share one credential) and asks the API-credit question by that provider's name rather than always about Grok video. Docs: the credential table in the README, grok's `XAI_API_KEY` route in the help and SKILL.md, the sound billing line, `SPRITE_GEN_GEN_TIMEOUT_SECONDS` and `SPRITE_GEN_CLAUDE_READ_TIMEOUT_SECONDS`, and `gen-set --provider` (`codex` or `grok`).
+- **Tests** — `tests/gen/test_claude_login.py` (the login before the key, the key only without a login, neither refused naming both, a batch on the key without asking the login, an unreadable status refused rather than read as no login, the child's environment without a key or the calling session, a message mapped onto the binary's flags and stdin with its image and schema, the stream-json answer, a cut answer read as max_tokens, a refused or limited login an error and not a switch to the key, no result, a timeout and a missing binary), the subscription, batch and read-back cases in `tests/gen/test_pixel_draw.py`, and `gen.base.env_api_key` in `tests/gen/test_gen.py`; `tests/gen/test_codex_login.py` (ChatGPT, an API key and not signed in; the default resolution, `generate` and `workflow` read the same login; an API-key login announces the charge and records it), `base.run_logged` in `tests/gen/test_gen.py`, the ElevenLabs billing line and key refusals in `tests/audio/test_sound.py`.
- **New: `background-tile --axis xy` makes one tile seamless in both directions and measures both joins.** It quilts along x, then along y with a cyclic seam: the second seam's two ends, which meet across the x wrap, may differ by one step at most, so the second quilt cannot break the first one's join. The report measures the finished tile on both axes (`axes.x`, `axes.y`, each with its join, quilt seam, `status` and reasons); the top-level `status` is `needs-review` when either axis is, and each reason names its axis. Two separate one-axis runs had no such rule, and the second run's report measured only its own axis. `inspect_tile_xy(image)` measures both joins of any tile ([asset-tools](docs/asset-tools.md#both-axes-a-ground-tile)).
+ - **New: `pixel-draw` draws a set of up to 64 frames, four a call.** One call still draws at most four frames, so the frames of one answer share a palette and a design; a longer set — a hand-drawn motion of several seconds — is drawn four at a time, one call after another. Every call's prompt names all the frames and which ones it draws; each call after the first writes the first call's palette again — a colour it adds is refused and the rows that use it go to the row repair, a colour it changes is put back, both recorded in G1's `recovered` (`palette_added`, `palette_changed`) — and is shown the first frame and the four just before its own, as the grid it writes (about 6,000 input tokens at 48 px, by the characters a token Opus's own answers wrote). The row repair and the one redraw are each call's own (`c1-part2-gen1`, `c1-part2-gen1-fix1`, `c1-part2-gen2`), the gates run once every frame is drawn, `--resume` reads every call back, and stderr says before the first request how many calls and tokens the set may take. A `--spec` frame may be `{"name": ..., "pose": ...}`, which puts that pose on the frame's own line of its call's prompt. Previews put the frames in rows of eight, and a pick sheet larger than Claude reads unscaled (2576 px on the long edge, 4784 patches, read off Claude's vision page on 2026-10-15) is drawn at the largest smaller whole enlargement that fits, nearest-neighbour, instead of being blurred by the API's downscale. The report's candidates carry `parts`. An effect stays 2–8 frames in one call ([pixel-draw](docs/pixel-draw.md#more-than-four-frames)).
+ - **New: `pixel-draw --style TEXT` draws in a style of your own.** It takes the place of the kind's style sentence (a sprite's "a dark (not pure black) outline around the silhouette, 2-3 shades per material, light from the top-left …") and of nothing else: the transparent background, the safe area and the floor row, a tile's seams and an effect's centre stay. The pick judges craft against the same words in place of its fixed "clean silhouette and outline". Without `--style` both prompts are byte for byte what they were. Same name and meaning as `prepare --style`; spec key `style`; `request.style` in the report ([pixel-draw](docs/pixel-draw.md#the-style)).
+ - **New: `pixel-draw --motion TEXT`: the frames, in their order, are one motion.** The prompt says so in your words, and G6 takes the rule of one motion, written once in the header of `pixel_gates.py`: a frame off the ground row still fails, but a height that changes (an arm raised over the head, a blade swung past it) is asked whether the body changed size or only its pose, by the reading `video-loop --body-height` already makes of a cut (`video.gait_fallback.size_change` on height, mass and breadth) — a pose is an info line, a body drawn at another size warns — and a frame drawn twice is a hold, an info line. `gates.G6` then has `rule: "motion"`, `size_change`, `resized`, `posed` and `holds`. Same name and meaning as `video-prompt --motion`; spec key `motion`; also on `--grid` ([pixel-draw](docs/pixel-draw.md#gates)).
+ - **Behavior change: a `pixel-draw --walk-cycle` is one motion.** Its two passing frames drawn alike, or a height that changes by more than a pixel with the pose, no longer fail G6: they are info lines, and a body drawn at another size warns. A walk cycle still fails off the ground row, and still warns when its legs barely change sides.
+ - **New: `pixel-draw --duration-ms N` times `anim.gif`** (and an effect's `delay_ms`), 150 ms by default as before, at least 10; spec key `duration_ms`, also on `--grid`. Same name and meaning as `compose-cycle --duration-ms`.
+ - **Docs: `pixel-draw`'s note that only effort xhigh spent every token thinking and wrote nothing is corrected** — a set of four 48 px frames at effort high did too (2026-10-14).
+ - **Tests** — `tests/gen/test_pixel_draw_frames.py` (a set of six drawn in two calls, the second holding the first's palette with a colour it added refused and repaired, shown the frames before it and carrying its frames' poses, read back whole on `--resume`; a later call shown the first frame and the four just before its own; a call drawn again on its own one effort lower; a call that fails ending its candidate; each call its own batch; spec frames refused; `--style` in the drawing and the pick of every kind with the structure kept; the default drawing and pick prompts frozen byte for byte from before; `--motion` refused for one frame and for an effect; a synthetic 48 px set of 46 frames of one motion — an arm raised for ten frames and held for four — passing `--grid` with `--motion`, and failing without it; `--duration-ms` in `anim.gif` and an effect's strip; a pick sheet of 46 frames for two candidates drawn at ×3 within Claude's unscaled size), `tests/gen/test_pixel_gates.py` (G6 of one motion lets a raised arm and a hold through, fails a frame off the ground and warns a body drawn larger; a walk cycle is one motion) and `tests/gen/test_pixel_grid.py` (a palette held, with a colour added and one changed; parts joined; previews in rows of eight).
+ - **Fix: a `pixel-draw` answer that writes its block more than once is read from the last block that reads whole.** An answer sometimes writes a first try — the palette and `END` with no frame — then "Corrected:" and the whole block (seen 2026-10-15 on a 16 px icon); G1 read the first block, found the frame missing and drew the candidate again. Now every block is read and the last one that reads whole is the answer (when none does, the last whose rows the row repair can fix), recorded in G1's `recovered` as `block_many` with which block was read. An answer of one block is read as before.
+ - **Tests** — `tests/gen/test_pixel_grid.py` (several blocks read from the last whole one, or the last with rows to repair; one block as before) and an answer of two blocks drawn once in `tests/gen/test_pixel_draw.py`.
- **New: alpha haze cleanup for transparent sheets (`frames.alpha_floor.clear_haze`).** Pixels at or above a floor, and faint pixels within a few pixels of them (an object's anti-aliased edge), are kept byte for byte; every other faint pixel becomes fully transparent. The report measures the haze share before and after and counts the solid and edge pixels that changed (`0`). Used by `ui-kit` (on by default) and `slice-sheet --alpha-floor N` (off by default; writes `<prefix>alpha-cleanup.json`). `slice-sheet --chroma-key none` cuts a sheet that is already transparent on its own alpha ([sheet-slicing](docs/sheet-slicing.md#transparent-sheets)).
- **New verb: `ui-kit` splits a game UI kit sheet into nine-slice elements.** `gen --layout-guide ui-kit` attaches a fixed square layout (panel, button, pressed button, card frame, HP and XP bar frames, timer badge) and asks for each element in its box. `ui-kit --sheet uikit.png --out-dir ui/` clears the haze, assigns parts to boxes by centroid, and writes each element's PNG and `ui-kit.json` (or `--report PATH`, which must end in `.json`; each element's `file` is its PNG's path from the report's directory, so a report written outside `--out-dir` still finds its elements): its rectangle, its stretch (`xy`, `x` for the bars, `none` for the badge), nine-slice insets measured so that every corner ornament and end cap lies in a fixed slice, and the content padding (a bar frame's track, a panel's text area). An ornament in the middle of an edge, an empty box or a stray part is reported or refused ([ui-kit](docs/ui-kit.md)). `--layout-guide` alone is still the one-slot figure guide.
- **New: `game-pack` request and manifest version 2 with `images`, `tiles` and `ui`.** Single images (props) are atlas frames with an anchor and an optional footprint (`"base"` measures where the image meets the ground); tiles are their own PNG and WebP files with their stored and on-screen sizes; `ui.kit` reads a `ui-kit` report into nine-slice entries (frame, size, stretch, insets, padding) and `ui.icons` adds fixed icons. Every number is in pixels of the stored image. A version 1 request is packed byte for byte as before, and a version 1 request naming the new sections is refused ([game-pack](docs/game-pack.md#version-2-images-tiles-and-ui)).
diff --cc SKILL.md
index 44a2a9c,2e998b6..2b65979
--- a/SKILL.md
+++ b/SKILL.md
@@@ -108,8 -108,8 +108,8 @@@ hold the arms still, and check the loo
| Compare the currently displayed loop with a final candidate, including after follow-through | `video-loop-compare` | [loop-comparison](docs/loop-comparison.md) |
| Restore post-processing damage in the current cut from its exact source times, preserving normal cells and playback | `video-source-manifest` → `video-loop-repair` → `video-loop-compare` | [source restoration](docs/loop-comparison.md#restoring-the-active-cut-from-source) |
| Video sprites from a clip your agent makes with a connected video MCP (ZCRE, 지크) | `video-canvas`, `video-prompt --no-last-frame`, the agent's own MCP tools (quote, user approval, generate, save the mp4), then `video-frames` and `video-loop` (a walk or run with `--anchor motion-auto`, which holds its size), and for a walk or run cut in two or more directions `video-cycle-align --view …` over their loop directories (a set it stops on a loop that may hold two cycles: look at that loop, count its strides, and pass `--cycles <loop>=<k>`; a loop the report lists under `unnamed_feet` — its view could not tell the feet apart, or only by too small a margin (`low-margin`): look at its first candidate frame, say which own foot lands there, and align again with `--foot <loop>=left|right`). `video-set` is not run on this route, so the set stage it runs by default (`--align-cycles auto`) is yours to run. sprite-gen never calls the MCP. Walk, run and jump only: ZCRE's `grok-imagine-video-1.5` has no end frame, so idle, attack and diagonal walks are refused unless `--unpinned` | [video-pipeline](docs/video-pipeline.md#a-clip-from-a-video-mcp-on-your-agent--zcre) |
-| Ordinary image or edit | `gen --provider codex` or `gen --provider grok` (subscription routes) | [gen](docs/gen.md) |
-| Pixel art the model draws directly as a grid, 8–48 px (best at 32 or less): an icon, a prop, a monster, a character still, four directions, a walk draft, a tile — on `ANTHROPIC_API_KEY`, **billed per call**; `grid.txt` is the truth, `--grid` re-renders an edited one, `--resume` collects a batch instead of buying it twice | `pixel-draw` | [pixel-draw](docs/pixel-draw.md) |
+| Ordinary image or edit | `gen --provider codex` or `gen --provider grok` (the subscription login first; without one grok uses `XAI_API_KEY`, and a codex signed in with an API key bills it — both per call, said on stderr) | [gen](docs/gen.md) |
- | Pixel art the model draws directly as a grid, 8–48 px (best at 32 or less): an icon, a prop, a monster, a character still, four directions, a walk draft, a tile — on your Claude subscription (`claude` signed in), or without one on `ANTHROPIC_API_KEY`, **billed per call**; `grid.txt` is the truth, `--grid` re-renders an edited one, `--resume` collects a batch instead of buying it twice | `pixel-draw` | [pixel-draw](docs/pixel-draw.md) |
++| Pixel art the model draws directly as a grid, 8–48 px (best at 32 or less): an icon, a prop, a monster, a character still, four directions, a walk draft, a tile, or a hand-drawn motion of up to 64 frames drawn four a call (`--motion`, `{name, pose}` frames, `--duration-ms`), in a style of your own (`--style`) — on your Claude subscription (`claude` signed in), or without one on `ANTHROPIC_API_KEY`, **billed per call**; `grid.txt` is the truth, `--grid` re-renders an edited one, `--resume` collects a batch instead of buying it twice | `pixel-draw` | [pixel-draw](docs/pixel-draw.md) |
| Image generation with no login available (server, container, SaaS) | `gen --provider openai` — server/SaaS route on `OPENAI_API_KEY`, **billed per call**, never a default or a fallback | [gen](docs/gen.md#subscription-first--openai-is-named-or-it-does-not-run) |
| Base and direction anchors | `anchor` | [directional-anchor-workflow](docs/directional-anchor-workflow.md) |
| Curation view or existing image candidates | `curation`, `unpack-atlas --pngs-dir` | [curation](docs/curation.md) |
diff --cc docs/pixel-draw.md
index 8316806,5d7637d..32c2b1b
--- a/docs/pixel-draw.md
+++ b/docs/pixel-draw.md
@@@ -4,7 -4,7 +4,7 @@@
> varies from run to run: expect to compare candidates, re-draw, or touch up `grid.txt` by hand. The numbers below come from a
> small set of measured runs, not from a benchmark.
- > Owns: `sprite-gen pixel-draw`: the inputs, the safe area of a sprite or icon, the run folder and `report.json`, which credential a call runs on, gates G1–G8 and what they take from sprite-gen, the row repair, the one redraw, the pick between candidates, Message Batches and `--resume`, re-rendering an edited `grid.txt` · Index: [docs/README.md](README.md)
-> Owns: `sprite-gen pixel-draw`: the inputs, the safe area of a sprite or icon, the style a drawing is asked in, a set of more than four frames drawn four at a time, the run folder and `report.json`, gates G1–G8 and what they take from sprite-gen, the row repair, the one redraw, the pick between candidates, Message Batches and `--resume`, re-rendering an edited `grid.txt` · Index: [docs/README.md](README.md)
++> Owns: `sprite-gen pixel-draw`: the inputs, the safe area of a sprite or icon, the style a drawing is asked in, a set of more than four frames drawn four at a time, the run folder and `report.json`, which credential a call runs on, gates G1–G8 and what they take from sprite-gen, the row repair, the one redraw, the pick between candidates, Message Batches and `--resume`, re-rendering an edited `grid.txt` · Index: [docs/README.md](README.md)
The model does not paint an image that is then shrunk to a grid. It writes the grid itself: a
palette of keys and, per frame, one line of keys per pixel row. Code checks every answer, asks for
@@@ -27,15 -28,12 +28,16 @@@ subjects made with GPT images shrunk b
frames: it is a draft for a touch-up, and the run says so (G6 warning). A real loop belongs to the
[video → loop pipeline](video-pipeline.md);
- a fixed palette (`pico8`) was kept every time, at a visible cost in material rendering;
- - dense small-pattern tiles (cobblestones) sometimes spent every token thinking and wrote nothing,
- at effort xhigh only.
+ - an answer sometimes spends every token thinking and writes nothing: dense small-pattern tiles
+ (cobblestones) at effort xhigh on 2026-10-12, and a set of four 48 px frames at effort high, all
+ 64,000 tokens, on 2026-10-14 — the run draws it once more one effort lower.
-It runs on `ANTHROPIC_API_KEY` and **every call is billed per call** against that key; the run
-says so on stderr before the first request leaves, and `report.json` adds up what it cost.
+It runs on your **Claude subscription first**, like `codex` and `grok` do: when the `claude` binary
+(Claude Code) is signed in with a subscription, every call goes through it and costs nothing per
+call — it counts against the plan's usage limits. Only without a subscription login does it run on
+`ANTHROPIC_API_KEY`, where **every call is billed per call**; the run says so on stderr before the
+first request leaves, and `report.json` adds up what it cost. See [Which credential a call runs
+on](#which-credential-a-call-runs-on).
## Quick start
@@@ -236,12 -337,11 +343,12 @@@ zlib build. The previews, the tiling an
| Field | |
|---|---|
| `status` | `ok`, `failed` (no candidate passed), `refused` (every candidate refused), `pick_failed`, `unfinished` (a batch not collected yet) |
- | `request` | the resolved inputs (`palette` with its rule and colours) |
+ | `request` | the resolved inputs (`palette` with its rule and colours; `style`, `motion`, `poses` and `duration_ms`) |
| `chosen`, `files`, `warnings`, `info` | the picked candidate, its top-level files, its warnings (worth a look, maybe a redraw) and its info lines (nothing to do) |
| `pick` | `by` (`vision` / `only` / `human`), `best`, and for the vision pick its `labels`, `sheet` and `verdict` |
- | `candidates[]` | per candidate: `status`, `reason`, `effort` of the answer kept, `generations` (call ids), `redraws` (after which call, why, at which effort), `repairs` (rows asked, answered, still broken), `G1` (issues and what was recovered), `gates` (G2–G6 and G8 with their measures), `warnings`, `info`, `files` |
+ | `candidates[]` | per candidate: `status`, `reason`, `effort` of the answer kept, `generations` (call ids), `redraws` (after which call, why, at which effort), `repairs` (rows asked, answered, still broken), `G1` (issues and what was recovered), `gates` (G2–G6 and G8 with their measures), `warnings`, `info`, `files`, and for a set drawn over several calls `parts` (each call's frames and the effort it was drawn at; `effort` is then the lowest) |
-| `calls[]` | per call: `id` (`c1-gen1`, `c1-gen1-fix1`, `c1-part2-gen1` for a set drawn over several calls, `pick`), `purpose`, `mode` (`realtime` / `batch`), `model`, `effort`, `max_tokens`, `request_id`, `message_id`, `batch_id`, `stop_reason`, `stop_details`, `usage` (as the API reported it), `thinking_tokens`, `cost_usd`, `seconds`, and for a failed call `error` and `billed` |
+| `auth_source` | what the run's calls ran on: `claude-login` (the subscription) or `ANTHROPIC_API_KEY` |
- | `calls[]` | per call: `id` (`c1-gen1`, `c1-gen1-fix1`, `pick`), `purpose`, `mode` (`subscription` / `realtime` / `batch`), `auth_source`, `model`, `effort`, `max_tokens`, `request_id`, `message_id`, `batch_id`, `stop_reason`, `stop_details`, `usage` (as the API reported it), `thinking_tokens`, `cost_usd`, `seconds`, and for a failed call `error` and `billed` |
++| `calls[]` | per call: `id` (`c1-gen1`, `c1-gen1-fix1`, `c1-part2-gen1` for a set drawn over several calls, `pick`), `purpose`, `mode` (`subscription` / `realtime` / `batch`), `auth_source`, `model`, `effort`, `max_tokens`, `request_id`, `message_id`, `batch_id`, `stop_reason`, `stop_details`, `usage` (as the API reported it), `thinking_tokens`, `cost_usd`, `seconds`, and for a failed call `error` and `billed` |
| `batches[]` | per batch: `id`, `custom_ids`, `submitted_at`, `collected`, `ended_at`, `waited_seconds` |
| `usage`, `cost_usd`, `seconds` | totals over the calls, and the run's wall time |
@@@ -298,45 -397,10 +405,46 @@@ sprite-gen pixel-draw --grid runs/slime
Reads a character grid (the frames and size are what it holds), runs G1 (no repair: an issue is
reported with its frame and row) and G2–G6 and G8 — the safe area of the grid's own size — and writes
the same files and a report with no calls.
- Pass the `--kind`, `--palette` and `--walk-cycle` the grid was drawn under; the run's
- `request.json` has them.
+ Pass the `--kind`, `--palette`, `--walk-cycle` and `--motion` the grid was drawn under; the run's
+ `request.json` has them. `--duration-ms` times `anim.gif` anew; `--style` belongs to a drawing and is
+ refused here.
+## Which credential a call runs on
+
+`claude_login.resolve_credential` answers it once per run, in the order `codex` and `grok` keep:
+
+1. **The subscription login.** `claude auth status --json` is asked in the environment the call
+ would run in. Signed in with `claude.ai` (`/login`) or `oauth_token` (`claude setup-token`) is a
+ subscription: every call — the drawings, the row repairs, the pick — runs through the unmodified
+ `claude` binary in print mode (`claude -p`) from an empty directory, with no tool, no session
+ written, and no CLAUDE.md, hook, skill, plugin or MCP server loaded (`--safe-mode`). Model, effort,
+ system prompt, output cap (`CLAUDE_CODE_MAX_OUTPUT_TOKENS`), the pick's schema and its sheet go as
+ the binary's flags and one stream-json message; the answer comes back as the API's would.
+2. **`ANTHROPIC_API_KEY`**, only when no subscription login is here (no `claude` installed, nobody
+ signed in, or Claude Code signed in with a key, a key helper or a cloud account). Billed per call,
+ said on stderr before the first request leaves.
+3. Neither is a refusal naming both, before the run folder is made.
+
+The child never sees `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` — in print mode the binary uses a
+key whenever one is present — nor the calling Claude Code session's own variables. A login that is
+here but refuses a call, has expired or has reached its usage limit fails that call as it came; the
+run never switches to the key on its own. `--batch` is the API's Message Batches, so it names the key
+and the login is not asked. One call through the binary may take up to
+`SPRITE_GEN_CLAUDE_CALL_TIMEOUT_SECONDS` (1800) before it is stopped and reported; on the key, one
+socket read of the stream may wait `SPRITE_GEN_CLAUDE_READ_TIMEOUT_SECONDS` (300) — the API sends
+`ping`s while the model thinks, so a stream silent that long is stalled.
+
+The binary answers an answer cut at the output cap by asking for a continuation a few times and then
+failing with "exceeded the N output token maximum"; that is read as the API's `stop_reason:
+max_tokens`, so the one redraw one effort lower happens on either route.
+
+The subscription route is for the person running sprite-gen on their own machine, signed in to their
+own plan. Anthropic permits an end user signing in to the unmodified Claude Code binary with their
+own subscription, and does not permit routing other people's requests through one
+([legal and compliance](https://code.claude.com/docs/en/legal-and-compliance.md)): a service that
+draws for other people runs on `ANTHROPIC_API_KEY` — no login exists in its container, so that is
+the route it gets.
+
## Model, effort and price
| | Value | Source |
diff --cc sprite_gen/gen/pixel_draw.py
index cc145ad,98ab702..fa45236
--- a/sprite_gen/gen/pixel_draw.py
+++ b/sprite_gen/gen/pixel_draw.py
@@@ -1059,20 -1247,15 +1274,21 @@@ def _run(args: argparse.Namespace, *, s
_fresh_dir(out_dir)
atomic_write_text(out_dir / "request.json", json.dumps(request.to_dict(), ensure_ascii=False, indent=1) + "\n")
note = _note_printer()
- announce_api_billing("claude", api.AUTH_ENV,
- f" (model={api.MODEL}, effort={request.effort}, candidates={request.candidates}, "
- f"{'Message Batches at half price' if request.batch else 'realtime'}).")
+
+ def announce() -> None:
+ if credential.source == claude_login.AUTH_SOURCE_API_KEY:
+ announce_api_billing("claude", api.AUTH_ENV,
+ f" (model={api.MODEL}, effort={request.effort}, candidates={request.candidates}, "
+ f"{'Message Batches at half price' if request.batch else 'realtime'})"
+ + ("." if request.batch else f" — {claude_login.LOGIN_HINT}."))
+
started = time.monotonic()
- calls = Calls(out_dir, token, sleep=sleep, note=note)
+ calls = Calls(out_dir, credential, sleep=sleep, note=note, announce=announce)
run = Run(request, out_dir, calls, batch_wait=batch_wait, note=note)
+ _say_parts(request, note)
report: dict[str, Any] = {"kind": REPORT_KIND, "status": None, "out_dir": str(out_dir), "source": "model",
- "model": api.MODEL, "request": request.to_dict(), "chosen": None, "files": {},
+ "model": api.MODEL, "auth_source": credential.source, "request": request.to_dict(),
+ "chosen": None, "files": {},
"pick": None, "candidates": [], "warnings": [], "info": []}
try:
candidates = run.candidates()