GGateYourWay API
Status RU Create key
Image API

Image generation

The OpenAI-compatible endpoint returns one completed generation as base64.

01

Models

gpt-image-1.5, grok-image, gpt-image-2, gpt-image-2-1k, gpt-image-2-2k, gpt-image-2-4k, gpt-image-2-4k-超分

02

POST /v1/images/generations

bash
curl https://api.gateyourway.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer gyw-sk-YOUR_KEY" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "A clean editorial product photo of a silver watch",
    "n": 1,
    "size": "1024x1024",
    "quality": "low",
    "response_format": "b64_json"
  }'
json
{
  "created": 1785600000,
  "data": [{"b64_json": "iVBORw0KGgoAAA..."}]
}
03

Parameters

FieldRequirement
modelA public image model from the catalog.
promptA non-empty string.
nOnly 1.
response_formatThe gateway normalizes the response to b64_json.
size / qualitySupport depends on the selected model.
04

Decode the image

python
import base64

image_bytes = base64.b64decode(result.data[0].b64_json)
with open("image.png", "wb") as image_file:
    image_file.write(image_bytes)