Back to Home

Change Clothes AI API 문서

2025-05-28

Posted by

Change Clothes AI API 문서

소개 및 활용 사례

Change Clothes AI API를 사용하면 개발자가 간단한 API 호출로 모델 이미지에 가상 의상을 쉽게 적용할 수 있습니다. 이 API는 이커머스, 가상 피팅, 패션 스타일링, 콘텐츠 제작 등 다양한 분야에 적합합니다. 온라인 피팅 경험을 제공하거나, 콘텐츠 크리에이터가 다양한 의상 이미지를 대량 생성하는 데 효율성과 사용자 경험을 크게 향상시킬 수 있습니다.

주요 활용 사례

  • 이커머스 플랫폼에서 가상 피팅 제공으로 전환율 향상
  • 패션 스타일링 앱에서 의상 미리보기 생성
  • 콘텐츠 크리에이터가 의상 조합 이미지를 대량 생성
  • 패션 디자이너가 새로운 의상 디자인을 모델에 미리보기
  • AI 아바타 또는 가상 캐릭터의 의상 변경

API 키

API를 사용하려면 API 인증키가 필요합니다. 대시보드에서 API 키를 관리할 수 있습니다.

API 키 관리 →

API 1 : 의상 이미지로 의상 변경

이 API를 사용하려면 모델 이미지와 의상 이미지를 제공해야 합니다. 의상 이미지가 없거나 텍스트로 의상을 설명하고 싶다면 다음 API를 참고하세요.

API 엔드포인트

POST https://changeclothesai.online/api/openapi/change-clothes-ai

연동 가이드

요청 헤더

헤더명필수설명
content-type반드시 multipart/form-data 여야 합니다
authorization반드시 Bearer $
**$**는 발급받은 API 키입니다.

요청 바디 FormData 파라미터

파라미터타입필수설명
modelImgstring 또는 file모델 이미지. 세 가지 입력 형식 지원:
1. 모델 이미지 URL (http:// 또는 https://로 시작)
2. Base64 인코딩 이미지 (예: data:image/jpeg;base64,/9j/4AAQSkZJR...)
3. 파일 객체
garmentImgstring 또는 file의상 이미지. 입력 형식은 modelImg와 동일
categorystring의상 카테고리, enum: upper_body, lower_body, dresses
garmentDescstring아니오(선택) 의상 설명 (영어로 입력)

응답 JSON 포맷

필드타입설명
codenumber응답 상태 코드. 200은 성공
msgstring응답 메시지, 추가 정보 제공
dataobject응답 데이터 객체, code가 200일 때 포함
data.resultImgUrlstring결과 이미지 URL
data.maskImgUrlstring인페인트 마스크가 적용된 모델 이미지 URL
data.cacheHitboolean프리셋 모델/의상 이미지 캐시 적중 시 true
프리셋 모델/의상만 캐시됨
응답 코드
코드메시지설명
200OK요청 성공
500SERVER_ERROR내부 서버 오류
10001NOT_LOGIN인증되지 않음
10002USER_NOT_EXIST사용자가 존재하지 않음
10003INSUFFICIENT_CREDITS크레딧 부족
10004INVALID_PARAM잘못된 파라미터
10005HARMFUL_CONTENT유해 콘텐츠 감지
10006INSUFFICIENT_TRAIL_COUNT체험 사용 한도 초과
20001TRY_ON_EXCEPTION처리 오류
30001INVALID_API_KEY잘못된 API 키
30002INVALID_SIGNATURE잘못된 요청 서명
응답 예시
{
    "code": 200,
    "data":
    {
        "resultImgUrl": "https://persistent.changeclothesai.online/change-clothes-ai/cache/1747493767397255851.webp",
        "maskImgUrl": "https://persistent.changeclothesai.online/change-clothes-ai/cache/1747493770543821630.webp",
        "cacheHit": true
    }
}

코드 예시

이미지 URL로 Curl 예시

curl --location 'https://changeclothesai.online/api/openapi/change-clothes-ai' \
--header 'Authorization: Bearer ${SECRET_KEY}' \
--form 'garmentImg="https://persistent.changeclothesai.online/change-clothes-ai/assets/examples/garment-tab/dresses/04-01.jpg"' \
--form 'category="dresses"' \
--form 'modelImg="https://persistent.changeclothesai.online/change-clothes-ai/assets/examples/person-tab/women/003.jpg"'

로컬 이미지 파일로 Curl 예시

curl --location 'https://changeclothesai.online/api/openapi/change-clothes-ai' \
--header 'Authorization: Bearer ${SECRET_KEY}' \
--form 'garmentImg=@"/PATH/TO/YOUR/GARMENT/IMAGE.jpg"' \
--form 'category="dresses"' \
--form 'modelImg=@"/PATH/TO/YOUR/MODEL/IMAGE.png"'

Base64 이미지로 Curl 예시

curl --location 'https://changeclothesai.online/api/openapi/change-clothes-ai' \
--header 'Authorization: Bearer ${SECRET_KEY}' \
--form 'garmentImg="data:image/jpeg;base64,/9j……/9k="' \
--form 'category="dresses"' \
--form 'modelImg="data:image/jpeg;base64,/9j……/9k="'

Node.js 예시

async function callChangeClothesApi() {
  const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key

  const formData = new FormData();
  formData.append('modelImg', ...); // Support url, image file, image base64 encode
  formData.append('garmentImg', ...); // Support url, image file, image base64 encode
  formData.append('category', ...); // upper_body, lower_body, dresses
  if (...) { // judge garmentDesc not empty
    formData.append('garmentDesc', ...);
  }

  const apiEndpoint = 'https://changeclothesai.online/api/openapi/change-clothes-ai';
  try {
    const response = await fetch(apiEndpoint, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
      },
      body: formData,
    });

    if (!response.ok) {
      const errorData = await response.json();
      throw new Error(`HTTP error ${response.status}: ${errorData.msg || 'Unknown error'}`);
    }

    const data = await response.json();
    return { resultImgUrl: data.data.resultImgUrl, maskImgUrl: data.data.maskImgUrl, error: null };

  } catch (error) {
    console.error('Error changing clothes:', error);
    return { resultImgUrl: null, maskImgUrl: null, error: error.message };
  }
}

Python 예시


import requests
import base64

async def call_change_clothes_api():
    api_key = 'YOUR_API_KEY'  # Replace with your actual API key

    form_data = {
        'modelImg': 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD...',  # Example base64 image. Replace with your actual image data. Supports url, file, and base64.
        'garmentImg': 'https://example.com/garment.png', # Example url. Supports url, file, and base64.
        'category': 'upper_body',  # upper_body, lower_body, dresses
        'garmentDesc': 'A beautiful red dress' # Example description. Remove this line if garmentDesc is empty
    }

    api_endpoint = 'https://changeclothesai.online/api/openapi/change-clothes-ai'
    try:
        headers = {
            'Authorization': f'Bearer {api_key}',
        }

        response = requests.post(api_endpoint, files=form_data, headers=headers) # Use files= for multipart/form-data
        response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)

        data = response.json()
        return {'resultImgUrl': data.get('data', {}).get('resultImgUrl'), 'maskImgUrl': data.get('data', {}).get('maskImgUrl'), 'error': None}

    except requests.exceptions.RequestException as e:
        print(f'Error changing clothes: {e}')
        return {'resultImgUrl': None, 'maskImgUrl': None, 'error': str(e)}

API 2 : 프롬프트로 의상 변경

이 API를 사용하려면 모델 이미지와 의상 설명 프롬프트를 제공해야 합니다.

API 엔드포인트

POST https://changeclothesai.online/api/openapi/change-clothes-by-prompt

연동 가이드

요청 헤더

헤더명필수설명
content-type반드시 multipart/form-data 여야 합니다
authorization반드시 Bearer $
**$**는 발급받은 API 키입니다.

요청 바디 FormData 파라미터

파라미터타입필수설명
modelImgstring 또는 file모델 이미지. 세 가지 입력 형식 지원:
1. 모델 이미지 URL (http:// 또는 https://로 시작)
2. Base64 인코딩 이미지 (예: data:image/jpeg;base64,/9j/4AAQSkZJR...)
3. 파일 객체
promptstring의상 변경 프롬프트 (영어로 입력)
예: Help the model change into a blue striped shirt.
seedstring아니오AI 프로세스 시작 시드, 0~2147483647 범위. 선택 파라미터, randomize_seed가 true면 무시됨.
randomize_seedstring아니오랜덤 시드 생성, enum: true, false.
guidance_scalestring아니오프롬프트 영향력 가중치, 숫자형, 1~100 범위, 클수록 영향력 증가. 기본값 50, 필요 시만 조정 권장
num_inference_stepsstring아니오이미지 생성 반복 횟수, 숫자형, 1~50 범위, 기본값 28, 필요 시만 조정 권장

응답 JSON 포맷

필드타입설명
codenumber응답 상태 코드. 200은 성공
msgstring응답 메시지, 추가 정보 제공
dataobject응답 데이터 객체, code가 200일 때 포함
data.resultImgUrlstring결과 이미지 URL
data.seednumber이미지 생성에 사용된 시드
응답 코드
코드메시지설명
200OK요청 성공
500SERVER_ERROR내부 서버 오류
10001NOT_LOGIN인증되지 않음
10002USER_NOT_EXIST사용자가 존재하지 않음
10003INSUFFICIENT_CREDITS크레딧 부족
10004INVALID_PARAM잘못된 파라미터
10005HARMFUL_CONTENT유해 콘텐츠 감지
10006INSUFFICIENT_TRAIL_COUNT체험 사용 한도 초과
20001TRY_ON_EXCEPTION처리 오류
30001INVALID_API_KEY잘못된 API 키
30002INVALID_SIGNATURE잘못된 요청 서명
응답 예시
{
    "code": 200,
    "data":
    {
        "resultImgUrl": "https://r2.changeclothesai.online/1748486113268661990.webp",
        "seed": 627512067
    }
}

코드 예시

이미지 URL로 Curl 예시

curl --location 'https://changeclothesai.online/api/openapi/change-clothes-by-prompt' \
--header 'Authorization: Bearer ${SECRET_KEY}' \
--form 'modelImg="https://persistent.changeclothesai.online/change-clothes-ai/assets/examples/person-tab/women/003.jpg"' \
--form 'prompt="Help the model change into a blue striped shirt."'

로컬 이미지 파일로 Curl 예시

# curl with image url
curl --location 'https://changeclothesai.online/api/openapi/change-clothes-by-prompt' \
--header 'Authorization: Bearer ${SECRET_KEY}' \
--form 'modelImg=@"/PATH/TO/YOUR/MODEL/IMAGE.png"' \
--form 'prompt="Help the model change into a blue striped shirt."'

Base64 이미지로 Curl 예시

# curl with image url
curl --location 'https://changeclothesai.online/api/openapi/change-clothes-by-prompt' \
--header 'Authorization: Bearer ${SECRET_KEY}' \
--form 'modelImg="data:image/jpeg;base64,/9j……/9k="' \
--form 'prompt="Help the model change into a blue striped shirt."'

Node.js 예시

async function callChangeClothesApi() {
  const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key

  const formData = new FormData();
  formData.append('modelImg', ...); // Support url, image file, image base64 encode
  formData.append('prompt', 'Help the model change into a blue striped shirt.');
  

  const apiEndpoint = 'https://changeclothesai.online/api/openapi/change-clothes-by-prompt';
  try {
    const response = await fetch(apiEndpoint, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
      },
      body: formData,
    });

    if (!response.ok) {
      const errorData = await response.json();
      throw new Error(`HTTP error ${response.status}: ${errorData.msg || 'Unknown error'}`);
    }

    const data = await response.json();
    return { resultImgUrl: data.data.resultImgUrl, seed: data.data.seed };

  } catch (error) {
    console.error('Error changing clothes:', error);
    return { resultImgUrl: null, maskImgUrl: null, error: error.message };
  }
}

Python 예시


import requests
import base64

async def call_change_clothes_api():
    api_key = 'YOUR_API_KEY'  # Replace with your actual API key

    form_data = {
        'modelImg': 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD...',  # Example base64 image. Replace with your actual image data. Supports url, file, and base64.
        'prompt': 'Help the model change into a blue striped shirt.'
    }

    api_endpoint = 'https://changeclothesai.online/api/openapi/change-clothes-by-prompt'
    try:
        headers = {
            'Authorization': f'Bearer {api_key}',
        }

        response = requests.post(api_endpoint, files=form_data, headers=headers) # Use files= for multipart/form-data
        response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)

        data = response.json()
        return {'resultImgUrl': data.get('data', {}).get('resultImgUrl'), 'seed': data.get('data', {}).get('seed')}

    except requests.exceptions.RequestException as e:
        print(f'Error changing clothes: {e}')
        return {'resultImgUrl': None, 'seed': None, 'error': str(e)}

요금 안내

API 호출 시 계정의 크레딧이 차감됩니다. 요금제는 아래 페이지에서 확인 및 구매할 수 있습니다.

요금제 보기 →

문의 및 지원

질문이나 도움이 필요하시면 언제든지 지원팀에 문의해 주세요.

이메일: dreamspire.team@gmail.com