Change Clothes AI API Dokumentation
2025-05-28
Posted byChange Clothes AI API Dokumentation
Einführung & Anwendungsfälle
Die Change Clothes AI API ermöglicht es Entwicklern, virtuelle Kleidungsstücke einfach per API-Aufruf auf Modelbilder anzuwenden. Sie ist ideal für E-Commerce, virtuelles Anprobieren, Mode-Styling und Content-Erstellung. Ob Sie Nutzern ein Online-Anprobe-Erlebnis bieten oder Content Creators helfen möchten, vielfältige Outfit-Bilder zu generieren – diese API steigert Effizienz und Nutzererlebnis erheblich.
Häufige Anwendungsfälle
- E-Commerce-Plattformen bieten virtuelles Anprobieren zur Steigerung der Konversionsrate
- Mode-Styling-Apps generieren Outfit-Vorschauen
- Content Creators erstellen Bilder mit verschiedenen Kleidungs-Kombinationen in Serie
- Modedesigner sehen neue Kleidungsdesigns an Modellen vorab
- KI-Avatare oder virtuelle Charaktere wechseln Outfits
API-Schlüssel
Um unsere API zu nutzen, benötigen Sie API-Zugangsdaten. Sie können Ihre API-Schlüssel im Dashboard verwalten.
API 1 : Kleidung wechseln mit Kleidungsbild
Um diese API zu nutzen, müssen Sie Modelbilder und Kleidungsbilder bereitstellen. Wenn Sie kein Bild des Kleidungsstücks haben oder das Kleidungsstück per Text beschreiben möchten, siehe die nächste API.
API-Endpunkt
POST https://changeclothesai.online/api/openapi/change-clothes-ai
Integrationsanleitung
Request Headers
| Header Name | Erforderlich | Beschreibung |
|---|---|---|
| content-type | Ja | Muss multipart/form-data sein |
| authorization | Ja | Muss Bearer $ sein $ ist Ihr API-Schlüssel. |
Request Body FormData Parameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
| modelImg | string oder Datei | Ja | Modelbild. Akzeptiert drei Eingabeformate: 1. Modelbild-URL, beginnend mit http:// oder https://. 2. Base64-kodiertes Bild, Format: data:image/jpeg;base64,/9j/4AAQSkZJR... (Hinweis: andere Bildtypen wie PNG sind ebenfalls möglich, passen Sie den MIME-Typ entsprechend an) 3. Dateiobjekt: Eine Datei, die das Modelbild repräsentiert. |
| garmentImg | string oder Datei | Ja | Kleidungsbild. Akzeptiert drei Eingabeformate wie bei modelImg. |
| category | string | Ja | Kategorie des Kleidungsstücks, Enums: upper_body, lower_body, dresses |
| garmentDesc | string | Nein | Optionale Beschreibung des Kleidungsstücks auf Englisch |
Response JSON Format
| Feld | Typ | Beschreibung |
|---|---|---|
| code | number | Antwort-Statuscode. 200 für Erfolg. |
| msg | string | Antwortnachricht, liefert zusätzliche Informationen |
| data | object | Antwortdaten-Objekt, vorhanden wenn code 200 ist |
| data.resultImgUrl | string | URL des Ergebnisbildes |
| data.maskImgUrl | string | URL des Modelbildes mit Inpaint-Maske |
| data.cacheHit | boolean | true, wenn Cache für voreingestelltes Model- und Kleidungsbild genutzt wurde. Nur für Preset-Models und Preset-Kleidungsstücke gecached |
Antwortcodes
| Code | Nachricht | Beschreibung |
|---|---|---|
| 200 | OK | Anfrage erfolgreich |
| 500 | SERVER_ERROR | Interner Serverfehler |
| 10001 | NOT_LOGIN | Nutzer nicht authentifiziert |
| 10002 | USER_NOT_EXIST | Nutzer existiert nicht |
| 10003 | INSUFFICIENT_CREDITS | Nicht genügend Guthaben |
| 10004 | INVALID_PARAM | Ungültige Parameter |
| 10005 | HARMFUL_CONTENT | Schädlicher Inhalt erkannt |
| 10006 | INSUFFICIENT_TRAIL_COUNT | Testnutzungs-Limit überschritten |
| 20001 | TRY_ON_EXCEPTION | Verarbeitungsfehler |
| 30001 | INVALID_API_KEY | Ungültiger API-Schlüssel |
| 30002 | INVALID_SIGNATURE | Ungültige Anforderungssignatur |
Beispielantwort
{
"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
}
}
Codebeispiele
Curl-Beispiel mit Bild-URL
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-Beispiel mit lokalem Bild
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"'
Curl-Beispiel mit Base64-Bild
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 Beispiel
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 Beispiel
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 : Kleidung wechseln per Prompt
Um diese API zu nutzen, müssen Sie ein Modelbild und eine Kleidungsbeschreibung (Prompt) angeben.
API-Endpunkt
POST https://changeclothesai.online/api/openapi/change-clothes-by-prompt
Integrationsanleitung
Request Headers
| Header Name | Erforderlich | Beschreibung |
|---|---|---|
| content-type | Ja | Muss multipart/form-data sein |
| authorization | Ja | Muss Bearer $ sein $ ist Ihr API-Schlüssel. |
Request Body FormData Parameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
| modelImg | string oder Datei | Ja | Modelbild. Akzeptiert drei Eingabeformate: 1. Modelbild-URL, beginnend mit http:// oder https://. 2. Base64-kodiertes Bild, Format: data:image/jpeg;base64,/9j/4AAQSkZJR... (Hinweis: andere Bildtypen wie PNG sind ebenfalls möglich, passen Sie den MIME-Typ entsprechend an) 3. Dateiobjekt: Eine Datei, die das Modelbild repräsentiert. |
| prompt | string | Ja | Prompt zur Kleidungsänderung auf Englisch. z.B. Help the model change into a blue striped shirt. |
| seed | string | Nein | Seed für den KI-Prozess, Bereich 0 bis 2147483647. Optional, wird überschrieben, wenn randomize_seed true ist. |
| randomize_seed | string | Nein | Generiert zufälligen Seed, Enums: true, false. |
| guidance_scale | string | Nein | Beeinflussungsgewicht des Prompts, numerisch, Bereich 1-100, je höher desto stärker. Optional, Standard 50. Nur bei Bedarf anpassen. |
| num_inference_steps | string | Nein | Anzahl der Iterationen für das Bild, numerisch, Bereich 1-50. Optional, Standardwert 28. Nur bei Bedarf anpassen. |
Response JSON Format
| Feld | Typ | Beschreibung |
|---|---|---|
| code | number | Antwort-Statuscode. 200 für Erfolg. |
| msg | string | Antwortnachricht, liefert zusätzliche Informationen |
| data | object | Antwortdaten-Objekt, vorhanden wenn code 200 ist |
| data.resultImgUrl | string | URL des Ergebnisbildes |
| data.seed | number | Seed zur Bildgenerierung |
Antwortcodes
| Code | Nachricht | Beschreibung |
|---|---|---|
| 200 | OK | Anfrage erfolgreich |
| 500 | SERVER_ERROR | Interner Serverfehler |
| 10001 | NOT_LOGIN | Nutzer nicht authentifiziert |
| 10002 | USER_NOT_EXIST | Nutzer existiert nicht |
| 10003 | INSUFFICIENT_CREDITS | Nicht genügend Guthaben |
| 10004 | INVALID_PARAM | Ungültige Parameter |
| 10005 | HARMFUL_CONTENT | Schädlicher Inhalt erkannt |
| 10006 | INSUFFICIENT_TRAIL_COUNT | Testnutzungs-Limit überschritten |
| 20001 | TRY_ON_EXCEPTION | Verarbeitungsfehler |
| 30001 | INVALID_API_KEY | Ungültiger API-Schlüssel |
| 30002 | INVALID_SIGNATURE | Ungültige Anforderungssignatur |
Beispielantwort
{
"code": 200,
"data":
{
"resultImgUrl": "https://r2.changeclothesai.online/1748486113268661990.webp",
"seed": 627512067
}
}
Codebeispiele
Curl-Beispiel mit Bild-URL
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-Beispiel mit lokalem Bild
# 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."'
Curl-Beispiel mit Base64-Bild
# 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 Beispiel
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 Beispiel
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)}
Preise
API-Aufrufe verbrauchen Guthaben von Ihrem Konto. Sie können Guthaben auf unserer Preisseite erwerben.
Hilfe & Support
Wenn Sie Fragen haben oder Unterstützung benötigen, wenden Sie sich bitte an unser Support-Team.
Email: dreamspire.team@gmail.com