메인 콘텐츠로 건너뛰기
POST
/
v1
/
images
/
generations
curl --request POST \
  --url https://api.cometapi.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-image-2",
  "prompt": "A paper boat floating on calm water at sunrise."
}
'
{
  "created": 1776841943,
  "background": "opaque",
  "output_format": "jpeg",
  "quality": "low",
  "size": "1024x1024",
  "usage": {
    "input_tokens": 16,
    "input_tokens_details": {
      "image_tokens": 0,
      "text_tokens": 16
    },
    "output_tokens": 208,
    "total_tokens": 224
  },
  "data": [
    {
      "b64_json": "<base64-image-data>"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

이 경로를 사용하면 CometAPI에서 OpenAI 호환 요청 형식으로 텍스트로부터 이미지를 생성할 수 있습니다.

공식 레퍼런스

먼저 모델 선택하기

  • response_format으로 간단한 첫 요청을 보내려면 dall-e-3를 사용하세요
  • output_format, quality, background와 같은 GPT 전용 제어가 필요하면 GPT 이미지 모델을 사용하세요
  • 해당 provider가 특별히 필요하다면 qwen-image를 사용하되, n은 1로 유지하세요

안전한 첫 요청

  • dall-e-3로 시작하세요
  • size1024x1024로 유지하세요
  • 작은 JSON 응답과 임시 다운로드 URL이 필요하면 response_format: "url"로 설정하세요
  • GPT 이미지 모델 파라미터가 필요하면 API 레퍼런스의 검증된 GPT 요청 예제를 사용하세요
  • jpeg와 같은 특정 인코딩 이미지 형식이 필요할 때만 output_format을 추가하세요
  • background, output_compression 또는 스트리밍을 추가하기 전에 OpenAI 이미지 생성 가이드를 확인하세요
  • 배치 생성이나 스타일 튜닝을 추가하기 전에 프롬프트 하나와 출력 이미지 하나로 먼저 사용해 보세요

모델별 요청 동작

  • response_formatdall-e-2dall-e-3에 적용됩니다
  • GPT 이미지 모델은 output_format, quality, background, output_compression과 같은 GPT 전용 제어를 사용합니다
  • 최신 모델별 옵션은 OpenAI 이미지 생성 가이드를 따르세요
  • qwen-imagen > 1을 지원하지 않습니다
생성된 이미지는 provider 사용 정책을 준수해야 합니다. 불법적이거나 폭력적이거나 음란하거나 저작권을 침해하는 프롬프트를 보내지 마세요.

인증

Authorization
string
header
필수

Bearer token authentication. Use your CometAPI key.

본문

application/json
model
string
기본값:dall-e-3
필수

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. See the OpenAI image generation guide for the latest model-specific values.

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"

응답

200 - application/json

Image generation result.

created
integer
필수

Unix timestamp for the completed generation.

usage
object
필수
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.