Creare immagini Seedream
Usa CometAPI POST /v1/images/generations per la generazione di immagini Seedream con prompt testuali, immagini di riferimento, output di immagini sequenziale e task asincroni.
POST /v1/images/generations di CometAPI per eseguire la generazione di immagini Seedream. Questo endpoint supporta prompt text-to-image, richieste con immagini di riferimento e output di immagini sequenziale con limiti definiti quando il modello selezionato supporta questi controlli.
Questa pagina copre seedream-5-0-pro-260628 per richieste Pro text-to-image e seedream-5-0-260128 per esempi di immagini di riferimento, sequenziali e asincroni di Seedream 5.0. Per la disponibilità dell’account, consulta la pagina Models o interroga /v1/models. Per i dettagli sui parametri del provider, consulta la image generation API di BytePlus e il tutorial Seedream 4.0-5.0.
Scegliere una forma di richiesta
- Text to image: invia
model,prompt,sizee controlli di output opzionali comeresponse_format,output_formatewatermark. - Image to image: aggiungi
imagecome array di URL HTTPS pubblici o URI di dati. Usa un array anche quando invii una sola immagine di riferimento. - Prompt sequenziale: imposta
sequential_image_generationsuautoe usasequential_image_generation_options.max_imagescome limite superiore. Il modello può restituire meno immagini del massimo. - Task asincrono: aggiungi
async: truequando vuoi che la richiesta di creazione restituiscadata.task_idinvece di mantenere aperta la connessione HTTP.
max_images.Eseguire un task immagine asincrono
Impostaasync su true per i job immagine che il tuo client deve inviare e poi interrogare. La richiesta di creazione restituisce data.task_id; usa quel valore con Recuperare un task immagine Seedream finché data.status non è success o failure.
Usa 2K negli esempi asincroni per le richieste Seedream 5.0. Il supporto delle dimensioni varia in base al model ID, quindi scegli una dimensione supportata dal modello prima di inviare un task asincrono.
Inviare immagini di riferimento
Usadata:image/png;base64,YOUR_BASE64_IMAGE per i dati immagine inline, oppure usa un URL HTTPS pubblico che il provider possa recuperare. Gli esempi del riferimento API mostrano la forma JSON completa per ogni tipo di richiesta.
Leggere gli URL di output
Autorizzazioni
Bearer token authentication. Use your CometAPI key.
Corpo
Parameters for Seedream image generation. Send JSON for text-to-image, image-to-image, and sequential prompt requests.
Seedream model ID to use. Query /v1/models or open the Models page for available model IDs.
Text prompt describing the image or edit goal. Use a concrete visual request, such as a blue ceramic mug on a white table, soft studio lighting.
Response image format. Use url for a temporary signed image URL, or b64_json when you need base64 image data in the response.
url, b64_json Output resolution. Use a model-supported tier such as 2K or a model-supported WIDTHxHEIGHT value such as 2048x2048. Not every model ID accepts every tier.
Optional reference images for image-to-image generation. Each item can be a public HTTPS URL or a data URI such as data:image/png;base64,YOUR_BASE64_IMAGE. Use an array even for one image. Reference images plus generated images must not exceed the provider limit.
When true, requests a visible AI-generated watermark on the output image. Set false when your workflow handles disclosure separately.
CometAPI asynchronous task mode. Set this to true to return immediately with data.task_id, then poll the Seedream image task endpoint GET /v1/images/generations/{task_id} for the final image data.
Output image file format. Use png when you need lossless output, or jpeg for smaller files.
png, jpeg Optional prompt-adherence control for model versions that support it. Higher values can follow the prompt more closely but may reduce naturalness. Omit this field when you do not need model-specific tuning.
1 <= x <= 10Optional random seed for reproducible attempts on model versions that support seeding. Use -1 or omit the field for a random seed.
-1 <= x <= 2147483647Controls sequential prompt handling. Use auto to let the model return a sequence when the prompt calls for one. Use disabled for ordinary single-image requests.
auto, disabled Options for sequential prompt handling. This object is only used when sequential_image_generation is auto.
Risposta
Image generation response. Synchronous requests return completed image data. Async requests return a task response with data.task_id.
- Option 1
- Async task response
Unix timestamp in seconds when the image response was created.
Generated image results. The array can contain one or more images depending on the request and model response.
Usage information for the request. Fields vary by model and route.