Skip to main content
POST
Usa la route OpenAI-compatible 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, size e controlli di output opzionali come response_format, output_format e watermark.
  • Image to image: aggiungi image come 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_generation su auto e usa sequential_image_generation_options.max_images come limite superiore. Il modello può restituire meno immagini del massimo.
  • Task asincrono: aggiungi async: true quando vuoi che la richiesta di creazione restituisca data.task_id invece di mantenere aperta la connessione HTTP.
Le immagini di riferimento più le immagini generate devono rimanere entro il limite del provider. Mantieni limitate le richieste sequenziali con max_images.

Eseguire un task immagine asincrono

Imposta async 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

Usa data: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

L’url restituito è un link firmato di object storage e può contenere &, % e altri caratteri speciali. Estrai l’URL dal JSON già analizzato invece di copiare una riga parziale del terminale. Negli esempi shell, jq -r '.data[]?.url' preserva l’URL firmato completo.

Autorizzazioni

Authorization
string
header
obbligatorio

Bearer token authentication. Use your CometAPI key.

Corpo

application/json

Parameters for Seedream image generation. Send JSON for text-to-image, image-to-image, and sequential prompt requests.

model
string
predefinito:seedream-5-0-pro-260628
obbligatorio

Seedream model ID to use. Query /v1/models or open the Models page for available model IDs.

prompt
string
predefinito:A clean product-style render of a blue ceramic mug on a white table, soft studio lighting.
obbligatorio

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_format
enum<string>
predefinito:url

Response image format. Use url for a temporary signed image URL, or b64_json when you need base64 image data in the response.

Opzioni disponibili:
url,
b64_json
size
string
predefinito:2K

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.

image
string[]

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.

watermark
boolean
predefinito:false

When true, requests a visible AI-generated watermark on the output image. Set false when your workflow handles disclosure separately.

async
boolean
predefinito:false

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_format
enum<string>
predefinito:png

Output image file format. Use png when you need lossless output, or jpeg for smaller files.

Opzioni disponibili:
png,
jpeg
guidance_scale
number

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.

Intervallo richiesto: 1 <= x <= 10
seed
integer
predefinito:-1

Optional random seed for reproducible attempts on model versions that support seeding. Use -1 or omit the field for a random seed.

Intervallo richiesto: -1 <= x <= 2147483647
sequential_image_generation
enum<string>
predefinito:disabled

Controls 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.

Opzioni disponibili:
auto,
disabled
sequential_image_generation_options
object

Options for sequential prompt handling. This object is only used when sequential_image_generation is auto.

Risposta

200 - application/json

Image generation response. Synchronous requests return completed image data. Async requests return a task response with data.task_id.

created
integer
obbligatorio

Unix timestamp in seconds when the image response was created.

data
object[]
obbligatorio

Generated image results. The array can contain one or more images depending on the request and model response.

usage
object

Usage information for the request. Fields vary by model and route.