メインコンテンツへスキップ
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 互換のリクエスト形式を使ってテキストから画像を生成できます。

公式リファレンス

  • backgroundoutput_compression、ストリーミング、または今後の GPT 画像オプションなどのモデル固有の制御に依存する前に、OpenAI image generation guideを確認してください。
  • 現在のパラメータ一覧については、OpenAI Create image referenceを使用してください。

まずモデルを選ぶ

  • response_format を使ったシンプルな最初のリクエストが必要な場合は dall-e-3 を使用します
  • output_formatqualitybackground などの GPT 専用の制御が必要な場合は GPT 画像モデルを使用します
  • そのプロバイダーを特に使う必要がある場合は qwen-image を使用しますが、n は 1 のままにしてください

安全な最初のリクエスト

  • dall-e-3 から始めます
  • size1024x1024 のままにします
  • 小さな JSON レスポンスと一時的なダウンロード URL が必要な場合は response_format: "url" を設定します
  • GPT 画像モデルのパラメータが必要な場合は、API リファレンス内の検証済み GPT リクエスト例を使用してください
  • jpeg など特定のエンコード済み画像タイプが必要な場合にのみ output_format を追加します
  • backgroundoutput_compression、またはストリーミングを追加する前に、OpenAI image generation guide を確認してください
  • バッチ生成やスタイル調整を追加する前に、1 つのプロンプトと 1 枚の出力画像で試してください

モデル固有のリクエスト動作

  • response_formatdall-e-2dall-e-3 に適用されます
  • GPT 画像モデルは、output_formatqualitybackgroundoutput_compression などの GPT 専用の制御を使用します
  • 最新のモデル固有オプションについては、OpenAI image generation guide に従ってください
  • qwen-imagen > 1 をサポートしていません
生成された画像は、プロバイダーの利用ポリシーに準拠している必要があります。違法、暴力的、ポルノ的、または著作権を侵害するプロンプトを送信しないでください。

承認

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.