Yomi APIYomi APIDocs Open console

中文

Yomi API / Documentation / GPT Image 2.5 generation

Media generation

GPT Image 2.5 generation

GPT Image is OpenAI's image generation and editing model family, known for precise text rendering inside images and compatibility with the OpenAI Images API. See the Model Catalog (Models in the console) for available versions and model IDs.

Model positioning

  • Model ID: gpt-image-2.5, gpt-image-2.5-flare, gpt-image-2.5-sunburst.
  • Capabilities: Text-to-image generation and image editing, with precise text rendering for posters, signs, interface assets and other images containing text.
  • Response format: The response may include url or b64_json. Download or decode and save it immediately, according to the actual model response.

Versions and prices

  • gpt-image-2.5: 1K everyday tier, $0.013/image, for everyday visuals, creative sketches and cost-sensitive tasks.
  • gpt-image-2.5-flare: 4K fast tier, $0.02/image, prioritizing generation speed for quick previews and iteration.
  • gpt-image-2.5-sunburst: 4K quality tier, $0.025/image, prioritizing visual quality and detailed editing for final deliverables.

Sunburst is the default for everyday visuals, drafts, high-resolution deliverables and image editing. Choose Flare when speed is explicitly prioritized or a high-resolution request needs lower cost; choose Image 2.5 for the lowest-cost requests without a high-resolution requirement. Explicit model, image count and budget choices take priority. The default model does not imply a default 4K canvas. See the Model Catalog for current prices and availability.

Image generation

POST https://api.yomiapi.com/v1/images/generations

Request parameters

ParameterTypeRequiredDescription
modelstringYesAn available image-generation model ID from the Model Catalog
promptstringYesImage description
nintegerNoNumber of generated images; default 1
sizestringNoRequested dimensions, such as 1024x1024, 1536x1024 or 1024x1536. Both 4K models can request 3840x2160 or 2160x3840. Actual pixels are determined by the downloaded file

Python example

First set the local YOMI_API_KEY environment variable. The script reads it directly without echoing the key.

import base64
import os
from urllib.request import urlopen
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["YOMI_API_KEY"],
    base_url="https://api.yomiapi.com/v1"
)

response = client.images.generate(
    model="gpt-image-2.5-sunburst",
    prompt="A minimalist coffee brand poster with the main heading MORNING BREW, warm colors",
    size="1024x1536"
)

item = response.data[0]
if item.b64_json:
    image_bytes = base64.b64decode(item.b64_json)
elif item.url:
    # Download without sending the Yomi API key or echoing the temporary URL.
    with urlopen(item.url, timeout=120) as image_response:
        image_bytes = image_response.read()
else:
    raise RuntimeError("No image data in the response")

with open("poster.png", "wb") as f:
    f.write(image_bytes)

cURL example

curl https://api.yomiapi.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5-sunburst",
    "prompt": "A minimalist coffee brand poster with the main heading MORNING BREW, warm colors",
    "size": "1024x1536"
  }'

Image editing

The editing endpoint uploads the source image as multipart/form-data and modifies it according to the prompt. Common editing instructions:

  • Add an element: "Add a cup of coffee to the table"
  • Replace an element: "Replace the red car with a blue car"
  • Remove an element: "Remove the people in the background and fill the area with natural scenery"
POST https://api.yomiapi.com/v1/images/edits

Python example

First set the local YOMI_API_KEY environment variable. The script reads it directly without echoing the key.

import base64
import os
from urllib.request import urlopen
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["YOMI_API_KEY"],
    base_url="https://api.yomiapi.com/v1"
)

with open("input.png", "rb") as source_image:
    response = client.images.edit(
        model="gpt-image-2.5-sunburst",
        image=source_image,
        prompt="Change the scene to nighttime, add a neon effect to the shop sign, and preserve the subject and text",
        size="1024x1536",
        n=1
    )

item = response.data[0]
if item.b64_json:
    image_bytes = base64.b64decode(item.b64_json)
elif item.url:
    # Download without sending the Yomi API key or echoing the temporary URL.
    with urlopen(item.url, timeout=120) as image_response:
        image_bytes = image_response.read()
else:
    raise RuntimeError("No image data in the response")

with open("edited.png", "wb") as f:
    f.write(image_bytes)

Billing and recommendations

  • Billing: Image-model billing methods and unit prices depend on the Model Catalog and actual charges under Usage.
  • Text in images: Put the exact text in quotation marks in your prompt, and specify font style and placement.
  • Batch generation: Validate the prompt with one image before generating a batch. Retry 429 rate-limit errors with exponential backoff.