메인 콘텐츠로 건너뛰기
POST
/
v1
/
images
/
edits
Edit image
curl --request POST \
  --url https://api.dgrid.ai/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form image='@example-file' \
  --form 'prompt=<string>' \
  --form mask='@example-file' \
  --form 'model=<string>' \
  --form n=123 \
  --form 'size=<string>' \
  --form 'response_format=<string>' \
  --form 'user=<string>'
{
  "created": 123,
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>",
      "revised_prompt": "<string>"
    }
  ],
  "usage": {
    "total_tokens": 123,
    "input_tokens": 123,
    "output_tokens": 123,
    "input_tokens_details": {
      "text_tokens": 123,
      "image_tokens": 123
    }
  }
}
이 페이지는 이미지 편집과 동일한 images/edits 작업을 사용하며, 위의 플레이그라운드에는 일반적인 OpenAI 스타일 편집 스키마(image, mask, prompt 등)가 미리 입력되어 있습니다. 아래 내용은 wanx-v1 스타일 모델을 위한 Qwen 전용 요청 형식을 설명합니다.
Qwen 이미지 편집 모델은 멀티파트 폼 데이터로 image/mask 파일을 업로드하는 대신, 편집 지시 사항과 원본 이미지 참조를 input.messages 안에 포함하는 대체 JSON 요청 형식을 사용합니다. 이 형식을 사용하려면 플레이그라운드의 요청 본문에 modelinput을 함께 제공하세요.

Qwen 전용 요청 필드

필드유형필수설명
modelstringwanx-v1과 같은 모델 식별자입니다.
inputobject멀티파트 image/mask 필드 대신 요청 본문에 전달되는 입력 래퍼 객체입니다.
input.messagesarrayinput 하위에 중첩된 메시지 배열입니다.
input.messages[].rolestring메시지 역할입니다 (예: user).
input.messages[].contentstring편집 지시 사항 및 참조하는 원본 이미지입니다.
원본 이미지는 별도의 멀티파트 파일 업로드 대신, input.messages[].content 내에 (예: URL 또는 임베디드 참조로) 인라인으로 참조할 수 있습니다.

예시: 이미지 편집

{
  "model": "wanx-v1",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": "Remove the background and replace it with a solid white backdrop."
      }
    ]
  }
}

응답 필드

응답은 표준 이미지 편집 형식을 따릅니다.
created
integer
생성 타임스탬프입니다.
data
array
생성된 이미지 항목입니다.

응답 예시

200
{
  "created": 1719859200,
  "data": [
    {
      "url": "https://cdn.dgrid.ai/generated/edited-abc123.png",
      "b64_json": "",
      "revised_prompt": "The subject with background removed and replaced with a solid white backdrop."
    }
  ]
}

인증

Authorization
string
header
필수

Your DGrid API key. All endpoints use Authorization: Bearer <DGRID_API_KEY>.

본문

image
file
필수

Source image in PNG format, under 4 MB.

prompt
string
필수

Editing instruction.

mask
file

Optional mask image.

model
string

Target image model.

n
integer

Number of outputs.

size
string

Output size.

response_format
string

Response format.

user
string

End-user identifier.

응답

Edited images in the image generation response format.

created
integer

Creation timestamp.

data
object[]

Generated image entries.

usage
object