跳转到主要内容
POST
/
v1
/
images
/
edits
curl --request POST \
  --url https://api.powertokens.ai/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "qwen-image-2.0-pro",
  "response_format": "url",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "image": "https://example.com/source.webp"
          },
          {
            "text": "Replace the background with a seaside sunset"
          }
        ]
      }
    ]
  },
  "n": 2,
  "size": "1536*1024",
  "watermark": false,
  "prompt_extend": true,
  "negative_prompt": "low quality",
  "seed": 0
}
'
{
  "created": 123,
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>",
      "revised_prompt": "<string>"
    }
  ],
  "metadata": {}
}

授权

Authorization
string
header
必填

Pass Authorization: Bearer <token> in the request header.

请求体

application/json
model
enum<string>
必填

Image editing model name.

可用选项:
qwen-image-2.0-pro
input
object
必填
response_format
enum<string>
默认值:url

Unified response format.

可用选项:
url,
b64_json
n
integer

Number of images to generate. The gateway maps this to upstream parameters.n.

必填范围: 1 <= x <= 6
size
string
默认值:512*512

Output image resolution in widthxheight or width*height format. The gateway converts and maps this to upstream parameters.size.

watermark
boolean
默认值:false

Whether to add a watermark. The gateway maps this to upstream parameters.watermark.

prompt_extend
boolean

Whether to enable smart prompt rewriting. The gateway maps this to upstream parameters.prompt_extend.

negative_prompt
string

Negative prompt. The gateway maps this to upstream parameters.negative_prompt.

seed
integer<int64>

Random seed. Explicitly passing 0 is preserved and mapped to upstream parameters.seed.

响应

Success. Returns the image editing result.

created
integer<int64>

Creation time as a Unix timestamp (seconds).

data
object[]

List of generated images.

metadata
object

Additional result information. Field contents vary by capability.