Skip to main content
POST
CometAPI에서 OpenAI 호환 요청 형식으로 텍스트에서 이미지를 생성하려면 이 경로를 사용하세요.

공식 참조

  • 다음을 읽어보세요 OpenAI 이미지 생성 가이드 에서 background, output_compression, 스트리밍 또는 향후 GPT 이미지 옵션과 같은 모델별 제어 기능을 사용하기 전에
  • 다음을 사용하세요 OpenAI 이미지 생성 참조 에서 현재 파라미터 목록을 확인하세요.

먼저 모델 선택

  • gpt-image-2 같은 GPT 이미지 모델을 사용하여 output_format, quality 또는 background 등의 제어 기능을 갖춘 텍스트-이미지 요청을 만드세요
  • 투명 배경이나 gpt-image-2.5-sunburst 또는 gpt-image-2.5-flare 품질 수준이 필요하면 xhighmax을 사용하세요
  • 해당 제공업체를 반드시 사용해야 하는 경우 qwen-image을 사용하되, n는 1로 유지하세요
  • 다음에서 현재 이미지 모델 ID를 선택하세요 모델 페이지

안전한 첫 요청

  • gpt-image-2부터 시작하세요
  • size1024x1024로 유지하세요
  • GPT 이미지 모델은 b64_json에 base64 인코딩 이미지 데이터를 반환합니다. 이미지 파일을 저장하려면 이를 디코딩하세요
  • output_formatjpeg 같은 특정 인코딩 이미지 유형이 필요한 경우에만 추가하세요
  • 일괄 생성이나 스타일 조정을 추가하기 전에 프롬프트 하나와 출력 이미지 하나를 사용하세요

비동기 이미지 작업 실행

클라이언트가 하나의 HTTP 연결을 계속 열어 두는 대신 제출 후 폴링 흐름을 선호하는 경우, 장시간 실행되는 이미지 작업에 async: true을 사용하세요. 생성 요청은 data.task_id을 반환합니다. 폴링 이미지 생성 작업 조회 data.statussuccess 또는 failure이 될 때까지. async 필드는 OpenAI 파라미터가 아니라 이 경로를 위한 CometAPI 확장 기능입니다. OpenAI는 GPT 이미지 모델용으로 streampartial_images을 문서화합니다. CometAPI 비동기 작업 모드는 JSON 작업 메타데이터를 반환하고 폴링을 사용합니다. 다음 문서화된 모델 ID에서 비동기 작업 모드를 사용하세요: gpt-image-2doubao-seedream-4-0-250828. 다른 이미지 모델에서는 해당 모델에 비동기 작업 지원이 문서화되어 있지 않은 한 동기 생성 또는 스트리밍을 사용하세요. 요청에 async: truestream: true이 모두 포함되면 비동기 작업 모드가 우선 적용됩니다. 생성 요청은 SSE 스트림 대신 JSON 작업 메타데이터를 반환합니다.

모델별 요청 동작

  • response_format 은 DALL·E 모델에만 적용되며, GPT 이미지 모델은 base64 데이터를 반환하고 이를 무시합니다
  • GPT 이미지 모델은 GPT-only 제어 기능으로 output_format, quality, backgroundoutput_compression을 사용합니다
  • quality 는 GPT 이미지 모델에서 low, medium, highauto을 허용하며, gpt-image-2.5-sunburstgpt-image-2.5-flarexhighmax을 허용합니다
  • output_compressionoutput_formatwebp 또는 jpeg일 때 적용되며, png에는 영향을 주지 않습니다
  • partial_imagesstreamtrue일 때만 적용됩니다
  • 최신 모델별 옵션은 OpenAI 이미지 생성 가이드를 따르세요
  • qwen-imagen > 1을 지원하지 않습니다

투명 배경 생성

배경 채우기 없이 분리된 피사체를 생성하려면 backgroundtransparent로 설정하세요. 이는 gpt-image-2.5-sunburstgpt-image-2.5-flare에서 지원됩니다. 투명도에는 알파 채널이 있는 출력 형식이 필요합니다. output_formatpng 또는 webp로 설정하세요. JPEG에는 알파 채널이 없으므로 output_format: "jpeg"을 사용한 투명 요청은 거부됩니다. 응답은 알파 채널이 포함된 base64 이미지 데이터를 b64_json으로 반환합니다. 파일을 저장하려면 이를 디코딩하세요:
단색 배경을 강제하려면 backgroundopaque로 설정하고, 모델이 결정하도록 하려면 auto로 설정하세요. 응답은 적용된 값을 최상위 background 필드에 반환합니다.
생성된 이미지는 제공업체 사용 정책을 준수해야 합니다. 불법적이거나 폭력적, 음란물 또는 저작권을 침해하는 프롬프트(Prompt)를 보내지 마세요.

인증

Authorization
string
header
필수

Bearer token authentication. Use your CometAPI key.

본문

application/json
model
string
기본값:gpt-image-2
필수

The image generation model to use. Choose a current model from the Models page.

prompt
string
필수

Text description of the image you want to generate.

예시:

"A paper boat floating on calm water at sunrise."

n
integer
기본값:1

Number of images to generate. Keep this at 1 for the broadest compatibility.

quality
string

Quality setting for models that support it. GPT image models accept low, medium, high, and auto. gpt-image-2.5-sunburst and gpt-image-2.5-flare also accept xhigh and max. dall-e-3 accepts standard and hd. See the OpenAI image generation guide for the latest model-specific values.

예시:

"low"

background
enum<string>

Background mode for the generated image. Set transparent to generate an isolated subject with no background fill; this requires output_format set to png or webp, and returns an error with jpeg. Set opaque for a solid background, or auto to let the model decide. Supported on gpt-image-2.5-sunburst and gpt-image-2.5-flare.

사용 가능한 옵션:
transparent,
opaque,
auto
output_compression
integer
기본값:100

Compression level for the output image, from 0 to 100. Applies when output_format is webp or jpeg. Lower values produce smaller files with more compression artifacts.

필수 범위: 0 <= x <= 100
moderation
enum<string>
기본값:auto

Content moderation level for GPT image models. low is less restrictive; auto is the default.

사용 가능한 옵션:
low,
auto
partial_images
integer

Number of partial images to emit while a streaming response is in progress, from 0 to 3. Each partial image arrives as an image_generation.partial_image event before the final image_generation.completed event. Applies when stream is true.

필수 범위: 0 <= x <= 3
size
string

Requested output size. Supported values depend on the selected model. See the OpenAI image generation guide for the latest model-specific ranges.

예시:

"1024x1024"

response_format
enum<string>

The response container for dall-e-2 and dall-e-3. This parameter is not supported for GPT image models, which return base64-encoded image data.

사용 가능한 옵션:
url,
b64_json
output_format
string

The encoded image type for GPT image model results, such as png, jpeg, or webp. See the OpenAI image generation guide for current GPT image output controls.

예시:

"jpeg"

stream
boolean
기본값:false

Set this to true to receive server-sent image generation events instead of waiting for the completed JSON response. Streaming responses use text/event-stream and can include final events such as image_generation.completed. When stream and async are both true, async task mode takes precedence and the create request returns JSON instead of a streaming image response.

async
boolean
기본값:false

CometAPI asynchronous task mode. Set this to true to return immediately with data.task_id, then poll GET /v1/images/generations/{task_id} for the final image data. Documented model IDs for this mode: gpt-image-2 and doubao-seedream-4-0-250828. This is a CometAPI extension, not an OpenAI parameter. When async and stream are both true, async takes precedence and returns JSON task metadata instead of an SSE stream.

응답

Image generation result. Synchronous requests return completed image data. Async requests return a task response with data.task_id.

created
integer
필수

Unix timestamp for the completed generation.

data
object[]
필수
background
string

Background mode returned by models that expose it.

output_format
string

Encoded image type returned by GPT image models.

quality
string

Quality level returned by models that expose it.

size
string

Output size returned by models that expose it.

usage
object

Token usage details when returned by the selected model.

마지막 수정일 2026년 9월 11일