콘텐츠로 이동

Qwen 이미지 형식 (Image)

📝 소개

텍스트 프롬프트를 전달하면 모델이 새 이미지를 생성합니다. Qwen/Alibaba Cloud는 자연어 기반 이미지 생성 및 기존 이미지 편집을 지원하는 강력한 모델을 제공합니다.

🤖 지원 모델

현재 지원되는 모델:

모델 설명
qwen-image-plus 텍스트 프롬프트 기반 고품질 이미지 생성을 지원하는 Qwen 이미지 생성 모델
wan2.5-t2i-preview Wan 2.5 텍스트-투-이미지 프리뷰 모델
qwen-image-edit-plus 입력 이미지+텍스트 프롬프트 기반 이미지 편집을 지원하는 Qwen 이미지 편집 모델
qwen-image-edit Qwen 이미지 편집 모델
wan2.5-i2i-preview Wan 2.5 이미지-투-이미지 프리뷰 모델

💡 요청 예시

이미지 생성 ✅

# Basic image generation
curl "https://ssanai-workspace.atto-lab.cc/v1/images/generations" \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $API_KEY" \
  -X POST \
  -d '{
    "model": "qwen-image-plus",
    "prompt": "Give me an image of a cat",
    "n": 1,
    "size": "1328*1328"
  }'

응답 예시:

{
  "created": 1234567890,
  "data": [
    {
      "url": "https://example.com/image.png",
      "b64_json": "..."
    }
  ]
}

이미지 편집 ✅

# Image editing (using multipart form)
curl -X POST "https://ssanai-workspace.atto-lab.cc/v1/images/edits" \
  -H "Authorization: Bearer $API_KEY" \
  -F "image=@hand-statue.png" \
  -F "model=qwen-image-edit" \
  -F "prompt=The broken remains of the hand-shaped statue, with all parts above the wrist missing. These broken pieces are jutting out of the water surrounding the statue."

응답 예시:

{
  "created": 1234567890,
  "data": [
    {
      "url": "https://example.com/edited-image.png",
      "b64_json": "..."
    }
  ]
}

📮 요청

엔드포인트

이미지 생성

POST /v1/images/generations

텍스트 프롬프트를 기반으로 이미지를 생성합니다. qwen-image-pluswan2.5-t2i-preview 모델을 지원합니다.

이미지 편집

POST /v1/images/edits

입력 이미지와 텍스트 프롬프트를 기반으로 이미지를 편집하거나 새로 생성합니다. qwen-image-edit-plus, qwen-image-edit, wan2.5-i2i-preview 모델을 지원하며 이미지 데이터는 multipart form으로 전달합니다.

인증 방법

요청 헤더에 API 키를 포함하세요:

Authorization: Bearer $API_KEY

$API_KEY는 발급받은 API 키입니다.

요청 본문 파라미터

텍스트-투-이미지 생성 (/v1/images/generations)

파라미터 유형 필수 설명
model string 모델 이름(예:) "qwen-image-plus" or "wan2.5-t2i-preview"
prompt string 원하는 이미지에 대한 텍스트 설명
n integer 아니오 생성할 이미지 수, 고정값 1
size string 아니오 출력 이미지 해상도(가로*세로 형식)입니다. 기본 해상도는 1328*1328이며, 사용 가능한 옵션과 종횡비는 다음과 같습니다:
- "1664*928" (16:9)
- "1472*1140" (4:3)
- "1328*1328" (1:1, default)
- "1140*1472" (3:4)
- "928*1664" (9:16)
response_format string 아니오 응답 형식("url" 또는 "b64_json")
prompt
  • 유형: String
  • 필수: Yes
  • 설명: 원하는 이미지에 대한 텍스트 설명.
  • 팁:
  • Use specific and detailed descriptions
  • Include key visual elements
  • Specify the desired artistic style
  • Describe composition and perspective

이미지 편집 (/v1/images/edits)

이미지 편집은 multipart form 요청 형식을 사용합니다.

파라미터 유형 필수 설명
model string 모델 이름(예:) "qwen-image-edit-plus", "qwen-image-edit", or "wan2.5-i2i-preview"
image file 편집할 입력 이미지 파일
prompt string 입력 이미지를 어떻게 수정할지 설명하는 텍스트 프롬프트
image
  • 유형: 파일 (multipart form)
  • 필수: Yes
  • 설명: 편집할 입력 이미지 파일.
prompt
  • 유형: String
  • 필수: Yes
  • 설명: Text prompt describing how you want to modify the input image.
  • 팁:
  • Clearly describe elements to add, remove, or replace
  • Use specific and detailed descriptions
  • Describe the desired modification effect

📥 응답

성공 응답

텍스트-투-이미지 생성 응답

{
  "created": 1234567890,
  "data": [
    {
      "url": "https://example.com/image.png",
      "b64_json": "..."
    }
  ]
}

응답 필드 설명:

필드 유형 설명
created integer 생성 타임스탬프
data array 생성된 이미지 배열
data[].url string 이미지 URL (response_format이 "url"인 경우)
data[].b64_json string Base64 인코딩 이미지 데이터 (response_format이 "b64_json"인 경우)

이미지 편집 응답

{
  "created": 1234567890,
  "data": [
    {
      "url": "https://example.com/edited-image.png",
      "b64_json": "..."
    }
  ]
}

응답 형식은 텍스트-투-이미지 생성과 동일합니다.

오류 응답

요청 실패 시 다음과 같은 오류 응답이 반환됩니다:

{
  "error": {
    "message": "Error description",
    "type": "invalid_request_error",
    "code": "error_code"
  }
}

🌟 모범 사례

프롬프트 작성 제안

  1. 명확하고 구체적인 설명을 사용하세요
  2. 중요한 시각적 디테일을 명시하세요
  3. Describe the desired artistic style and atmosphere
  4. Pay attention to composition and perspective descriptions
  5. Can include details such as color, lighting, mood, etc.

파라미터 선택 제안

  1. Model Selection

    • qwen-image-plus: Qwen image generation model, suitable for quickly generating high-quality images
    • wan2.5-t2i-preview: Wan 2.5 텍스트-투-이미지 프리뷰 모델
    • qwen-image-edit-plus: 입력 이미지+텍스트 프롬프트 기반 이미지 편집을 지원하는 Qwen 이미지 편집 모델
    • qwen-image-edit: Qwen 이미지 편집 모델
    • wan2.5-i2i-preview: Wan 2.5 이미지-투-이미지 프리뷰 모델
  2. 프롬프트 최적화

    • Use detailed and descriptive text
    • Include specific visual elements and style requirements
    • Avoid vague or overly brief descriptions
    • When editing images, clearly describe how you want to modify the input image (add, remove, replace elements, etc.)
  3. 이미지 편집 참고 사항

    • Ensure the input image format is correct
    • Use multipart form format to upload images
    • Provide clear editing instructions

공통 이슈

  1. 이미지 생성 실패

    • 프롬프트가 콘텐츠 정책을 준수하는지 확인
    • API 키 권한 확인
    • Confirm the request format is correct
    • Check if the model name is correct
  2. 결과가 기대와 다름

    • 프롬프트 설명 최적화s to be more specific and detailed
    • Add more visual details and style descriptions
    • Try different description approaches
  3. 이미지 편집 실패

    • Confirm the image file format is correct
    • Check if multipart form format is used
    • Verify the prompt clearly describes the editing requirements