API REFERENCE

GPT Image Generation & Editing API / Skill

Generate and edit images through an OpenAI Images-compatible API, with authentication, parameters, sizes, code examples and troubleshooting.

ImagesOpenAI compatibleAPI

GPT Image Skill: copy this to your AI assistant

Give the complete prompt below to an AI assistant that supports Agent Skills to install the ChongPlus GPT Image Skill for image generation and editing with GPT models.

Install and use this ChongPlus GPT Image Skill:
https://github.com/Rodert/chongplus-image-skill

On first use, ask me for my ChongPlus API key and save it securely in the local configuration for future use. Do not require me to configure environment variables manually.

The Skill's local configuration and the environment-variable examples for manual API calls below are separate ways to use the service.

Overview

Adapted from the ChongPlus Image API documentation. Models, available sizes and pricing may change. Refer to the source documentation and current platform configuration for the latest details.

Official reference: OpenAI image generation guide. For image sizes, resolutions and related parameters, follow the latest official documentation. Check the console for the parameters supported by this platform.

Item Value
Base URL https://api.chongplus.plus
Image generation POST /v1/images/generations
Image editing POST /v1/images/edits
Model IDs gpt-image-2.5-flare, gpt-image-2.5-sunburst, gpt-image-2.6-flare, gpt-image-2.6-sunburst
Authentication Authorization: Bearer YOUR_API_KEY

Create an API key after signing in to the API platform. Check key permissions and available account credit before calling the API.

The following newly supported model IDs can be copied directly into the request's model field:

gpt-image-2.6-flare
gpt-image-2.6-sunburst

These are model IDs provided by the ChongPlus platform. Existing examples below are preserved; replace model to use a newly supported model. Configure sizes and other parameters according to the official documentation and platform support.

Quick start

Replace YOUR_API_KEY with your key and run this command in a terminal:

curl -X POST "https://api.chongplus.plus/v1/images/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5-flare",
    "prompt": "A cute orange cat wearing an astronaut helmet, sticker style, clean background.",
    "size": "2048x2048"
  }'

Describe the subject, style, composition, background and lighting. The source recommends English prompts and explicitly specifying a supported size.

Authentication

Every request requires a Bearer token.

Header Value Notes
Authorization Bearer YOUR_API_KEY Required; use your API key
Content-Type application/json JSON for generation; multipart form data for editing

For image editing, do not set Content-Type manually. Let the HTTP client generate the multipart boundary. All keys in these examples are placeholders; keep real keys out of public source code and web pages.

Generation parameters

Endpoint: https://api.chongplus.plus/v1/images/generations

Field Type Required Description
model string Yes gpt-image-2.5-flare, gpt-image-2.5-sunburst, gpt-image-2.6-flare or gpt-image-2.6-sunburst
prompt string Yes Image description
size string Yes Resolution string; follow the official image generation guide and confirm platform support
n integer No Image count; the source recommends 1 to 4
response_format string No For example b64_json; actual responses may contain Base64 or URLs

Image sizes

First check the size configuration instructions in the official OpenAI image generation guide. Model updates may change available sizes and limits. The table below contains existing integration examples, not a guarantee that every model supports them. Follow the official documentation and confirm that the current platform supports the parameters.

Resolution size Aspect ratio Typical use
1K 1024x1024 1:1 Avatars, stickers, square images
2K 2048x2048 1:1 Product images, detailed square images
2K 1536x1024 3:2 Landscape photography, banners
2K 1024x1536 2:3 Portraits, vertical posters
4K 3840x2160 16:9 Widescreen covers, video thumbnails
4K 2160x3840 9:16 Phone wallpapers, vertical video covers

Do not assume an empty value, auto or any size above works with every model. Configure size according to the official documentation; platform availability, defaults and charges follow the current console documentation.

Generation examples

Python requests

Install the dependency first: pip install requests.

import os
import requests

response = requests.post(
    "https://api.chongplus.plus/v1/images/generations",
    headers={
        "Authorization": f"Bearer {os.environ['CHONGPLUS_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "gpt-image-2.5-flare",
        "prompt": "A cute orange cat wearing an astronaut helmet, sticker style, clean background.",
        "size": "1536x1024",
    },
    timeout=300,
)
response.raise_for_status()
print(response.json())

The Python and JavaScript examples read the key from the local CHONGPLUS_API_KEY environment variable. Set it in your execution environment first.

JavaScript fetch (Node.js)

Run this example on a server or locally in Node.js to avoid exposing a real API key in browser code.

const response = await fetch("https://api.chongplus.plus/v1/images/generations", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CHONGPLUS_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "gpt-image-2.5-flare",
    prompt: "A futuristic city at sunset, cyberpunk style, highly detailed.",
    size: "3840x2160",
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

OpenAI SDK compatibility

Install the dependency: npm install openai. The SDK base URL includes /v1.

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.CHONGPLUS_API_KEY,
  baseURL: "https://api.chongplus.plus/v1",
});

const image = await client.images.generate({
  model: "gpt-image-2.5-flare",
  prompt: "A warm editorial photo of a coffee cup beside a laptop",
  size: "1024x1024",
  n: 1,
});
console.log(image);

Image editing

Upload a reference image and describe your changes to adjust content, replace backgrounds, change styles or continue an existing image.

Endpoint: https://api.chongplus.plus/v1/images/edits

Field Type Required Description
image file Yes Reference image uploaded as a file
model string Yes For example gpt-image-2.5-flare
prompt string Yes Describe what to preserve and what to change
size string No Follow the official image generation guide and confirm platform support
n integer No The source recommends 1 to 4

cURL

Replace product.png with your image path.

curl -X POST "https://api.chongplus.plus/v1/images/edits" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "model=gpt-image-2.5-flare" \
  -F "prompt=Keep the product unchanged, replace the background with a clean white studio backdrop." \
  -F "size=2048x2048" \
  -F "n=1" \
  -F "image=@./product.png"

Python requests

import os
import requests

with open("product.png", "rb") as image_file:
    response = requests.post(
        "https://api.chongplus.plus/v1/images/edits",
        headers={"Authorization": f"Bearer {os.environ['CHONGPLUS_API_KEY']}"},
        data={
            "model": "gpt-image-2.5-flare",
            "prompt": "Keep the product unchanged, replace the background with a clean white studio backdrop.",
            "size": "2048x2048",
            "n": "1",
        },
        files={"image": ("product.png", image_file, "image/png")},
        timeout=300,
    )
response.raise_for_status()
print(response.json())

Response format

Responses generally follow the OpenAI Images format. Upstream providers may return image URLs or Base64 data.

URL response

{
  "created": 1770000000,
  "data": [{ "url": "https://..." }]
}

Base64 response

{
  "created": 1770000000,
  "data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUg..." }]
}

For a PNG returned in b64_json, use a data:image/png;base64,... URL to display or download it. For large images, prefer converting the data to a Blob URL before rendering.

Common errors

Status Possible cause Action
401 Missing, malformed or invalid key Check Authorization: Bearer YOUR_API_KEY
400 Missing parameters or unsupported fields Compare your request with the parameter table
403 Key permissions, group availability or credit issue Check key permissions, credit and account status
429 Rate limit Reduce concurrency and retry with backoff
500 / 502 / 504 Upstream or gateway timeout, temporary unavailability Retry later; retain request time and error details if failures persist

Status meanings can vary by gateway. Always inspect the response body too.

{
  "error": { "message": "Invalid API key or insufficient quota", "type": "invalid_request_error" }
}

Related links