Skip to main content
POST
CometAPI の OpenAI 互換 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: modelpromptsize、および response_formatoutput_formatwatermark などの任意の出力制御を送信します。
  • Image to image: image を公開 HTTPS URL または data URI の配列として追加します。参照画像を 1 枚だけ送る場合でも配列を使用してください。
  • Sequential prompt: sequential_image_generationauto に設定し、sequential_image_generation_options.max_images を上限として使用します。model は最大値より少ない画像数を返す場合があります。
  • Async task: 作成リクエストで HTTP 接続を開いたままにせず、代わりに data.task_id を返したい場合は async: true を追加します。
参照画像と生成画像の合計は、プロバイダーの上限内に収める必要があります。連続リクエストは max_images で上限を設定してください。

非同期画像タスクを実行する

クライアントが送信してポーリングすべき画像ジョブには、asynctrue に設定します。作成リクエストは data.task_id を返します。その値を Retrieve a Seedream image task で使用し、data.statussuccess または failure になるまで確認してください。 非同期の例では、Seedream 5.0 リクエストに 2K を使用します。サポートされるサイズは model ID によって異なるため、非同期タスクを送信する前に、その model でサポートされているサイズを選択してください。

参照画像を送信する

インライン画像データには data:image/png;base64,YOUR_BASE64_IMAGE を使用するか、プロバイダーが取得できる公開 HTTPS URL を使用します。API リファレンスの例では、各リクエストタイプの完全な JSON 形式を示しています。

出力 URL を読む

返される url は署名付きオブジェクトストレージリンクであり、&%、その他の特殊文字を含む場合があります。端末の行を部分的にコピーするのではなく、解析済み JSON から URL を抽出してください。シェルの例では、jq -r '.data[]?.url' により完全な署名付き URL を保持できます。

承認

Authorization
string
header
必須

Bearer token authentication. Use your CometAPI key.

ボディ

application/json

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

model
string
デフォルト:seedream-5-0-pro-260628
必須

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

prompt
string
デフォルト:A clean product-style render of a blue ceramic mug on a white table, soft studio lighting.
必須

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>
デフォルト:url

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
size
string
デフォルト: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
デフォルト:false

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

async
boolean
デフォルト: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>
デフォルト:png

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

利用可能なオプション:
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.

必須範囲: 1 <= x <= 10
seed
integer
デフォルト:-1

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

必須範囲: -1 <= x <= 2147483647
sequential_image_generation
enum<string>
デフォルト: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.

利用可能なオプション:
auto,
disabled
sequential_image_generation_options
object

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

レスポンス

200 - application/json

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

created
integer
必須

Unix timestamp in seconds when the image response was created.

data
object[]
必須

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.