Skip to main content
POST
Użyj zgodnej z OpenAI trasy POST /v1/images/generations w CometAPI, aby uruchomić generowanie obrazów Seedream. Ten endpoint obsługuje prompty text-to-image, żądania z obrazami referencyjnymi oraz ograniczone sekwencyjne generowanie obrazów, gdy wybrany model obsługuje te mechanizmy. Ta strona opisuje seedream-5-0-pro-260628 dla żądań Pro text-to-image oraz seedream-5-0-260128 dla przykładów obrazów referencyjnych, sekwencyjnych i asynchronicznych w Seedream 5.0. Informacje o dostępności na koncie znajdziesz na stronie Models albo wysyłając zapytanie do /v1/models. Szczegóły parametrów dostawcy znajdziesz w BytePlus image generation API oraz tutorialu Seedream 4.0-5.0.

Wybierz strukturę żądania

  • Text to image: wyślij model, prompt, size oraz opcjonalne ustawienia wyjścia, takie jak response_format, output_format i watermark.
  • Image to image: dodaj image jako tablicę publicznych adresów HTTPS URL lub data URI. Używaj tablicy nawet wtedy, gdy wysyłasz jeden obraz referencyjny.
  • Sequential prompt: ustaw sequential_image_generation na auto i użyj sequential_image_generation_options.max_images jako górnej granicy. Model może zwrócić mniej obrazów niż maksymalna liczba.
  • Async task: dodaj async: true, jeśli chcesz, aby żądanie utworzenia zwracało data.task_id zamiast utrzymywać otwarte połączenie HTTP.
Obrazy referencyjne razem z wygenerowanymi obrazami muszą mieścić się w limicie dostawcy. Ograniczaj żądania sekwencyjne za pomocą max_images.

Uruchom asynchroniczne zadanie obrazu

Ustaw async na true dla zadań obrazów, które klient ma wysyłać i odpytywać. Żądanie utworzenia zwraca data.task_id; użyj tej wartości z Pobierz zadanie obrazu Seedream, aż data.status będzie mieć wartość success lub failure. W przykładach asynchronicznych dla żądań Seedream 5.0 używaj 2K. Obsługa rozmiarów zależy od model ID, więc przed wysłaniem zadania asynchronicznego wybierz rozmiar obsługiwany przez model.

Wyślij obrazy referencyjne

Używaj data:image/png;base64,YOUR_BASE64_IMAGE dla danych obrazu inline albo publicznego adresu HTTPS URL, który dostawca może pobrać. Przykłady w dokumentacji API pokazują pełną strukturę JSON dla każdego typu żądania.

Odczytuj adresy URL wyników

Zwracany url jest podpisanym linkiem do object storage i może zawierać &, % oraz inne znaki specjalne. Wyodrębnij URL z przetworzonego JSON zamiast kopiować niepełną linię z terminala. W przykładach shell jq -r '.data[]?.url' zachowuje pełny podpisany URL.

Autoryzacje

Authorization
string
header
wymagane

Bearer token authentication. Use your CometAPI key.

Treść

application/json

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

model
string
domyślnie:seedream-5-0-pro-260628
wymagane

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

prompt
string
domyślnie:A clean product-style render of a blue ceramic mug on a white table, soft studio lighting.
wymagane

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>
domyślnie:url

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

Dostępne opcje:
url,
b64_json
size
string
domyślnie: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
domyślnie:false

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

async
boolean
domyślnie: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>
domyślnie:png

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

Dostępne opcje:
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.

Wymagany zakres: 1 <= x <= 10
seed
integer
domyślnie:-1

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

Wymagany zakres: -1 <= x <= 2147483647
sequential_image_generation
enum<string>
domyślnie: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.

Dostępne opcje:
auto,
disabled
sequential_image_generation_options
object

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

Odpowiedź

200 - application/json

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

created
integer
wymagane

Unix timestamp in seconds when the image response was created.

data
object[]
wymagane

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.