# 이미지를 이미지로
> **POST** `/v3/generation/image-to-image`
참조 이미지에서 새 이미지를 생성합니다.
## 요청 매개변수
### 요청 헤더
| 매개변수 | 유형 | 필수 | 기본값 | 설명 |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | 문자열 | 예 | - | `application/json` |
| Authorization | 문자열 | 예 | - | `Bearer {api_key}` |
### 요청 본문
| 매개변수 | 유형 | 필수 | 기본값 | 설명 |
| :-: | :-: | :-: | :-: | :-: |
| input | 문자열 | 예 | - | 참고 이미지. `file_token`, 이미지 URL 또는 `task_id`를 지원합니다. |
| inputs | 문자열[] | 아니요 | - | 여러 참조 이미지 목록입니다. `seedream` 모델은 최대 4개의 이미지를 지원하고, `banana` 모델은 최대 10개의 이미지를 지원합니다. `[image number]`를 사용하여 `prompt`의 특정 이미지를 참조할 수 있습니다. |
| prompt | 문자열 | 조건부 필수 | - | 이미지 편집 지침. `template`가 지정되지 않은 경우 필수 |
| model | 문자열 | 아니요 | `seedream_v5` | 이미지 모델. 지원되는 값: `seedream_v5`, `banana`, `banana_pro`, `banana2`, `chat_image_1`, `chat_image_1.5`, `chat_image_2`, `chat_image_2.5_flare`, `chat_image_2.5_sunburst` |
| quality | 문자열 | 아니요 | `low` | 품질 등급. `chat_image_2`(`low`, `medium`, `high`) 및 `chat_image_2.5_flare` / `chat_image_2.5_sunburst`(추가로 `xhigh`, `max`)만 지원합니다. 생략하면 `low`와 같으며 `auto`는 지원하지 않습니다. `high`/`xhigh`/`max`는 크레딧이 더 소모됩니다. |
| background | 문자열 | 아니요 | - | 배경 처리 방식. `chat_image_2.5_flare` / `chat_image_2.5_sunburst`만 지원: `auto`, `opaque`, `transparent`. 다른 모델에서는 오류 없이 무시됩니다. `transparent`는 `output_format=png`가 필요합니다(JPEG는 알파 채널 미지원). |
| template | 문자열 | 아니요 | - | 템플릿 이름. 지원되는 값: `asset_extraction`, `character_completion`, `t_pose`, `head_extraction`, `3d_enhance`, `variants`, `print_clay`, `figure` |
| t_pose | 부울 | 아니요 | `false` | T-포즈로 변환 |
| sketch_to_render | 부울 | 아니요 | `false` | 스케치를 렌더링된 이미지로 변환 |
## 요청 예시
### curl
```bash
curl -X POST https://openapi.tripo3d.ai/v3/generation/image-to-image \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {api_key}" \
-d '{
"input": "https://example.com/reference.png",
"prompt": "Replace the background with a starry sky",
"model": "seedream-v4"
}'
```
### Python
```python
import requests
url = "https://openapi.tripo3d.ai/v3/generation/image-to-image"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
}
payload = {
"input": "https://example.com/reference.png",
"prompt": "Replace the background with a starry sky",
"model": "seedream-v4"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
```
### JavaScript
```javascript
const url = "https://openapi.tripo3d.ai/v3/generation/image-to-image";
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
},
body: JSON.stringify({
input: "https://example.com/reference.png",
prompt: "Replace the background with a starry sky",
model: "seedream-v4"
})
});
const data = await response.json();
console.log(data);
```
## 응답
### 성공반응
```json
{
"code": 0,
"data": {
"task_id": "task_abc123"
}
}
```
### 응답 필드
| 매개변수 | 유형 | 설명 |
| :-: | :-: | :-: |
| code | 정수 | 상태 코드. `0`는 성공을 나타냅니다. |
| data.task_id | 문자열 | 생성 진행 상황 및 결과를 쿼리하는 데 사용되는 고유 작업 식별자 |
## 오류 코드
| HTTP 상태 코드 | 오류 코드 | 설명 | 추천 |
| :-: | :-: | :-: | :-: |
| 429 | 2000 | 생성 한도를 초과했습니다. | 요청 빈도를 줄이고 나중에 다시 시도하세요. |
| 400 | 2002 | 지원되지 않는 요청 매개변수 | 요청 본문 매개변수 이름 및 값 범위 확인 |
| 400 | 2003 | 입력 파일이 비어 있습니다. | `input`가 유효한 이미지 리소스를 가리키는지 확인하세요. |
| 400 | 2004 | 지원되지 않는 파일 형식 | 지원되는 이미지 형식(PNG, JPEG, WebP)을 사용하세요. |
| 400 | 2008 | 입력 내용이 콘텐츠 정책을 위반합니다. | 입력 이미지 또는 프롬프트를 수정하고 정책을 위반하는 설명을 제거합니다. |
| 403 | 2010 | 크레딧이 부족합니다. | 크레딧을 추가하고 다시 시도하세요. |
| 400 | 2015 | 모델 버전이 지원 중단됨 | `model`를 현재 지원되는 버전으로 업그레이드하세요. |
이미지를 이미지로
POST /v3/generation/image-to-image
참조 이미지에서 새 이미지를 생성합니다.
요청 매개변수
요청 헤더
매개변수
유형
필수
기본값
설명
Content-Type
문자열
예
-
application/json
Authorization
문자열
예
-
Bearer {api_key}
요청 본문
매개변수
유형
필수
기본값
설명
input
문자열
예
-
참고 이미지. file_token, 이미지 URL 또는 task_id를 지원합니다.
inputs
문자열[]
아니요
-
여러 참조 이미지 목록입니다. seedream 모델은 최대 4개의 이미지를 지원하고, banana 모델은 최대 10개의 이미지를 지원합니다. [image number]를 사용하여 prompt의 특정 이미지를 참조할 수 있습니다.
prompt
문자열
조건부 필수
-
이미지 편집 지침. template가 지정되지 않은 경우 필수
model
문자열
아니요
seedream_v5
이미지 모델. 지원되는 값: seedream_v5, banana, banana_pro, banana2, chat_image_1, chat_image_1.5, chat_image_2, chat_image_2.5_flare, chat_image_2.5_sunburst
quality
문자열
아니요
low
품질 등급. chat_image_2(low, medium, high) 및 chat_image_2.5_flare / chat_image_2.5_sunburst(추가로 xhigh, max)만 지원합니다. 생략하면 low와 같으며 auto는 지원하지 않습니다. high/xhigh/max는 크레딧이 더 소모됩니다.
background
문자열
아니요
-
배경 처리 방식. chat_image_2.5_flare / chat_image_2.5_sunburst만 지원: auto, opaque, transparent. 다른 모델에서는 오류 없이 무시됩니다. transparent는 output_format=png가 필요합니다(JPEG는 알파 채널 미지원).
template
문자열
아니요
-
템플릿 이름. 지원되는 값: asset_extraction, character_completion, t_pose, head_extraction, 3d_enhance, variants, print_clay, figure
t_pose
부울
아니요
false
T-포즈로 변환
sketch_to_render
부울
아니요
false
스케치를 렌더링된 이미지로 변환
요청 예시
curl -X POST https://openapi.tripo3d.ai/v3/generation/image-to-image \
-H "Content-Type : application/json" \
-H "Authorization: Bearer {api_key}" \
-d '{
"input" : "https://example.com/reference.png" ,
"prompt" : "Replace the background with a starry sky" ,
"model" : "seedream-v4"
}'
import requests
url = "https://openapi.tripo3d.ai/v3/generation/image-to-image"
headers = {
"Content-Type" : "application/json" ,
"Authorization" : "Bearer {api_key}"
}
payload = {
"input" : "https://example.com/reference.png" ,
"prompt" : "Replace the background with a starry sky" ,
"model" : "seedream-v4"
}
response = requests .post(url, headers=headers, json =payload)
print (response.json ())
const url = "https://openapi.tripo3d.ai/v3/generation/image-to-image" ;
const response = await fetch (url, {
method: "POST" ,
headers: {
"Content-Type" : "application/json" ,
"Authorization" : "Bearer {api_key}"
},
body: JSON.stringify({
input: "https://example.com/reference.png" ,
prompt: "Replace the background with a starry sky" ,
model: "seedream-v4"
})
});
const data = await response.json ();
console .log(data);
응답
성공반응
{
"code" : 0 ,
"data" : {
"task_id" : "task_abc123"
}
}
응답 필드
매개변수
유형
설명
code
정수
상태 코드. 0는 성공을 나타냅니다.
data.task_id
문자열
생성 진행 상황 및 결과를 쿼리하는 데 사용되는 고유 작업 식별자
오류 코드
HTTP 상태 코드
오류 코드
설명
추천
429
2000
생성 한도를 초과했습니다.
요청 빈도를 줄이고 나중에 다시 시도하세요.
400
2002
지원되지 않는 요청 매개변수
요청 본문 매개변수 이름 및 값 범위 확인
400
2003
입력 파일이 비어 있습니다.
input가 유효한 이미지 리소스를 가리키는지 확인하세요.
400
2004
지원되지 않는 파일 형식
지원되는 이미지 형식(PNG, JPEG, WebP)을 사용하세요.
400
2008
입력 내용이 콘텐츠 정책을 위반합니다.
입력 이미지 또는 프롬프트를 수정하고 정책을 위반하는 설명을 제거합니다.
403
2010
크레딧이 부족합니다.
크레딧을 추가하고 다시 시도하세요.
400
2015
모델 버전이 지원 중단됨
model를 현재 지원되는 버전으로 업그레이드하세요.
이 페이지에서
요청 매개변수 요청 예시 응답 오류 코드