球球TokenQiuqiu Token Docs中文

GPT Image 2

When calling gpt-image-2 through Qiuqiu Token, use this page to prepare image generation and image editing requests. The model name inside Qiuqiu Token remains gpt-image-2. Complete field definitions, model limits, and the latest enum values are subject to the official OpenAI API documentation.

Before starting, prepare balance in Quick Start, then create a grouped token in Create an API Token. Choose a group whose name includes "CodeX dedicated".

Recommended async image generation URL: https://img.qiuqiutoken.com/.

You can also use the online GPT Image 2 generation website directly: https://image.qiuqiutoken.com/.

Generate Images: POST /v1/images/generations

Official references

This section only lists fields commonly used with Qiuqiu Token. For full fields, enum values, and response structure, use the OpenAI docs:

Minimal request:

curl
curl https://api.qiuqiutoken.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_IMAGE_TOKEN_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"gpt-image-2\",
    \"prompt\": \"An orange cat wearing a transparent raincoat on a neon rainy street, cinematic composition\",
    \"size\": \"1024x1024\",
    \"quality\": \"high\",
    \"output_format\": \"png\"
  }"

Common Fields

FieldRequiredNotes
promptRequiredImage prompt. Include subject, scene, lighting, composition, and style.
modelRecommendedUse gpt-image-2 through the Qiuqiu Token gateway.
sizeOptionalCommon values include 1024x1024, 1536x1024, 1024x1536, and auto.
qualityOptionalCommon values are low, medium, high, and auto. Higher quality is usually slower and more expensive.
backgroundOptionalCommon values are transparent, opaque, and auto. Transparent output requires png or webp.
output_formatOptionalCommon values are png, jpeg, and webp.
output_compressionOptionalOfficial range is 0 to 100; meaningful only for jpeg or webp.
nOptionalNumber of images. Official range is 1 to 10.
moderationOptionalCommon values are low and auto.
userOptionalEnd-user identifier for audit, risk control, or logs.

Response

For GPT Image models, usually read data[*].b64_json. The most common return value is Base64 image content, not a URL.

{
  "created": 1711111111,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
    }
  ]
}

Edit Images: POST /v1/images/edits

Upload the source image, optional mask, and prompt with multipart/form-data. The OpenAI reference describes input images as an images array; with multipart upload, image[]=@... is a common form.

curl
curl https://api.qiuqiutoken.com/v1/images/edits \
  -H "Authorization: Bearer YOUR_IMAGE_TOKEN_KEY" \
  -F "model=gpt-image-2" \
  -F "image[]=@./input.png" \
  -F "mask=@./mask.png" \
  -F "prompt=Keep the subject pose, change the background to a neon rainy street, and enhance cinematic reflections" \
  -F "size=1024x1024" \
  -F "quality=high" \
  -F "background=transparent" \
  -F "input_fidelity=high" \
  -F "output_format=png" \
  -F "n=1"

Common Fields

FieldRequiredNotes
images / image[]RequiredInput images. GPT Image officially supports up to 16 input images.
promptRequiredState what to keep, replace, or add.
modelRecommendedUse gpt-image-2 through the Qiuqiu Token gateway.
maskOptionalTransparent areas indicate editable regions.
sizeOptionalCommon values include 1024x1024, 1536x1024, 1024x1536, and auto.
qualityOptionalCommon values are low, medium, high, and auto.
backgroundOptionalUse png or webp for transparent background.
input_fidelityOptionalCommon values are low and high.
output_formatOptionalCommon values are png, jpeg, and webp.
nOptionalNumber of returned images.

Save the Image

When the response contains b64_json, decode it before saving the image file.

python - <<'PY'
import base64

b64 = "PASTE_B64_JSON_HERE"
with open("gpt-image-output.png", "wb") as f:
    f.write(base64.b64decode(b64))
PY

If you use background=transparent, prefer png or webp when saving.

Troubleshooting

  • 401 or authentication failure: use Authorization: Bearer and a valid image group token, not default.
  • 404: confirm the endpoint is /v1/images/generations or /v1/images/edits, and the model is gpt-image-2.
  • Generation parameter error: return to the minimal JSON example, then add fields back one by one.
  • Edit file field error: make sure image[] and mask are file uploads or officially supported image references, not plain JSON strings.
  • Result cannot be opened: save decoded binary image data, not the raw Base64 string.
  • Transparent background is missing: use background=transparent and output_format=png or webp.