Seedream 画像を生成する
CometAPI の POST /v1/images/generations を使用して、テキストプロンプト、参照画像、連続画像出力、非同期タスクによる Seedream 画像生成を行います。
POST /v1/images/generations ルートを使用して、Seedream 画像生成を実行できます。このエンドポイントは、テキストから画像へのプロンプト、参照画像を使ったリクエスト、および選択した model がこれらの制御をサポートしている場合の、上限付き連続画像出力をサポートします。
このページでは、Pro のテキストから画像へのリクエスト向けの seedream-5-0-pro-260628 と、Seedream 5.0 の参照画像、連続生成、非同期の例向けの seedream-5-0-260128 を扱います。アカウントで利用可能かどうかについては、Models page を参照するか、/v1/models をクエリしてください。プロバイダーのパラメータ詳細については、BytePlus の image generation API および Seedream 4.0-5.0 tutorial を参照してください。
リクエスト形式を選ぶ
- Text to image:
model、prompt、size、およびresponse_format、output_format、watermarkなどの任意の出力制御を送信します。 - Image to image:
imageを公開 HTTPS URL または data URI の配列として追加します。参照画像を 1 枚だけ送る場合でも配列を使用してください。 - Sequential prompt:
sequential_image_generationをautoに設定し、sequential_image_generation_options.max_imagesを上限として使用します。model は最大値より少ない画像数を返す場合があります。 - Async task: 作成リクエストで HTTP 接続を開いたままにせず、代わりに
data.task_idを返したい場合はasync: trueを追加します。
max_images で上限を設定してください。非同期画像タスクを実行する
クライアントが送信してポーリングすべき画像ジョブには、async を true に設定します。作成リクエストは data.task_id を返します。その値を Retrieve a Seedream image task で使用し、data.status が success または failure になるまで確認してください。
非同期の例では、Seedream 5.0 リクエストに 2K を使用します。サポートされるサイズは model ID によって異なるため、非同期タスクを送信する前に、その model でサポートされているサイズを選択してください。
参照画像を送信する
インライン画像データにはdata:image/png;base64,YOUR_BASE64_IMAGE を使用するか、プロバイダーが取得できる公開 HTTPS URL を使用します。API リファレンスの例では、各リクエストタイプの完全な JSON 形式を示しています。
出力 URL を読む
承認
Bearer token authentication. Use your CometAPI key.
ボディ
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.
レスポンス
Image generation response. Synchronous requests return completed image data. Async requests return a task response with data.task_id.
- Option 1
- Async task response