图像生成
通过 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 创建图像参考。
先选择模型
- 当你想用
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.