The short version
An agent does not generate images itself; it has to call an image model. Behind a sentence like “blend these two images together” there are usually three stages: planning, tool calls, and an image API call. Most of the money is spent on the text side, not on the image itself. First, the cost scale of three approaches:How one sentence unfolds
1
Receive the request
You describe the goal in natural language, for example “put the person from a.png into the scene in b.png”.
2
Plan
The agent decides whether this is text-to-image, an edit, or multi-image fusion, and which inputs it needs.
3
Call tools
Find files, read images, and list directories or search code when necessary. This is the step most likely to run away: when the agent is unsure where a file is, it scans the project first.
4
Choose how to call
With a Skill installed it executes directly; without one it reads docs, writes a script, and tries parameters. Both reading and writing bill as text tokens.
5
Call the Images API
Text-to-image goes to
/v1/images/generations; edits and multi-image fusion go to /v1/images/edits.6
Return the result
Save the image and return the path or preview to the conversation; if more adjustment is needed, the next turn begins.
A real case: where the money went for one “blend” task
On 2026-11-27 (UTC+8), a user doing image compositing in Codex produced two very different groups of requests in the logs:
Two facts stand out:
- No image request at all during that hour. All 47 were text requests. The agent was planning, reading files, and making small decisions; the task never reached the image endpoint.
- The text-side exploration cost several times the image cost. The eight requests that actually produced images cost about $0.54; the text side cost about $3.3 in one hour.
Why the agent “scans the whole project”
- It does not know where the files are: the first reaction is to list directories and search for filenames instead of asking you
- The fixed base is large: the system prompt, tool definitions,
AGENTS.md, and project context are read again every turn - Context grows monotonically: every tool result is appended to the next turn’s input, so later turns cost more
- A new conversation is not free: it clears history, but the fixed base still has to be written to cache again
The cheaper path: turn exploration into a Skill
APIYI’s GPT-Image Skills package the “how to call the API” knowledge into aSKILL.md plus one script, so the agent does not have to read docs and write scaffolding first:
- Default model
gpt-image-2.6-allat a flat $0.025 per image — the cheapest way to iterate - One script covers 11 models plus 1 alias
-ican be repeated for up to 16 input images, so multi-image fusion works out of the box- When you need official quality tiers or a precise
mask, switch with--modeltogpt-image-2.6-flare/gpt-image-2.6-sunburst
.env, and hand the directory to the agent. For the full guide and parameter table, see GPT-Image Series Agent Skill.
A Skill does not make cost zero: the agent’s text turns still bill, and images still bill per image or per image token. What it removes is the “read docs, write scaffolding, retry parameters” stretch.
Prompt templates (copy-paste ready)
Template 1: precise image work, with files and tools constrainedWhen not to use an agent
If image generation is a fixed pipeline, a batch job, or you just want to validate a prompt, leave the agent out:- Prompt validation / model comparison: use AI Image Master (
imagen.apiyi.com). It uses the same APIYI key and the same image endpoints, with only image charges and no text-model charges. - Batch and scheduled jobs: call
/v1/images/*from a script. Costs are predictable, retries are explicit, and the bill is easy to reconcile. - Production pipelines: scripts + queues + monitoring are more controllable than an agent.
AI Image Master is a web test bench, not a cheaper channel. Images still bill at the price of the model you select; see Model Pricing.
Cost comparison
Model prices match the official rates and may change with them; the table above is for reference only. The authoritative source is the Model Pricing tab in the top navigation: Model Pricing. Listed prices match the official rates; after recharge bonuses, the effective price is about 83–91% of the listed price. See Recharge Promotions.
Related docs
GPT-Image Series Agent Skill
A ready-to-use SKILL.md plus script, defaulting to gpt-image-2.6-all
How can I use the API more economically?
A cost checklist covering model tiers, caching, output, and retries
OpenAI Codex setup
base_url, the responses protocol, and cost notes
Image editing and multi-image fusion
/v1/images/edits parameters, sizes, and masks