메인 콘텐츠로 건너뛰기
POST
/
v1
/
images
/
edits
Edit images
curl --request POST \
  --url https://api.cometapi.com/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'prompt=Add a small red ribbon to the paper boat.' \
  --form image='@example-file' \
  --form mask='@example-file'
{
  "created": 1776836647,
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 981,
    "prompt_tokens_details": {
      "cached_tokens_details": {}
    },
    "completion_tokens_details": {},
    "input_tokens": 785,
    "output_tokens": 196,
    "input_tokens_details": {
      "image_tokens": 768,
      "text_tokens": 17,
      "cached_tokens_details": {}
    },
    "claude_cache_creation_5_m_tokens": 0,
    "claude_cache_creation_1_h_tokens": 0
  },
  "data": [
    {
      "b64_json": "<base64-image-data>"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

CometAPI에서 OpenAI 호환 multipart 업로드로 기존 이미지를 편집할 때 이 경로를 사용하세요.

이 경로를 사용하는 경우

  • 이미 소스 이미지가 있고 프롬프트 기반 편집을 원할 때
  • 특정 부분만 변경하기 위해 마스크가 필요할 수 있을 때
  • 일반 JSON 요청 대신 multipart 파일 업로드를 처리할 수 있을 때

안전한 첫 요청

  • PNG 또는 JPG 파일 1개로 시작하세요
  • 기본 편집 흐름이 동작할 때까지 마스크는 건너뛰세요
  • 이 경로에서 GPT 이미지 편집 요청에는 model: "gpt-image-2"를 사용하세요
  • 눈에 보이는 변경 1가지만 요청하는 짧은 지시문 1개를 사용하세요
  • 편집된 결과는 data[0].b64_json에서 읽으세요
  • JPEG payload가 필요하면 output_format: "jpeg"를 설정하세요
  • 일반 이미지 생성보다 지연 시간이 더 길 수 있습니다

모델 동작 방식

  • 이 경로의 GPT 이미지 편집 모델은 인라인 base64 이미지 데이터를 반환합니다
  • output_formatb64_json 내부의 인코딩된 이미지 형식을 제어합니다
  • response_format은 모델이 URL 출력을 지원할 때만 중요합니다
  • qwen-image-edit는 동일한 CometAPI 경로 뒤에서 provider별 편집 동작을 따릅니다

인증

Authorization
string
header
필수

Bearer token authentication. Use your CometAPI key.

본문

multipart/form-data
image
file
필수

Source image file. Start with one PNG or JPG input for the simplest flow.

prompt
string
필수

Edit instruction describing the change you want.

예시:

"Add a small red ribbon to the paper boat."

model
string
기본값:gpt-image-2

The image editing model to use. Choose a supported model from the Models page.

mask
file

Optional PNG mask. Transparent areas indicate regions that should be edited.

n
string
기본값:1

Number of edited images to return.

quality
enum<string>

Quality setting for models that support it.

사용 가능한 옵션:
high,
medium,
low
response_format
enum<string>

Requested response container when supported by the selected model. GPT image edit models return data[].b64_json; use output_format to choose the encoded image type.

사용 가능한 옵션:
url,
b64_json
output_format
string

Encoded image type for GPT image edit results returned in data[].b64_json. For example, use jpeg for a JPEG payload.

예시:

"jpeg"

size
string

Requested output size when supported by the selected model.

응답

200 - application/json

Edited image result.

created
integer
필수
usage
object
필수
data
object[]
필수