Routescope APIRoutescope API
Image ModelsOpenAI-Style Images

Image Editing

OpenAI-style image editing API

The OpenAI-style image editing endpoint uses application/json and passes reference images by URL. Prefer images[].image_url; image (a single URL string, URL array, or object) and image_urls (URL string array) are also accepted as compatibility fields.

POST
/v1/images/edits
curl -X POST "https://api.routescope.ai/v1/images/edits" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-image-2",    "prompt": "Generate a new image based on these two reference images.",    "images": [],    "size": "1024x1024"  }'
{
  "created": 1,
  "data": {}
}

Authorization

BearerAuth

AuthorizationBearer <token>

Model relay endpoint authentication. Header: Authorization: Bearer .

In: header

Request Body

application/json

model*string

Model name. The Tencent TokenHub channel maps it inside the gateway to the upstream model name.

Default"gpt-image-2"
prompt*string

Image editing prompt.

images?

Recommended JSON URL image input. Each item is a single image URL object.

Default[]
image?string||

Compatibility field: accepts a single URL string, a URL array, or an object. Prefer images[].image_url.

image_urls?array<string>

Compatibility field: a URL string array. Prefer images[].image_url.

mask?string

Optional. Mask image URL; transparent areas mark the regions to edit.

Formaturi
n?integer

Number of images to generate.

Formatint32
Range1 <= value
size?string

Output image size.

Default"1024x1024"
quality?string

Image quality. Allowed values depend on the upstream model.

response_format?string

Response format. Supports url or b64_json; can be omitted by default and support varies across upstream channels.

Value in"url" | "b64_json"
background?string

Background fill mode. Support depends on the model.

Default"auto"
Value in"transparent" | "opaque" | "auto"
output_format?string

Output format. Allowed values depend on the upstream model.

output_compression?integer

Output compression level. Applies to jpeg and webp only.

Default90
Formatint32
Range0 <= value <= 100
moderation?string

Moderation strength. Support depends on the model.

Default"auto"
Value in"auto" | "low"
watermark?boolean

Whether to add a watermark. Support depends on the upstream channel.

Defaultfalse
user?string

End-user identifier; useful for abuse monitoring.

Response Body

application/json

Model Selection

Model IDCapabilityDescription
gpt-image-2Image editingExample model for the OpenAI-style image editing endpoint. The Tencent TokenHub channel maps it inside the gateway to the upstream model name.

Common Parameters

FieldTypeRequiredDescription
modelstringYesModel name. The example uses gpt-image-2.
promptstringYesEditing prompt.
imagesarray<object>NoRecommended JSON URL image input. Each item is a single image URL object (image_url).
imagestring / string[] / objectNoCompatibility field: accepts a single URL string, a URL array, or an object. Prefer images[].image_url.
image_urlsstring[]NoCompatibility field: a URL string array. Prefer images[].image_url.
maskstringNoMask image URL marking the area to edit.
sizestringNoImage size. Defaults to 1024x1024.
nintegerNoNumber of images to generate.

At least one of images / image / image_urls must be provided; images[].image_url is preferred.

Optional Parameters

FieldTypeDescription
qualitystringImage quality.
backgroundstringBackground setting.
output_formatstringOutput format.
output_compressionintegerOutput compression level.
moderationstringContent moderation level.
watermarkbooleanWhether to add a watermark.
response_formatstringResponse format. Supports url or b64_json.
userstringEnd-user identifier.

How is this guide?

Last updated on