Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ Model name prefixes determine routing:
- **OpenAI**: gpt-6-astra, gpt-4.1, gpt-5, gpt-5-mini, gpt-5.2, gpt-5.6-sol/terra/luna, o4-mini; image generation: gpt-image-2
- **Anthropic**: claude-sonnet-4-0/4-5/4-6, claude-sonnet-5, claude-haiku-4-5, claude-opus-4-5/4-6/4-7/4-8, claude-opus-5, claude-fable-5, claude-fable-5-1, claude-3-7-sonnet, claude-3-5-haiku
- **Google**: gemini-3.8-flash, gemini-3.7-flash, gemini-3.6-flash, gemini-3.5-flash-lite, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-pro, gemini-3-pro-preview, gemini-3-flash-preview, gemini-3.1-pro-preview, gemini-3.5-flash; image generation: gemini-2.5-flash-image, gemini-3.1-flash-image
- **xAI**: grok-2, grok-3, grok-3-mini, grok-4, grok-4.3, grok-4.5, grok-4.6, grok-4-fast, grok-4-1-fast; image generation: grok-2-image
- **xAI**: grok-2, grok-3, grok-3-mini, grok-4, grok-4.3, grok-4.5, grok-4.6, grok-4-fast, grok-4-1-fast; image generation: grok-2-image, grok-imagine-image-2.0
- **ByteDance** (BytePlus ModelArk, OpenAI-compatible, ap-southeast): seed-1.6, seed-1.8, seed-2.0-lite, deepseek-v4-flash, deepseek-v4-pro, glm-5.2 (Z.ai's model served via a ModelArk deployment endpoint); image generation: seedream-4.0, seedream-5.0-lite, seedance-4.5, seedance-5.0
- **OpenRouter** (OpenAI-compatible): hermes-4-405b, hermes-4-70b, hy3
- **Z.ai** (Model API, OpenAI-compatible): image generation: glm-image (glm-5.2 chat is routed through BytePlus ModelArk, see ByteDance above)

Image generation via OpenAI (gpt-image-2), xAI (grok-2-image), ByteDance
Image generation via OpenAI (gpt-image-2), xAI (grok-2-image, grok-imagine-image-2.0), ByteDance
(seedream-4.0, seedream-5.0-lite, seedance-4.5, seedance-5.0), and Z.ai (glm-image) is served
through a provider `/images/generations` endpoint rather than the chat path (see
`image_generation.py`), but is surfaced on `/v1/chat/completions` exactly like
Expand Down
19 changes: 19 additions & 0 deletions tee_gateway/model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,23 @@ class SupportedModel(Enum):
per_image_price_usd=Decimal("0.02"),
image_response_format="url",
)
# Grok Imagine Image 2.0 — xAI's newer, higher-quality image model
# (released ~2026-08-11), offered alongside grok-imagine-image rather than
# replacing it (xAI's own pricing page lists both with no deprecation
# notice on the older one). Same hosted-URL response shape as
# grok-imagine-image. xAI bills two quality tiers, $0.04/image at low/1K
# and $0.08/image at medium/2K (docs.x.ai pricing page); the gateway has
# no per-request quality selector yet, so this is registered at the
# low/1K (default) tier price.
GROK_IMAGINE_IMAGE_2_0 = ModelConfig(
provider="x-ai",
api_name="grok-imagine-image-2.0",
input_price_usd=Decimal("0"),
output_price_usd=Decimal("0"),
image_generation=True,
per_image_price_usd=Decimal("0.04"),
image_response_format="url",
)

# ── ByteDance (BytePlus ModelArk, OpenAI-compatible) ────────────────
SEED_1_6 = ModelConfig(
Expand Down Expand Up @@ -745,6 +762,8 @@ class SupportedModel(Enum):
"grok-2-image-latest": SupportedModel.GROK_2_IMAGE,
"grok-imagine-image": SupportedModel.GROK_2_IMAGE,
"grok-imagine-image-2026-03-02": SupportedModel.GROK_2_IMAGE,
"grok-imagine-image-2.0": SupportedModel.GROK_IMAGINE_IMAGE_2_0,
"grok-imagine-image-2-0": SupportedModel.GROK_IMAGINE_IMAGE_2_0,
# ByteDance
"seed-1-6-250615": SupportedModel.SEED_1_6,
"seed-1.6": SupportedModel.SEED_1_6,
Expand Down
13 changes: 13 additions & 0 deletions tests/test_pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,19 @@ def test_grok_code_fast_1_resolves(self):
self.assertEqual(cfg.input_price_usd, Decimal("0.0000002"))
self.assertEqual(cfg.output_price_usd, Decimal("0.0000015"))

def test_grok_imagine_image_2_0_resolves(self):
cfg = get_model_config("grok-imagine-image-2.0")
self.assertEqual(cfg.provider, "x-ai")
self.assertEqual(cfg.api_name, "grok-imagine-image-2.0")
self.assertTrue(cfg.image_generation)
self.assertEqual(cfg.per_image_price_usd, Decimal("0.04"))

def test_grok_imagine_image_2_0_dash_alias_resolves(self):
self.assertEqual(
get_model_config("grok-imagine-image-2-0"),
get_model_config("grok-imagine-image-2.0"),
)

def test_claude_opus_4_7_resolves(self):
cfg = get_model_config("claude-opus-4-7")
self.assertEqual(cfg.provider, "anthropic")
Expand Down
Loading