Decode logoDecode

Generate images

Image generation uses the OpenAI Images API and returns the result synchronously; one image usually takes 30–60 seconds. Code that already uses an OpenAI SDK only needs base_url set to https://decode8.com/v1, a Decode key and one of the model names below.

Create an image key

In API Keys, create a key and pick the GPT 图片 group. Image models are only in that group: a key in a video group fails with no available channel. One account can hold video keys and image keys side by side, sharing one balance.

Generate

POST /v1/images/generations

curl https://decode8.com/v1/images/generations \
  -H "Authorization: Bearer $DECODE_IMAGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5-flare",
    "prompt": "a corgi wearing an astronaut helmet, studio lighting",
    "n": 1,
    "size": "1024x1024",
    "response_format": "b64_json"
  }'
from openai import OpenAI
import base64

client = OpenAI(base_url="https://decode8.com/v1", api_key="sk-...")
result = client.images.generate(
    model="gpt-image-2.5-flare",
    prompt="a corgi wearing an astronaut helmet, studio lighting",
    size="1024x1024",
    response_format="b64_json",
)
with open("corgi.png", "wb") as f:
    f.write(base64.b64decode(result.data[0].b64_json))
Field Notes
model Model name, required; see Models
prompt Image description, required
n Number of images, default 1
size Image size, for example 1024x1024
response_format Use b64_json; see below

With "response_format": "b64_json", every image in the data array carries b64_json (base64 PNG) plus a temporary download url. Without it, the response may carry only the url. The url is temporary: download and save the image right away.

{
  "created": 1794564556,
  "data": [
    {
      "b64_json": "iVBORw0KGgo...",
      "url": "https://...",
      "width": "1024",
      "height": "1024"
    }
  ],
  "output_format": "png"
}

Image billing

Each generated image costs ¥0.25 (about $0.04) whatever the model, size or quality; n: 2 bills two images, settled on the images actually returned. Failed requests are not charged. Every charge is listed in the usage log.

Contact us: pricing, volume and support

Need volume pricing, a dedicated discount group, higher concurrency or integration help? Reach out and mention "API partnership" with your expected volume.