圖片生成
在 CometAPI 上搭配 OpenAI 的 POST /v1/images/generations 從文字 Prompt 建立圖片,並遵循官方圖片生成指南以使用模型特定控制項。
使用此路由可在 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 圖片生成指南。 - 目前的參數清單請使用 OpenAI Create image 參考文件。
先選擇模型
- 當你想用
response_format發送一個簡單的首次請求時,請使用dall-e-3 - 當你需要僅限 GPT 的控制項(例如
output_format、quality或background)時,請使用 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 圖片生成指南 - 在加入批次生成或風格調整之前,先使用單一 Prompt 與單一輸出圖片
模型特定的請求行為
response_format適用於dall-e-2與dall-e-3- GPT 圖片模型使用僅限 GPT 的控制項,例如
output_format、quality、background與output_compression - 模型特定的最新選項請遵循 OpenAI 圖片生成指南
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.