Tworzenie obrazów Seedream
Używaj CometAPI POST /v1/images/generations do generowania obrazów Seedream z promptami tekstowymi, obrazami referencyjnymi, sekwencyjnym generowaniem obrazów i zadaniami asynchronicznymi.
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,sizeoraz opcjonalne ustawienia wyjścia, takie jakresponse_format,output_formatiwatermark. - Image to image: dodaj
imagejako 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_generationnaautoi użyjsequential_image_generation_options.max_imagesjako 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łodata.task_idzamiast utrzymywać otwarte połączenie HTTP.
max_images.Uruchom asynchroniczne zadanie obrazu
Ustawasync 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żywajdata: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
Autoryzacje
Bearer token authentication. Use your CometAPI key.
Treść
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.
Odpowiedź
Image generation response. Synchronous requests return completed image data. Async requests return a task response with data.task_id.
- Option 1
- Async task response