Tạo ảnh
Sử dụng CometAPI với OpenAI POST /v1/images/generations để tạo ảnh từ Prompt văn bản và làm theo hướng dẫn tạo ảnh chính thức cho các tùy chọn điều khiển theo từng model.
Sử dụng route này để tạo ảnh từ văn bản với cấu trúc request tương thích OpenAI trên CometAPI.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.
Tài liệu tham khảo chính thức
- Hãy đọc hướng dẫn tạo ảnh của OpenAI trước khi bạn dựa vào các tùy chọn điều khiển theo từng model như
background,output_compression, streaming hoặc các tùy chọn ảnh GPT trong tương lai. - Sử dụng tài liệu tham chiếu OpenAI Create image để xem danh sách tham số hiện tại.
Chọn model trước
- Dùng
dall-e-3khi bạn muốn có request đầu tiên đơn giản vớiresponse_format - Dùng model ảnh GPT khi bạn cần các tùy chọn chỉ có ở GPT như
output_format,qualityhoặcbackground - Dùng
qwen-imagekhi bạn cần đúng provider đó, nhưng giữnở mức 1
Request đầu tiên an toàn
- Bắt đầu với
dall-e-3 - Giữ
sizelà1024x1024 - Đặt
response_format: "url"nếu bạn muốn phản hồi JSON nhỏ gọn và một URL tải xuống tạm thời - Sử dụng ví dụ request GPT đã được xác thực trong tài liệu tham chiếu API nếu bạn cần các tham số của model ảnh GPT
- Chỉ thêm
output_formatkhi bạn cần một kiểu ảnh được mã hóa cụ thể nhưjpeg - Kiểm tra hướng dẫn tạo ảnh của OpenAI trước khi bạn thêm
background,output_compressionhoặc streaming - Dùng một Prompt và một ảnh đầu ra trước khi bạn thêm tạo hàng loạt hoặc tinh chỉnh phong cách
Hành vi request theo từng model
response_formatáp dụng chodall-e-2vàdall-e-3- Các model ảnh GPT dùng các tùy chọn chỉ có ở GPT như
output_format,quality,backgroundvàoutput_compression - Làm theo hướng dẫn tạo ảnh của OpenAI để biết các tùy chọn mới nhất theo từng model
qwen-imagekhông hỗ trợn > 1
Ủy quyền
Bearer token authentication. Use your CometAPI key.
Nội dung
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"
Phản hồi
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.