Routescope APIRoutescope API

Edit Image

Status: Published
Status basis: requires an enabled image editing/generation model

Image editing endpoint. The request body uses application/json and reference images are passed 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. Optional parameters include mask, n, size, quality, response_format, background, output_format, output_compression, moderation, watermark, and user.

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": [      {        "image_url": "https://example.com/a.png"      },      {        "image_url": "https://example.com/b.png"      }    ],    "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.

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

Last updated on