메인 콘텐츠로 건너뛰기
Venice의 이미지 편집은 동기 방식입니다. 원본 이미지를 /image/edit 또는 /image/multi-edit로 보내면 편집된 결과가 같은 응답에 PNG 파일로 돌아옵니다. 누끼 작업에는 /image/background-remove가 투명한 PNG를 반환합니다.
이미지 편집 endpoint는 실험적이며 모델별 동작은 시간이 지남에 따라 변경될 수 있습니다.

Endpoint

EndpointPurposeBest for
POST /image/editprompt로 단일 이미지 편집일반 편집과 prompt 기반 inpainting
POST /image/multi-edit1-3장의 레이어드 이미지로 편집마스크나 오버레이가 있는 더 제어된 편집
POST /image/background-remove이미지에서 배경 제거제품, 인물, 자산을 위한 투명 컷아웃

어떤 endpoint를 언제 사용하나요

  • 원본 이미지가 하나이고 prompt로 일부를 변경, 제거, 재스타일링하고 싶다면 /image/edit를 사용하세요.
  • 마스크, 오버레이, 참조 레이어를 통한 추가 제어가 필요하면 /image/multi-edit를 사용하세요.
  • 깔끔한 전경 피사체와 투명도만 원한다면 /image/background-remove를 사용하세요.
Inpainting에는 /image/edit 또는 /image/multi-edit를 사용하세요. /image/generate의 기존 inpaint 파라미터는 deprecated입니다.

1단계: 단일 이미지 편집

단일 이미지 편집은 가장 단순한 inpainting 흐름입니다. 이미지 한 장과 “remove the sign”, “change the sky to sunrise”, “replace the background with a studio backdrop” 같은 짧은 prompt를 함께 보내세요. 요청:
POST https://api.venice.ai/api/v1/image/edit
Authorization: Bearer $VENICE_API_KEY
Content-Type: application/json

{
  "model": "qwen-edit",
  "prompt": "Replace the cloudy sky with a warm sunrise while preserving the buildings and canal",
  "image": "https://example.com/venice-canal.jpg"
}
응답(200): 응답 본문은 raw image/png 바이너리 데이터입니다. 그대로 파일에 저장하세요.
import base64
import os
import requests

with open("input.jpg", "rb") as f:
    image_base64 = base64.b64encode(f.read()).decode("utf-8")

response = requests.post(
    "https://api.venice.ai/api/v1/image/edit",
    headers={
        "Authorization": f"Bearer {os.environ['VENICE_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "qwen-edit",
        "prompt": "Remove the tourist crowd from the square and keep the architecture intact",
        "image": image_base64,
    },
)

with open("edited.png", "wb") as f:
    f.write(response.content)

2단계: 마스크나 레이어드 inpainting에는 multi-edit 사용

/image/multi-edit는 최대 세 장의 이미지를 받습니다. 첫 번째 이미지가 base 이미지입니다. 나머지 이미지는 편집 레이어나 마스크로 취급되어, prompt만으로 편집하는 것보다 더 많은 제어권을 줍니다. 다음과 같은 경우에 더 나은 선택입니다:
  • 특정 영역을 마스크로 타겟팅하고 싶을 때
  • 기존 구도에 오버레이를 결합하고 싶을 때
  • 단일 이미지 prompt가 할 수 있는 것보다 더 엄격하게 편집을 제약하고 싶을 때
JSON 요청:
{
  "modelId": "qwen-edit",
  "prompt": "Replace the blank billboard area with a glowing Venice film festival poster while preserving lighting and perspective",
  "images": [
    "https://example.com/street-scene.png",
    "https://example.com/billboard-mask.png"
  ]
}
Multipart 요청:
curl https://api.venice.ai/api/v1/image/multi-edit \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -F "modelId=qwen-edit" \
  -F "prompt=Replace the blank billboard area with a glowing Venice film festival poster while preserving lighting and perspective" \
  -F "[email protected]" \
  -F "[email protected]" \
  -o multi-edited.png
/image/edit와 마찬가지로 응답 본문은 raw image/png 데이터입니다.
/image/multi-edit는 현재 요청 스키마에서 model이 아닌 modelId 필드를 사용합니다.

Inpainting 팁

Prompt 기반 inpainting은 지시가 짧고 국소적일 때 가장 잘 동작합니다:
  • remove the tree
  • change the sky to sunset
  • replace the logo with a blank sign
  • restore the torn corner of the photo
더 넓은 장면 변경의 경우, 유지되어야 할 부분을 함께 설명하세요:
Replace the background with a modern photo studio backdrop while preserving the subject pose, facial features, and clothing.
편집이 계속 잘못된 영역에 영향을 준다면 /image/edit에서 /image/multi-edit로 전환해 마스크나 오버레이 레이어를 제공하세요.

3단계: 배경 제거

전경 피사체를 투명 배경에 격리하고 싶다면 /image/background-remove를 사용하세요. 이 endpoint는 알파 투명도가 있는 PNG를 반환합니다. 이미지 URL 사용:
curl https://api.venice.ai/api/v1/image/background-remove \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -o cutout.png \
  -d '{
    "image_url": "https://example.com/product-photo.jpg"
  }'
로컬 파일 업로드 사용:
curl https://api.venice.ai/api/v1/image/background-remove \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -F "[email protected]" \
  -o cutout.png
배경 제거의 활용처:
  • 이커머스 제품 사진
  • 프로필 사진 및 인물 사진
  • 새 배경 위에 배치할 자산

요청 파라미터

/image/edit

ParameterTypeRequiredDefaultDescription
image파일, base64 문자열, 또는 URL-편집할 원본 이미지
promptstring-편집을 위한 텍스트 지시
modelstring아니오qwen-edit편집 모델 ID
aspect_ratiostring아니오모델 기본값지원 모델의 출력 비율
modelIdstringDeprecated-model의 deprecated 별칭

/image/multi-edit

ParameterTypeRequiredDefaultDescription
images1-3개의 파일, base64 문자열, 또는 URL 배열-첫 이미지는 base 이미지, 나머지는 편집 레이어나 마스크
promptstring-레이어를 결합하거나 편집하는 방법에 대한 텍스트 지시
modelIdstring아니오qwen-edit편집 모델 ID

/image/background-remove

ParameterTypeRequiredDescription
image파일 또는 base64 문자열imageimage_url 중 하나잘라낼 원본 이미지
image_urlstringimageimage_url 중 하나잘라낼 공개 이미지 URL

지원 input 포맷

EndpointJSON inputMultipart inputOutput
/image/editBase64 문자열 또는 URL파일 업로드image/png
/image/multi-editBase64 문자열 또는 URL파일 업로드image/png
/image/background-removeBase64 문자열 또는 URL파일 업로드image/png
편집 endpoint의 경우 이미지 크기는 최소 65536 픽셀, 최대 33177600 픽셀이어야 합니다. 업로드 파일은 25MB 미만이어야 합니다.

모델 및 가격

기본 편집 모델은 qwen-edit이며 편집당 $0.04 입니다. 편집 가능한 다른 모델은 가격과 제약이 다를 수 있습니다. 참고:

에러

StatusMeaningAction
400잘못된 요청 파라미터이미지 수, 필드 이름, 입력 포맷 확인
401인증 실패API 키 확인
402잔액 부족venice.ai/settings/api에서 크레딧 추가
415잘못된 content typeJSON 또는 multipart form-data를 올바르게 사용
429Rate limit 초과 또는 모델 과부하백오프와 함께 재시도, Retry-After 헤더 확인
500추론 처리 실패요청 재시도
503모델 용량 초과잠시 후 재시도
일부 편집 모델은 이미지 생성 모델보다 엄격한 콘텐츠 정책을 가집니다. 예를 들어 qwen-edit는 노골적 성적 이미지, 미성년자 성적 묘사, 실제 폭력과 관련된 요청을 차단합니다.

관련 워크플로