feat(openai): add GPT Image 2 (image-generation modality) (#71)
Introduces image-generation models as a first-class [[models]] entry via
a new `modality` field on the model schema ("text" default, "image",
"audio"). When modality != "text", context_window / max_output_tokens
are optional since no conventional context gate exists — OpenAI's
gpt-image-2 docs omit them.
Adds `image_input_cost_per_m` / `image_output_cost_per_m` alongside
existing text token cost fields to cover the 4-price structure OpenAI
uses for image generation (text $5/$10, image $8/$30 per 1M tokens).
Validator updated to:
- accept any modality in {text, image, audio}
- require context_window/max_output_tokens only for modality=text
- range-check the two new cost fields
gpt-image-2 entry added to providers/openai.toml with pricing sourced
from https://developers.openai.com/api/docs/pricing. Snapshot
gpt-image-2-2026-04-21 listed as alias.
This commit is contained in:
3 files changed
+67
-9
No files matched your search
+19
-1
@@ -1,5 +1,5 @@
|
||||
# OpenAI — https://openai.com
|
||||
# Models: 17 (including 2 Codex variants)
|
||||
# Models: 18 (including 2 Codex variants + 1 image-generation model)
|
||||
|
||||
[provider]
|
||||
id = "openai"
|
||||
@@ -237,3 +237,21 @@ supports_vision = true
|
||||
supports_streaming = true
|
||||
supports_thinking = true
|
||||
aliases = ["codex-o4"]
|
||||
|
||||
# Image generation — priced per token (text + image), no conventional context
|
||||
# window. Snapshot gpt-image-2-2026-04-21 released 2026-04-21.
|
||||
# Source: https://developers.openai.com/api/docs/models/gpt-image-2
|
||||
# Pricing: https://developers.openai.com/api/docs/pricing
|
||||
[[models]]
|
||||
id = "gpt-image-2"
|
||||
display_name = "GPT Image 2"
|
||||
tier = "frontier"
|
||||
modality = "image"
|
||||
input_cost_per_m = 5.00
|
||||
output_cost_per_m = 10.00
|
||||
image_input_cost_per_m = 8.00
|
||||
image_output_cost_per_m = 30.00
|
||||
supports_tools = false
|
||||
supports_vision = true
|
||||
supports_streaming = false
|
||||
aliases = ["gpt-image-2-2026-04-21"]
|
||||
Reference in new issue
Block a user