Skip to main content
POST
POST /v1/images/edits image-to-image endpoint는 multipart/form-data request body를 사용합니다. 하나 이상의 reference images를 업로드하고 prompt 및 parameter fields를 form fields로 제출하세요.
https://www.bettertoken.ai/v1Base URL로 사용하세요. Authorization: Bearer YOUR_API_KEY를 통해 BetterToken API Key를 전달하세요.
페이지 오른쪽의 Playground에서 form fields를 입력하고 reference images를 업로드한 다음 https://www.bettertoken.ai/v1/images/edits로 request를 직접 보낼 수 있습니다.
image-to-image requests에 일반 JSON body를 사용하지 마세요. text fields와 file fields는 multipart/form-data로 제출하세요.

권장 값

모든 request에서 다음 fields를 명시적으로 보내세요.
단일 reference image에는 image를 사용하세요. 여러 reference images에는 반복된 image[] fields를 사용하세요.

단일 reference image

여러 reference images

Python 예시

권장 sizes

size는 예상 aspect ratio와 size tier를 나타냅니다. 실제 반환 pixels는 server에 의해 mapping 또는 adjusted될 수 있습니다. output을 요청한 값으로 강제로 crop하지 말고 decoded image dimensions를 사용하세요.

이미지 저장

성공한 response는 다음 OpenAI-compatible image response shape를 따릅니다.
data[0].b64_json을 읽어 base64 image content로 저장하세요. 항상 output_format: "png"를 설정하면 decoded image를 .png로 저장할 수 있습니다.

Response flow

이 endpoint는 synchronous입니다. POST /images/edits를 보낸 후 server가 response할 때까지 현재 HTTP request를 열어 두세요. generation에 성공하면 image content가 data[0].b64_json으로 반환됩니다. endpoint는 task_id를 반환하지 않으며 별도의 status query 또는 result download endpoint가 없습니다.

관련 문서

인증

Authorization
string
header
필수

Use your BetterToken API Key as a bearer token. Do not expose API keys in frontend browser code, screenshots, logs, tickets, or Git repositories.

본문

multipart/form-data
model
enum<string>
기본값:YOUR_MODEL_ID
필수

固定使用 YOUR_MODEL_ID。

사용 가능한 옵션:
YOUR_MODEL_ID
예시:

"YOUR_MODEL_ID"

prompt
string
필수

图片编辑或参考图生成说明。

예시:

"参考这张图片,生成一张更精致的方形产品主视觉,保持主体风格一致。"

image
file

单张参考图字段名。单参考图时使用 image。

image[]
file[]

多张参考图字段名。多参考图时重复提交 image[]。

n
기본값:1

推荐固定为 1。多张图片建议发起多次独立请求。

예시:

"1"

size
enum<string>
기본값:1024x1024

图片尺寸和比例档位。auto 为自动;1024x1024 和 2048x2048 为 1:1;1536x1024 为 3:2;1024x1536 为 2:3;1536x1152 为 4:3;1152x1536 为 3:4;2048x1152 和 3840x2160 为 16:9;2160x3840 为 9:16。实际返回像素可能由服务端映射或调整,客户端应以解码后的真实图片尺寸为准。

사용 가능한 옵션:
auto,
1024x1024,
1536x1024,
1024x1536,
1536x1152,
1152x1536,
2048x2048,
2048x1152,
3840x2160,
2160x3840
예시:

"1024x1024"

response_format
enum<string>
기본값:b64_json

推荐固定为 b64_json。

사용 가능한 옵션:
b64_json
예시:

"b64_json"

output_format
enum<string>
기본값:png

推荐固定为 png。不要依赖 jpeg 或 webp 直接返回对应格式。

사용 가능한 옵션:
png
예시:

"png"

응답

Image generation result.

OpenAI-compatible image response. Clients should read data[0].b64_json and allow additional fields such as revised_prompt.

created
integer
예시:

1710000000

data
object[]