画像生成
CometAPI で OpenAI の POST /v1/images/generations を使用してテキストプロンプトから画像を生成し、モデル固有の制御については公式の画像生成ガイドに従ってください。
このルートを使用すると、CometAPI 上で OpenAI 互換のリクエスト形式を使ってテキストから画像を生成できます。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.
公式リファレンス
background、output_compression、ストリーミング、または今後の GPT 画像オプションなどのモデル固有の制御に依存する前に、OpenAI image generation guideを確認してください。- 現在のパラメータ一覧については、OpenAI Create image referenceを使用してください。
まずモデルを選ぶ
response_formatを使ったシンプルな最初のリクエストが必要な場合はdall-e-3を使用しますoutput_format、quality、backgroundなどの GPT 専用の制御が必要な場合は GPT 画像モデルを使用します- そのプロバイダーを特に使う必要がある場合は
qwen-imageを使用しますが、nは 1 のままにしてください
安全な最初のリクエスト
dall-e-3から始めますsizeは1024x1024のままにします- 小さな JSON レスポンスと一時的なダウンロード URL が必要な場合は
response_format: "url"を設定します - GPT 画像モデルのパラメータが必要な場合は、API リファレンス内の検証済み GPT リクエスト例を使用してください
jpegなど特定のエンコード済み画像タイプが必要な場合にのみoutput_formatを追加しますbackground、output_compression、またはストリーミングを追加する前に、OpenAI image generation guide を確認してください- バッチ生成やスタイル調整を追加する前に、1 つのプロンプトと 1 枚の出力画像で試してください
モデル固有のリクエスト動作
response_formatはdall-e-2とdall-e-3に適用されます- GPT 画像モデルは、
output_format、quality、background、output_compressionなどの GPT 専用の制御を使用します - 最新のモデル固有オプションについては、OpenAI image generation guide に従ってください
qwen-imageはn > 1をサポートしていません
承認
Bearer token authentication. Use your CometAPI key.
ボディ
The image generation model to use. Choose a current model from the Models page.
Text description of the image you want to generate.
"A paper boat floating on calm water at sunrise."
Number of images to generate. Keep this at 1 for the broadest compatibility.
Quality setting for models that support it. See the OpenAI image generation guide for the latest model-specific values.
Requested output size. Supported values depend on the selected model. See the OpenAI image generation guide for the latest model-specific ranges.
"1024x1024"
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 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"
レスポンス
Image generation result.
Unix timestamp for the completed generation.
Background mode returned by models that expose it.
Encoded image type returned by GPT image models.
Quality level returned by models that expose it.
Output size returned by models that expose it.