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.
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
Model relay endpoint authentication. Header: Authorization: Bearer .
In: header
Request Body
application/json
Model name. The Tencent TokenHub channel maps it inside the gateway to the upstream model name.
"gpt-image-2"Image editing prompt.
Recommended JSON URL image input. Each item is a single image URL object.
[]Compatibility field: accepts a single URL string, a URL array, or an object. Prefer images[].image_url.
Compatibility field: a URL string array. Prefer images[].image_url.
Optional. Mask image URL; transparent areas mark the regions to edit.
uriNumber of images to generate.
int321 <= valueOutput image size.
"1024x1024"Image quality. Allowed values depend on the upstream model.
Response format. Supports url or b64_json; can be omitted by default and support varies across upstream channels.
"url" | "b64_json"Background fill mode. Support depends on the model.
"auto""transparent" | "opaque" | "auto"Output format. Allowed values depend on the upstream model.
Output compression level. Applies to jpeg and webp only.
90int320 <= value <= 100Moderation strength. Support depends on the model.
"auto""auto" | "low"Whether to add a watermark. Support depends on the upstream channel.
falseEnd-user identifier; useful for abuse monitoring.
Response Body
application/json
Model Selection
| Model ID | Capability | Description |
|---|---|---|
gpt-image-2 | Image editing | Example model for the OpenAI-style image editing endpoint. The Tencent TokenHub channel maps it inside the gateway to the upstream model name. |
Common Parameters
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name. The example uses gpt-image-2. |
prompt | string | Yes | Editing prompt. |
images | array<object> | No | Recommended JSON URL image input. Each item is a single image URL object (image_url). |
image | string / string[] / object | No | Compatibility field: accepts a single URL string, a URL array, or an object. Prefer images[].image_url. |
image_urls | string[] | No | Compatibility field: a URL string array. Prefer images[].image_url. |
mask | string | No | Mask image URL marking the area to edit. |
size | string | No | Image size. Defaults to 1024x1024. |
n | integer | No | Number of images to generate. |
At least one of images / image / image_urls must be provided; images[].image_url is preferred.
Optional Parameters
| Field | Type | Description |
|---|---|---|
quality | string | Image quality. |
background | string | Background setting. |
output_format | string | Output format. |
output_compression | integer | Output compression level. |
moderation | string | Content moderation level. |
watermark | boolean | Whether to add a watermark. |
response_format | string | Response format. Supports url or b64_json. |
user | string | End-user identifier. |
How is this guide?
Last updated on