Skip to content

GPT-Image-2 Image Guide

GPT-Image-2 is the image generation model exposed through model-go's OpenAI-compatible /v1/images/generations endpoint.

Playground

The easiest way to try image generation is directly from the model-go web app:

  1. Open the model-go Playground and click the Playground menu item.
  2. Select gpt-image-2 in the model dropdown.
  3. Enter a prompt such as "a cute cat sitting on the moon" and send it.

The generated image appears in the chat area and can be saved from there.


Command-line test

The quickest verification is a single curl request plus Python base64 decoding:

bash
TOKEN="your model-go token"
curl -sS https://model-go.com/v1/images/generations \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "a cute cat sitting on the moon, digital illustration style",
    "size": "1024x1024",
    "n": 1
  }' \
  | python3 -c "import sys,json,base64; open('output.png','wb').write(base64.b64decode(json.load(sys.stdin)['data'][0]['b64_json']))" \
  && echo "Saved output.png"

This creates output.png in the current directory.

TIP

gpt-image-2 returns base64 in the b64_json field, so the client needs to decode and save the image locally.


API usage

Model info

  • Model name: gpt-image-2
  • Endpoint: POST https://model-go.com/v1/images/generations
  • Response format: b64_json
  • Recommended timeout: 300 seconds or longer

Key parameters

ParameterValuesNotes
model"gpt-image-2"Required
promptStringRequired, supports Chinese and English
size"1024x1024" / "auto" and similarUse values supported by the platform
quality"low" / "medium" / "high" / "auto"Optional
n1-10Number of images to generate
background"transparent" / "opaque" / "auto"Optional
output_format"png" / "jpeg" / "webp"Optional

Python example

python
import base64
from openai import OpenAI

client = OpenAI(
    api_key="your model-go token",
    base_url="https://model-go.com/v1",
)

resp = client.images.generate(
    model="gpt-image-2",
    prompt="a cute cat sitting on the moon, digital illustration style",
    size="1024x1024",
    quality="high",
    n=1,
)

with open("output.png", "wb") as f:
    f.write(base64.b64decode(resp.data[0].b64_json))

print("Saved output.png")

Different clients vary in how they support image generation.

Open WebUI

Configure the image generation engine in the admin panel:

text
ENABLE_IMAGE_GENERATION = true
IMAGE_GENERATION_ENGINE = openai
IMAGES_OPENAI_API_BASE_URL = https://model-go.com/v1
IMAGES_OPENAI_API_KEY = your model-go token
IMAGE_GENERATION_MODEL = gpt-image-2
IMAGE_SIZE = 1024x1024

Cherry Studio

Configuration notes:

  • Use https://model-go.com/v1/images/generations# as the API address
  • Enter gpt-image-2 manually as the model name

Chatbox

Chatbox normally uses /chat/completions, so for image generation you must create a custom provider and override the path:

  1. Choose the custom provider type
  2. Change the API path to /v1/images/generations
  3. Set the timeout to 360 seconds or more
  4. Use gpt-image-2 as the model name

Which image model should you use?

model-go currently offers only GPT-Image-2 for image generation. Use gpt-image-2 for all image-generation requests.