Skip to content

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

gen: correct the resolution claim and the doubled denial the live runs exposed

Soohong Kim781d122c36c4
diff --git a/sprite_gen/gen/__init__.py b/sprite_gen/gen/__init__.py
index 0278a52..579e223 100644
--- a/sprite_gen/gen/__init__.py
+++ b/sprite_gen/gen/__init__.py
@@ -464,10 +464,11 @@ def add_arguments(parser: argparse.ArgumentParser) -> None:
choices=RESOLUTIONS,
default=None,
help=(
- "output resolution, as the long edge of the image: grok Imagine's "
- "1k / 1.5k / 2k, priced together with --quality. Omitted = the provider's "
- "own default (grok: 1k). openai sizes from --aspect-ratio and codex from "
- "neither, so both refuse this flag instead of ignoring it"
+ "output size tier, priced together with --quality: grok Imagine's "
+ "1k / 1.5k / 2k (tier names, not pixel counts — 1.5k renders 1408px at 1:1). "
+ "Omitted = the provider's own default (grok: 1k). openai sizes from "
+ "--aspect-ratio and codex from neither, so both refuse this flag "
+ "instead of ignoring it"
),
)
parser.add_argument(
diff --git a/sprite_gen/gen/base.py b/sprite_gen/gen/base.py
index 6f41043..be8b083 100644
--- a/sprite_gen/gen/base.py
+++ b/sprite_gen/gen/base.py
@@ -40,13 +40,15 @@ TRANSPARENCY_STRATEGIES = (TRANSPARENCY_NATIVE, TRANSPARENCY_CHROMA)
# quietly downgraded to whatever the backend felt like (No Silent Fallback).
QUALITIES = ("auto", "low", "medium", "high", "xhigh", "max")
-# Output resolution — the second billed knob, over one shared vocabulary naming
-# the long edge of the published image (`1k` = 1024px). grok Imagine sizes its
-# output this way and prices it together with `quality`; a provider that sizes
-# differently (openai derives a gpt-image `size` from `--aspect-ratio`) refuses
-# the flag rather than accepting money for a resolution it will not deliver.
-# Distinct from the video RESOLUTIONS (`480p`/`720p`/`1080p`), which names a
-# frame height.
+# Output resolution — the second billed knob, over one shared vocabulary of grok
+# Imagine's output-size tiers, which it prices together with `quality`. The names
+# are tiers, not pixel counts: `1.5k` rendered 1408x1408 at 1:1, not 1536
+# (2026-09-20 실측 on the XAI_API_KEY route), so nothing here derives a size from
+# the name — the tier goes to the service verbatim and the service sizes. A
+# provider that sizes differently (openai derives a gpt-image `size` from
+# `--aspect-ratio`) refuses the flag rather than accepting money for a resolution
+# it will not deliver. Distinct from the video RESOLUTIONS
+# (`480p`/`720p`/`1080p`), which names a frame height.
RESOLUTIONS = ("1k", "1.5k", "2k")
# Child provider processes are independent execution contexts. They must not
diff --git a/sprite_gen/gen/grok_provider.py b/sprite_gen/gen/grok_provider.py
index b2292c3..9960a02 100644
--- a/sprite_gen/gen/grok_provider.py
+++ b/sprite_gen/gen/grok_provider.py
@@ -3,8 +3,9 @@
`quality` and `resolution` are the two knobs Imagine prices an image on
(docs.x.ai, 2026-09-20 확인): quality for grok-imagine-image-2.0 only, resolution
-naming the long edge. Both are sent only when the caller asks for one, so a
-request that names neither stays exactly what it was.
+naming an output-size tier (a tier, not a pixel count — `1.5k` rendered 1408x1408
+at 1:1). Both are sent only when the caller asks for one, so a request that names
+neither stays exactly what it was.
"""
from __future__ import annotations
@@ -133,8 +134,8 @@ class GrokProvider:
(("quality", request.quality), ("resolution", request.resolution)) if value)
if credential.source == xai.AUTH_SOURCE_API_KEY:
announce_api_billing(self.name, xai.AUTH_ENV,
- f"{f' ({priced})' if priced else ''}, not your Grok subscription — "
- f"`{xai.GROK_LOGIN_COMMAND}` signs that in.")
+ f"{f' ({priced})' if priced else ''} — "
+ f"`{xai.GROK_LOGIN_COMMAND}` signs your Grok subscription in.")
started = time.monotonic()
status, reply = xai.http_json("POST", xai.API_BASE + endpoint, credential.token,
body, timeout=GEN_TIMEOUT_SECONDS)
diff --git a/tests/gen/test_grok_provider.py b/tests/gen/test_grok_provider.py
index 6e63d78..b78e26b 100644
--- a/tests/gen/test_grok_provider.py
+++ b/tests/gen/test_grok_provider.py
@@ -267,6 +267,11 @@ def test_the_api_key_notice_names_what_the_image_is_priced_on(tmp_path, api, cap
notice = [line for line in capsys.readouterr().err.splitlines() if "per-call API charge" in line]
assert len(notice) == 1
assert "quality=medium" in notice[0] and "resolution=2k" in notice[0]
+ # The shared prefix already denies the subscription once; the grok detail adds
+ # the remedy, not a second denial (2026-09-20 실측 on the live XAI_API_KEY run:
+ # the line read "not a subscription (...), not your Grok subscription — ...").
+ assert notice[0].count("not ") == 1
+ assert "`grok login` signs your Grok subscription in." in notice[0]
def test_the_subscription_route_stays_silent_about_billing(tmp_path, api, monkeypatch, capsys):