Skip to content
가이드

이미지 생성 및 편집 ​

Vanix AI는 공급자별 멀티모달 이미지 모델과 함께 OpenAI 호환 이미지 생성 및 편집 엔드포인트(/v1/images/generations 및 /v1/images/edits)를 제공합니다.

POSThttps://api.vanix.io/v1/images/generations

텍스트 기반 이미지 생성 ​

bash
curl https://api.vanix.io/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $VANIX_API_KEY" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "Minimalist studio photograph of matte black wireless headphones on slate stone, soft directional rim light",
    "size": "1024x1024",
    "quality": "high",
    "n": 1
  }'
python
import base64, os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["VANIX_API_KEY"],
    base_url="https://api.vanix.io/v1",
)

result = client.images.generate(
    model="gpt-image-1",
    prompt="Minimalist studio photograph of matte black wireless headphones on slate stone",
    size="1024x1024",
    quality="high",
)

image_b64 = result.data[0].b64_json
if image_b64:
    with open("output.png", "wb") as f:
        f.write(base64.b64decode(image_b64))
else:
    print("Image URL:", result.data[0].url)

이미지 편집 (인페인팅 및 참조 편집) ​

POSThttps://api.vanix.io/v1/images/edits

특정 영역을 편집하려면 원본 이미지(multipart/form-data)와 선택 사항인 투명 PNG 마스크를 함께 업로드하세요:

bash
curl https://api.vanix.io/v1/images/edits \
  -H "Authorization: Bearer $VANIX_API_KEY" \
  -F "model=gpt-image-1" \
  -F "image=@product.png" \
  -F "prompt=Place the product on a warm oak countertop with morning sunlight" \
  -F "size=1024x1024"

응답 형식 및 저장 모범 사례 ​

필드동작권장 사항
data[0].b64_json인라인 Base64 PNG/WebP 페이로드(gpt-image-1의 기본값).즉시 디코딩하여 자체 오브젝트 스토리지(S3/R2)에 영구 저장하세요.
data[0].url임시 서명된 업스트림 URL(수 분~수 시간 후 만료).다운로드하여 영구 스토리지에 미러링하세요. 프로덕션 UI에서 직접 핫링크하지 마세요.
n요청당 생성할 변형 수(모델에 따라 1–4).과금은 n, 해상도 및 quality에 비례하여 증가합니다.

Vanix AI 통합 모델 게이트웨이 · https://api.vanix.io