> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# GPT Image 2.5 Sunburst Standard

POST https://api.beatapi.io/v1/images/tasks
Content-Type: application/json

テキストと最大 16 枚の参照画像から、1K・2K・4K、または正確なピクセルサイズの画像を生成または編集します。生成ごとに実際に使ったトークンで課金され、`quality` で出力トークン数を設定できます。- トークン課金です。テキスト入力、画像入力、出力のトークンを、それぞれ 100 万トークンあたりの単価で計算します。下の 1 枚あたりの価格は `medium` 品質での見積もりです。
- `quality` は 1 回の生成で使う出力トークン数を決め、そのまま価格を決めます。低い値ほど安くなります。省略すると `medium` です。
- 非同期のみです。`POST /v1/images/tasks` でタスクを作成し、`GET /v1/tasks/{task_id}` をポーリングします。生成は BeatAPI 側で行うため、時間のかかる生成でも接続を占有しません。このモデルでは同期の `POST /v1/images/generations` は使えません。
- 1 タスクにつき画像は 1 枚です。複数枚が必要な場合は、複数のタスクを作成してください。
- テキストから画像を生成するほか、公開 HTTPS リンクで指定した最大 16 枚の参照画像を編集・合成できます。
- 画面の形は `resolution` と `aspect_ratio` で指定するか、`1536x1024` のような正確な `size` 1 つで指定します。両方を同時に使うことはできません。これはトークン課金で提供する [`gpt-image-2.5-sunburst`](/image-api/gpt-image-2-5-sunburst) です。モデルとリクエストは同じで、フィールド、解像度、アスペクト比、参照画像もすべて共通です。`gpt-image-2.5-sunburst` は画像 1 枚ごとの固定価格、`gpt-image-2.5-sunburst-std` は生成ごとに実際に使ったトークンに対する課金です。`quality` も指定できます。[料金を見る](https://beatapi.io/ja/pricing)。POST/v1/images/tasks試してみるこのモデルをテスト画面で開きます。BeatAPI の API キーを入力するとタスクを作成できます。実際に呼び出され、ご自身の残高から課金されます。## モデル ID固定価格のモデルとこのモデルは同じリクエストを受け付けます。違うのは `quality` と価格の数え方だけです。下の値はゲートウェイの契約からそのまま取っています。| モデル ID                           | `resolution`     | `quality`                               | `images` の最大数 | 価格                                                         |
| -------------------------------- | ---------------- | --------------------------------------- | ------------- | ---------------------------------------------------------- |
| `gpt-image-2.5-sunburst`         | `1K`, `2K`, `4K` | —                                       | 16            | サイズ区分ごとに画像 1 枚あたりの固定価格です。`quality` は受け付けません。               |
| **`gpt-image-2.5-sunburst-std`** | `1K`, `2K`, `4K` | `low`, `medium`, `high`, `xhigh`, `max` | 16            | 生成で使ったトークンを 100 万トークンあたりの単価で課金します。`quality` が出力トークン数を決めます。 |## エンドポイントと認証`POST https://api.beatapi.io/v1/images/tasks`Authorization
string
必須BeatAPI の API キーを `Bearer <BEATAPI_API_KEY>` の形式で送信します。キーは[ダッシュボード](https://beatapi.io/dashboard)で作成できます。キーはサーバー側で保管し、ブラウザーやモバイルアプリに含めないでください。ボディは JSON で送信し、`Content-Type: application/json` を指定します。`Idempotency-Key` は任意です。論理的に 1 件のリクエストごとに一意の値（255 文字以内）を送り、まったく同じボディを再試行するときだけ再利用してください。24 時間以内に同じキーと同じボディで再試行すると、最初のレスポンスが `Idempotent-Replayed: true` 付きで再度返されます。同じキーで異なるボディを送ると `409 idempotency_conflict` が返ります。2xx 以外のレスポンスは保存されないため、400 や 402 の後の再試行は改めて実行されます。## リクエストの流れ下記のパラメーターをエンドポイントに `POST` します。`201` が返れば、タスクが受け付けられ、料金が残高から仮確保されたことを意味します。処理はバックグラウンドで実行されます。`data.id` を保存してください。`GET /v1/tasks/{task_id}` を呼び出し、`status` が `succeeded` または `failed` になるまで、呼び出しの間隔を `data.poll_after_seconds`（画像は 5 秒、動画は 8 秒）だけ空けてください。あるいは `task.succeeded` と `task.failed` の[Webhook](/webhooks)を登録することもできます。処理タイムアウトで停止したタスクはイベントを送信しないため、フォールバックとしてポーリングも続けてください。`succeeded` の場合は、すべての `data.output.media[].url` をダウンロードし、必要なファイルを保存してください。結果 URL がいつまで利用できるかは保証されません。`failed` の場合は、`data.error_code` と `data.error_message` を確認してください。仮確保された金額は残高に戻されます。`data.retryable` は、同じリクエストをもう一度送れば成功する可能性があるかどうかを示します。## 入力モード| モード      | 必須の入力                     | 備考                                                              |
| -------- | ------------------------- | --------------------------------------------------------------- |
| テキストから画像 | `model`、`prompt`          | `images` は省略してください。                                             |
| 画像の編集・合成 | `model`、`prompt`、`images` | 公開 HTTPS の画像リンクを 1～16 個指定します。変更・維持・合成したい内容を `prompt` に記述してください。 |## リクエストパラメーターmodel
string
必須実行するモデルです。**値**：`gpt-image-2.5-sunburst-std`**値が正しくない場合**- 指定がない場合：`"model" is required`
- 不明なモデル ID の場合：`"model" gpt-image-9 is not catalogued`
- 動画モデルをこのエンドポイントに送った場合：`"model" seedance-2.5 is served by POST /v1/videos/tasks, not this endpoint`prompt
string
必須描きたい内容、または参照画像に加えたい変更です。被写体、スタイル、照明、構図、画像内に表示したい文字などを、普通の言葉で書くのが最適です。**長さ**：1–5000 文字- 長さは文字数で数えます（CJK 文字も 1 文字として数えます）。
- `images` を送る場合は、どの画像が何の役割かを書いてください。たとえば「1 枚目の画像を商品に、2 枚目の画像を背景に使う」のように指定します。**値が正しくない場合**- 指定がない場合：`"prompt" is required`
- 空、または上限を超える長さの場合：`"prompt" has an unsupported length`
- 文字列でない場合：`"prompt" must be a string`images
string[]
任意編集または合成する参照画像です。このフィールドを送ると、リクエストはテキストからの画像生成ではなく、画像編集として扱われます。**要素数**：1–16  \
各要素は公開されている `https://` の URL です。ローカルファイルは先に [アップロード](/quick-guide#upload-an-input-file)（`POST /v1/files`）し、返された `data.url` を渡してください。- 各リンクは、公開 HTTPS で画像ファイルそのもの（PNG、JPEG、WebP）を返し、サイズが 50 MB 以下である必要があります。ゲートウェイは、タスクを作成する前に、すべてのリンクの先頭バイトをダウンロードし、ファイル名や `Content-Type` ではなく、そのバイト列から形式を判定します。
- Web ページ、ログインが必要なページ、期限切れの署名付き URL、ホットリンク保護のあるホストへのリンクは、画像を返さないため拒否されます。
- エラーメッセージ中の位置は 0 始まりです。`images[0]` は 1 番目のリンクを指します。**値が正しくない場合**- 最大数を超えた場合：`"images" accepts at most 16 items`
- 空の配列の場合：`"images" requires at least 1 item`
- https\:// のリンクでない場合：`"images[0]" must be a public HTTPS URL`
- プライベートまたは安全でないアドレスの場合：`"images[0]" must be a publicly reachable HTTPS image URL`
- ホストが 4xx エラーを返した場合：`"images[0]" could not be downloaded: the URL returned HTTP 404`
- リンクが PNG、JPEG、WebP 以外を返した場合：`"images[0]" is not a PNG, JPEG or WebP image: the URL returned text/html`
- 50 MB を超える場合：`"images[2]" is 63.4 MB; images must be 50 MB or smaller`**例**```json
"images": [
  "https://cdn.beatapi.io/samples/smart-bottle.png",
  "https://cdn.beatapi.io/samples/neon-singer.png"
]
```aspect_ratio
string
任意デフォルト: auto画像の形を「幅:高さ」で指定します。`resolution` と一緒に送るか、両方を省略して `size` を送ってください。**指定できる値**：`auto`, `1:1`, `3:2`, `2:3`, `4:3`, `3:4`, `5:4`, `4:5`, `16:9`, `9:16`, `2:1`, `1:2`, `3:1`, `1:3`, `21:9`, `9:21`  \
**デフォルト**：`auto`- デフォルトは `auto` なので、このフィールドを省略したリクエストも正方形で描画されます。
- `2:1`、`1:2`、`3:1`、`1:3`、`21:9`、`9:21` といったパノラマ形状も指定できます。最も横長または縦長のフレームは 3:1 です。
- `size` と同時には使えません。`auto` は「参照画像の形に従う」という意味ではありません。`images` の有無にかかわらず、選択した `resolution` の正方形のフレームを要求します。編集結果を別の形にしたい場合は、比率を指定するか、`size` を送ってください。**値が正しくない場合**- 一覧にない値の場合：`"aspect_ratio" must be one of: [auto 1:1 3:2 2:3 4:3 3:4 5:4 4:5 16:9 9:16 2:1 1:2 3:1 1:3 21:9 9:21]`
- `size` と同時に送った場合：`"size" already fixes the output; do not send "aspect_ratio" with it`resolution
string
任意デフォルト: 1K画像のサイズ区分です。区分が高いほど画像は大きくなり、料金も上がります。正確なピクセルサイズは `aspect_ratio` に依存し、モデルが決定します。**指定できる値**：`1K`, `2K`, `4K`  \
**デフォルト**：`1K`- 大文字の K を使ってください。`2k` は拒否されます。
- このページでは、区分ごとの正確なピクセル寸法は保証しません。正確なフレームが必要な場合は `size` を送ってください。
- `size` と同時には使えません。`size` は独自のサイズを持ちます。**値が正しくない場合**- 一覧にない値の場合：`"resolution" must be one of: [1K 2K 4K]`
- `size` と同時に送った場合：`"size" already fixes the output; do not send "resolution" with it`size
string
任意ピクセル単位の正確な出力サイズを `WIDTHxHEIGHT` の形式で指定します。例：`1536x1024`。`resolution` と `aspect_ratio` の代わりになります。- 両方の辺が 16 の倍数で、16～3840 px の範囲内である必要があります。
- 合計ピクセル数は 655,360～8,294,400 の範囲内で、長辺は短辺の 3 倍以下にしてください。
- 区切り文字には `x`、`X`、`×` を使えます。前後のスペースは無視されます。
- ピクセル数は出力トークン数を変え、そのまま価格を変えます。タスクの精算までは、ピクセル数が該当する区分の見積もりが予約されます。2,097,152 ピクセル以下は 1K、5,898,240 以下は 2K、それを超えると 4K です。
- `resolution` や `aspect_ratio` は、デフォルト値であっても一緒に送らないでください。`size` は送信した値のとおりに検証されますが、納品される画像のピクセル数がその値と完全に一致することは、このページでは保証しません。正確な寸法がパイプラインに必要な場合は、保存されたファイルを読み取ってください。**値が正しくない場合**- 文字列でない場合：`"size" must be a string`
- WIDTHxHEIGHT の形式でない場合（数字だけ、`auto`、カンマなど）：`"size" must be WIDTHxHEIGHT in pixels, for example 1536x1024`
- 辺が 16 の倍数でない場合：`"size" width and height must be multiples of 16`
- 辺が 16 未満または 3840 を超える場合：`"size" edges must be between 16 and 3840 pixels`
- ピクセル数が少なすぎる、または多すぎる場合：`"size" must have between 655,360 and 8,294,400 pixels; 512x512 has 262,144`
- 3:1 より横長または縦長の場合：`"size" must not be wider or taller than 3:1`
- `resolution` と同時に送った場合：`"size" already fixes the output; do not send "resolution" with it`
- `aspect_ratio` と同時に送った場合：`"size" already fixes the output; do not send "aspect_ratio" with it`**例**```json
"size": "1536x1024"
```quality
string
任意デフォルト: mediumモデルが画像にかける手間の度合いです。1 回の生成で使う出力トークン数を決め、そのまま価格を決めます。低い値ほど安く、高い値ほど高くなります。**指定できる値**：`low`, `medium`, `high`, `xhigh`, `max`  \
**デフォルト**：`medium`- 省略すると `medium` になります。このページの 1 枚あたりの価格は、この品質での見積もりです。
- 固定価格の [`gpt-image-2.5-sunburst`](/image-api/gpt-image-2-5-sunburst) はこのフィールドを受け付けず、送ると拒否されます。**値が正しくない場合**- 一覧にない値の場合：`"quality" must be one of: [low medium high xhigh max]`**例**```json
"quality": "low"
```background
string
任意デフォルト: auto画像の背景を塗りつぶすか、透明にするかを指定します。**指定できる値**：`auto`, `opaque`, `transparent`  \
**デフォルト**：`auto`- `auto`（デフォルト）は、モデルが選びます。`opaque` は塗りつぶされた背景を要求します。
- `transparent` は、背景に色のない画像を要求します。結果はアルファチャンネル付きの PNG になります。`output.media[].mime_type` で確認してください。**値が正しくない場合**- 一覧にない値の場合：`"background" must be one of: [auto opaque transparent]`ゲートウェイはタスク作成前に、次の組み合わせも確認します。- `size` は `幅x高さ` で指定し、`resolution` と `aspect_ratio` の代わりに使用します。各辺は 16 の倍数で 16～3840 ピクセル、総画素数は 655,360～8,294,400、長辺と短辺の比は 3:1 以下です。
- `size` は生成で実際に使ったトークンで課金され、サイズ区分では課金されません。
- `quality` は出力トークン数を決め、そのまま価格を決めます。既定値は `medium` です。
- 生成ごとに実際に使ったトークン数（テキスト入力、画像入力、出力）を表示価格の単価で課金します。記載の 1 枚あたりの価格は medium 品質での見積もりです。
- これは公式版で、トークン課金です。`quality` に `low`、`medium`、`high`、`xhigh`、`max` を指定できます。1 枚固定料金の `gpt-image-2.5-sunburst` では使えません。## 入力メディアの上限ゲートウェイはタスク作成前にすべての入力を読み取り、次の上限を超えるものは、その入力を示す `400 bad_request` で拒否します。課金はされません。- 参照画像：PNG、JPEG、WebP。ファイルの内容から判定されます。1 件あたり 50 MB 以下（10 進の MB。ホストがサイズを申告した場合に確認されます）で、リンクは 1～16 個です。GIF、HEIC、SVG は拒否されます。
- 参照画像そのもののピクセル数やアスペクト比の上限は確認されません。
- ホストが時間内に応答しない場合、そのリンクは作成時には拒否されません。ゲートウェイはタスクのディスパッチ時に再度取得を試み、それでも取得できないリンクがあるとタスクは失敗し、返金されます。
- ローカルファイルは `POST /v1/files` でアップロードし、返された `data.url` を指定してください。## フレームの選び方：`resolution` と `aspect_ratio`、または `size`画像の大きさと縦横の比を指定する方法は 2 つあり、同時には使えません。- **区分と比率。** `resolution`（`1K`、`2K`、`4K`）を送り、形を指定したい場合は `aspect_ratio` も送ります。両方を省略すると `1K` と `auto`、つまり正方形のフレームになります。
- **正確なサイズ。** `size` だけを送ります。例：`1536x1024`。ピクセル数は出力トークン数を変えます。タスクの精算までは、該当する区分の見積もりで予約されます（上の組み合わせルール）。`size` を `resolution` または `aspect_ratio` と一緒に送ると、`"size" already fixes the output; do not send "resolution" with it`（または `"aspect_ratio"`）で拒否されます。このチェックは、もう一方のフィールドがデフォルト値であっても適用されます。## 送信してからポーリングするこのモデルはタスクとしてのみ動きます。`POST /v1/images/tasks` はすぐに応答し、タスク ID は `data.id` に入ります。その後 `data.poll_after_seconds` ごとに `GET /v1/tasks/{task_id}` を呼び、`data.status` が `succeeded` または `failed` になるまで待ちます。生成は BeatAPI 側で行うため、時間のかかる生成でも接続を占有せず、クライアントのタイムアウトにもかかりません。このモデルでは同期の `POST /v1/images/generations` は使えません。```bash title="Submit, then poll"
# 1. Create the task. The call returns at once; the task ID is in data.id.
TASK_ID=$(curl -sS -X POST https://api.beatapi.io/v1/images/tasks \
  -H "Authorization: Bearer $BEATAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-image-2.5-sunburst-std","prompt":"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field","resolution":"2K","quality":"medium"}' | jq -r '.data.id')

# 2. Poll until the task is final. The render runs on BeatAPI, not on this connection.
while true; do
  TASK=$(curl -sS "https://api.beatapi.io/v1/tasks/$TASK_ID" -H "Authorization: Bearer $BEATAPI_API_KEY")
  STATUS=$(echo "$TASK" | jq -r '.data.status')
  if [ "$STATUS" = "succeeded" ] || [ "$STATUS" = "failed" ]; then break; fi
  sleep 5
done
echo "$TASK" | jq '.data.output.media[].url, .data.usage'
```Capabilities API から呼んでも同じタスクです。`POST /v1/capabilities/run` で開始し、返されたタスク ID でステータスの呼び出しを `succeeded` または `failed` になるまで送ります。```json title="POST /v1/capabilities/run"
{"reference":"model:gpt-image-2.5-sunburst-std","input":{"model":"gpt-image-2.5-sunburst-std","prompt":"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field","resolution":"2K","quality":"medium"}}
``````json title="POST /v1/capabilities/run (status)"
{"reference":"model:gpt-image-2.5-sunburst-std","operation":"status","task_id":"<task_id>"}
```## トークン課金と固定価格の比較|                       | `gpt-image-2.5-sunburst-std`               | `gpt-image-2.5-sunburst` |
| --------------------- | ------------------------------------------ | ------------------------ |
| 価格                    | 生成で使ったトークン（下の 100 万トークンあたりの単価）             | サイズ区分ごとに 1 枚あたりの固定価格     |
| タスク作成時に予約される額         | その区分の 1 枚あたりの見積もり                          | その画像の価格                  |
| タスク成功時の請求             | 実際に使ったトークンで精算。`data.usage` は予約額と異なることがあります | 予約した価格                   |
| `quality`             | 受け付けます（既定値 `medium`）                       | 拒否されます                   |
| フィールド、解像度、アスペクト比、参照画像 | 同じ                                         | 同じ                       |
| 失敗したタスク               | 無料                                         | 無料                       |## このモデルが受け付けないフィールド画像エンドポイントは、他の画像モデルが使ういくつかのフィールドを認識します。ここでそれらを送ると、無視されるのではなく拒否されます。効果のない設定に料金を払うことはありません。- `seed`、`output_format`、`enhance_prompt` → `field "seed" is not supported by model gpt-image-2.5-sunburst-std`（送ったフィールド名が入ります）。結果の形式は選べません。出力の `mime_type` を読み取ってください。
- `n` や `moderation` など、その他の未知のフィールド → `unknown field: n`。`n` はありません。1 つのタスクで画像は 1 枚です。固定価格の [`gpt-image-2.5-sunburst`](/image-api/gpt-image-2-5-sunburst) と違い、このモデルは `quality` を受け付けます。## リクエスト例```bash title="cURL"
curl --request POST \
  --url https://api.beatapi.io/v1/images/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "resolution": "2K",
  "quality": "medium"
}'
``````python title="Python"
import os
import requests

response = requests.post(
    "https://api.beatapi.io/v1/images/tasks",
    headers={"Authorization": f"Bearer {os.environ['BEATAPI_API_KEY']}"},
    json={
      "model": "gpt-image-2.5-sunburst-std",
      "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
      "aspect_ratio": "3:2",
      "resolution": "2K",
      "quality": "medium"
    },
    timeout=60,
)
body = response.json()
if not response.ok:
    raise RuntimeError(f"{response.status_code} {body['error']['code']}: {body['error']['message']}")
task = body["data"]
print(task["id"], task["status"])
``````javascript title="JavaScript"
const response = await fetch('https://api.beatapi.io/v1/images/tasks', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BEATAPI_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "model": "gpt-image-2.5-sunburst-std",
    "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
    "aspect_ratio": "3:2",
    "resolution": "2K",
    "quality": "medium"
  }),
});
const body = await response.json();
if (!response.ok) throw new Error(`${response.status} ${body.error.code}: ${body.error.message}`);
console.log(body.data.id, body.data.status);
```### テキストから画像区分と比率を指定して、プロンプトから 2K の横長画像を生成します。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/images/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "resolution": "2K",
  "quality": "medium"
}'
```### 低品質の下書き最初のリクエストを `quality: "low"` と 1K に変えたものです。出力トークンが少なく、料金も下がります。下書きやプレビューに向いています。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/images/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "resolution": "1K",
  "quality": "low"
}'
```### 1 枚の画像を編集商品はそのままに、背景を変更します。`auto` では正方形になるため、形を明示しています。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/images/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.",
  "images": [
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "aspect_ratio": "1:1",
  "resolution": "1K"
}'
```### 複数の画像を合成プロンプトでは、各参照画像を位置で指定します。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/images/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.",
  "images": [
    "https://cdn.beatapi.io/samples/smart-bottle.png",
    "https://cdn.beatapi.io/samples/neon-singer.png"
  ],
  "aspect_ratio": "16:9",
  "resolution": "2K"
}'
```### 正確なサイズ1536x1024 のフレームです。`size` は単独で使います。`resolution` も `aspect_ratio` も送りません。1K の見積もりで予約されます。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/images/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes",
  "size": "1536x1024"
}'
```### 透明な背景背景のないステッカー風の被写体です。結果はアルファチャンネル付きの PNG になります。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/images/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background",
  "aspect_ratio": "1:1",
  "resolution": "1K",
  "background": "transparent"
}'
```## レスポンス### タスクの作成（201）タスクオブジェクトです。タスクが成功するまで `output` は `null` です。「実行中」と記載されたフィールドは、タスクの完了後に表示されなくなります。```json
{
  "data": {
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "object": "task",
    "task_kind": "image",
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "status": "queued",
    "stage": "queued",
    "created_at": 1791993600,
    "updated_at": 1791993600,
    "completed_at": null,
    "poll_after_seconds": 5,
    "output": null,
    "usage": {
      "credits_reserved": 0.017394,
      "credits_settled": 0,
      "credits_refunded": 0,
      "credits_charged": 0.017394
    },
    "request_id": "req_5f0c2a9e4b7d4e31",
    "error_code": null,
    "error_message": null
  }
}
```| フィールド                                  | 型                 | 説明                                                                                            |
| -------------------------------------- | ----------------- | --------------------------------------------------------------------------------------------- |
| `data.id`                              | `string`          | タスク ID です。`task_` の後に英数字 32 文字が続きます。ポーリングや Webhook イベントとの照合に使います。                             |
| `data.object`                          | `string`          | 常に `task` です。                                                                                 |
| `data.task_kind`                       | `string`          | `image` または `video` です。                                                                       |
| `data.capability_id`                   | `string`          | 送信したモデル ID です。                                                                                |
| `data.capability_version`              | `integer`         | モデルの仕様バージョンです。現在は `1` です。                                                                     |
| `data.media_type`                      | `string`          | `image` または `video` です。                                                                       |
| `data.model`                           | `string`          | 送信したモデル ID です（`capability_id` と同じ）。                                                           |
| `data.status`                          | `string`          | `queued`、`processing`、`succeeded`、`failed` のいずれかです。最終状態は後ろの 2 つだけです。                          |
| `data.stage`                           | `string`          | `status` と同じ値です。古いクライアント向けに残されています。                                                           |
| `data.created_at`                      | `integer`         | タスクの作成日時（Unix 秒）です。                                                                           |
| `data.updated_at`                      | `integer`         | 最終更新日時（Unix 秒）です。                                                                             |
| `data.completed_at`                    | `integer \| null` | タスクの完了日時（Unix 秒）です。実行中は `null` です。                                                            |
| `data.poll_after_seconds`              | `integer`         | 実行中のみ。次のポーリングまでに待つ秒数です（画像は 5、動画は 8）。                                                          |
| `data.typical_seconds`                 | `object`          | 実行中のみ、直近のタスクが十分にある場合に含まれます。直近 `window` の `samples` 件のタスクについて、完了までの時間（秒）の `p50` と `p90` を示します。 |
| `data.output`                          | `object \| null`  | 結果です。`status` が `succeeded` になるまでは `null` です。下の出力フィールドを参照してください。                              |
| `data.usage.credits_reserved`          | `number`          | タスク作成時に残高から仮確保された金額（USD）です。                                                                   |
| `data.usage.credits_charged`           | `number`          | このタスクの料金（USD）です。失敗したタスクでは `0` です。                                                             |
| `data.usage.credits_settled`           | `number`          | 最終的に差し引かれた金額（USD）です。タスクが成功した時点で設定され、それ以外では `0` です。                                            |
| `data.usage.credits_refunded`          | `number`          | 残高に戻された金額（USD）です。失敗したタスクでは、返金が記録された時点で仮確保した金額と一致します。                                          |
| `data.usage.billable_duration_seconds` | `integer`         | 動画のみ。料金の算定に使われた秒数です。モデルが長さを報告しない場合は含まれません。                                                    |
| `data.request_id`                      | `string`          | リクエスト ID です。サポートに問い合わせる際に添えてください。                                                             |
| `data.error_code`                      | `string \| null`  | 失敗コードです。タスクが失敗した場合以外は `null` です。                                                              |
| `data.error_message`                   | `string \| null`  | 何が問題で、何を変更すればよいかを示します。タスクが失敗した場合以外は `null` です。                                                |### 完了したタスク`GET /v1/tasks/{task_id}` は HTTP 200 と `status: "succeeded"` を返し、結果は `data.output` に入ります。```json
{
  "data": {
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "object": "task",
    "task_kind": "image",
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "status": "succeeded",
    "stage": "succeeded",
    "created_at": 1791993600,
    "updated_at": 1791993690,
    "completed_at": 1791993690,
    "output": {
      "media": [
        {
          "type": "image",
          "url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.png",
          "mime_type": "image/png"
        }
      ],
      "r2_url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.png"
    },
    "usage": {
      "credits_reserved": 0.017394,
      "credits_settled": 0.017394,
      "credits_refunded": 0,
      "credits_charged": 0.017394
    },
    "request_id": "req_5f0c2a9e4b7d4e31",
    "error_code": null,
    "error_message": null
  }
}
```#### 出力フィールド| フィールド                      | 型          | 説明                                                                                                              |
| -------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------- |
| `output.media`             | `object[]` | 生成されたファイルです。このモデルでは 1 件です。                                                                                      |
| `output.media[].type`      | `string`   | 常に `image` です。                                                                                                  |
| `output.media[].url`       | `string`   | 保存された画像への HTTPS リンクです。ダウンロードして保管してください。保持期間は保証されません。                                                            |
| `output.media[].mime_type` | `string`   | 保存されたファイルの形式です（例：`image/png`）。これらのモデルには `output_format` フィールドがないため、BeatAPI はファイルを変換しません。形式を決めつけず、この値を読み取ってください。 |
| `output.r2_url`            | `string`   | 1 件目の media の URL と同じ値です。古いクライアント向けです。代わりに `media` を読んでください。                                                    |### 失敗したタスク失敗したタスクも、`GET /v1/tasks/{task_id}` では HTTP 200 になります。失敗はボディに示されます。仮確保された金額は全額戻されるため、課金されません。```json
{
  "data": {
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "object": "task",
    "task_kind": "image",
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "status": "failed",
    "stage": "failed",
    "created_at": 1791993600,
    "updated_at": 1791993690,
    "completed_at": 1791993690,
    "output": null,
    "usage": {
      "credits_reserved": 0.017394,
      "credits_settled": 0,
      "credits_refunded": 0.017394,
      "credits_charged": 0
    },
    "retryable": true,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "error_code": "processing_failed",
    "error_message": "The task failed during processing on our side. Retry; a failed task is refunded."
  }
}
```| フィールド                | 型         | 説明                                                                                                                                                                                                         |
| -------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data.error_code`    | `string`  | `bad_request` と `content_policy_violation`（リクエストを修正してください）、または `processing_unavailable`、`processing_timeout`、`processing_failed`、`result_transfer_failed`（時間をおいて再試行してください）のいずれかです。[エラー](/errors)を参照してください。 |
| `data.error_message` | `string`  | 問題と対処方法を示す文です。                                                                                                                                                                                             |
| `data.retryable`     | `boolean` | 失敗したタスクにのみ含まれます。同じリクエストをもう一度送れば成功する可能性がある場合は `true` です。                                                                                                                                                    |
| `data.usage`         | `object`  | 返金が記録された時点（通常はタスクが失敗した瞬間）で、`credits_charged` と `credits_settled` は `0` になり、`credits_refunded` は `credits_reserved` と一致します。                                                                                 |## 完全なコード例タスクを作成し、サーバーが示すポーリング間隔で完了を待ち、結果の URL を出力します。環境変数に `BEATAPI_API_KEY` を設定し、`requests` をインストールしてください。```python
import os
import time
import uuid

import requests

API = "https://api.beatapi.io"
HEADERS = {"Authorization": f"Bearer {os.environ['BEATAPI_API_KEY']}"}


def create_task(body: dict) -> dict:
    # One Idempotency-Key per logical request: a retry with the same key cannot create a second task.
    headers = {**HEADERS, "Idempotency-Key": str(uuid.uuid4())}
    for attempt in range(3):
        response = requests.post(f"{API}/v1/images/tasks", headers=headers, json=body, timeout=60)
        if response.status_code in (429, 503) and attempt < 2:
            time.sleep(int(response.headers.get("Retry-After", 10)))
            continue
        break
    try:
        payload = response.json()
    except ValueError:  # an edge error page is not JSON
        response.raise_for_status()
        raise
    if not response.ok:
        error = payload["error"]
        raise RuntimeError(f"{response.status_code} {error['code']}: {error['message']} (request_id={error.get('request_id')})")
    return payload["data"]


def wait_for_task(task_id: str, timeout_seconds: int = 1800) -> dict:
    deadline = time.monotonic() + timeout_seconds
    while time.monotonic() < deadline:
        response = requests.get(f"{API}/v1/tasks/{task_id}", headers=HEADERS, timeout=30)
        if response.status_code == 429 or response.status_code >= 500:
            time.sleep(int(response.headers.get("Retry-After", 10)))
            continue
        response.raise_for_status()
        task = response.json()["data"]
        if task["status"] in ("succeeded", "failed"):
            return task
        time.sleep(task.get("poll_after_seconds", 5))
    raise TimeoutError(f"task {task_id} is still running; keep polling later")


task = create_task({
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "resolution": "2K",
  "quality": "medium"
})
print("created", task["id"])
task = wait_for_task(task["id"])
if task["status"] == "failed":
    raise SystemExit(f"{task['error_code']}: {task['error_message']}")
for item in task["output"]["media"]:
    print(item["url"])
```## 課金- トークン課金です。単価は下の表（100 万トークンあたり）のとおりで、テキスト入力（プロンプト）、画像入力（`images` の参照画像）、出力（生成された画像）に分かれます。トークン数はモデルが数え、`quality`、フレーム、参照画像のいずれも数を変えます。
- 1 枚あたりの価格は、`medium` 品質、各区分の正方形フレーム、参照画像なしで 1 回生成した場合の見積もりです。`low` は出力トークンが少なく、それより高い値は多くなります。
- タスクの作成時に、その区分の見積もりが残高（キーに上限がある場合はその枠）から予約されます。成功すると、生成で実際に使ったトークンで精算されるため、最終的な `data.usage` は予約額と異なることがあります。タスクができる前に拒否されたリクエストには料金がかかりません。
- 失敗したタスクは全額返金されます。
- 固定価格の [`gpt-image-2.5-sunburst`](/image-api/gpt-image-2-5-sunburst) は同じモデルで、生成に何トークン使っても画像 1 枚ごとに一定の価格です。現在の定価です。[料金](https://beatapi.io/pricing)ページと同じ金額です。割引を個別に契約しているアカウントでは、より低い金額になります。実際に課金された金額は、タスクの `data.usage` で確認できます。| オプション                      | 定価（USD）    |
| -------------------------- | ---------- |
| 1 枚 · 1K · medium 品質での見積もり | \$0.008561 |
| 1 枚 · 2K · medium 品質での見積もり | \$0.017394 |
| 1 枚 · 4K · medium 品質での見積もり | \$0.028919 |
| 入力 · 100万トークンあたり           | \$3.25     |
| 画像入力 · 100万トークンあたり         | \$5.2      |
| 出力 · 100万トークンあたり           | \$19.5     |## よくあるエラー| エラーまたは症状                                                                         | 原因                                                                    | 対処                                                                       |
| -------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| 400 `"size" already fixes the output; do not send "resolution" with it`          | `size` を `resolution` または `aspect_ratio` と一緒に送っています（デフォルト値であっても同様です）。 | `size` だけを送るか、`size` なしで `resolution` と `aspect_ratio` を送ってください。         |
| 400 `"size" width and height must be multiples of 16`                            | `1000x1000` や `1920x1080`（1080 は 16 の倍数ではありません）のようなサイズです。             | 両方の辺を 16 の倍数に丸めてください。たとえば `1920x1088` です。                                |
| 400 `"size" must have between 655,360 and 8,294,400 pixels; 512x512 has 262,144` | フレームが小さすぎる、または大きすぎます。`4096x4096` は、それより前の 3840 px の辺の上限で失敗します。        | 辺は 3840 px 以下にし、合計ピクセル数を 655,360～8,294,400 の範囲に収めてください。                  |
| 400 `"resolution" must be one of: [1K 2K 4K]`                                    | 小文字の `2k`、`8K`、または `resolution` に `2048x2048` のようなピクセルサイズを送っています。     | `1K`、`2K`、`4K` のいずれかを送るか、ピクセル指定には `size` フィールドを使ってください。                  |
| 400 `"quality" must be one of: [low medium high xhigh max]`                      | 一覧にない値か、`High` のように大文字で書いた値を送っています。                                   | 一覧の値を送るか、フィールドを省略して `medium` にしてください。                                    |
| 400 `field "seed" is not supported by model gpt-image-2.5-sunburst-std`          | 他の画像モデルのフィールド（`seed`、`output_format`、`enhance_prompt`）を送っています。        | そのフィールドを削除してください。                                                        |
| 400 `unknown field: n`                                                           | 1 つのタスクで複数枚の画像を要求しています。                                               | `n` を削除し、画像 1 枚ごとにタスクを作成してください。                                          |
| 400 `"images[0]" must be a public HTTPS URL`                                     | `http://` のリンク、`data:` URI、またはローカルパスを指定しています。                         | ファイルを HTTPS で公開するか、`POST /v1/files` でアップロードして `data.url` を使ってください。       |
| 400 `"images[1]" is not a PNG, JPEG or WebP image: the URL returned text/html`   | リンク先がファイルではなく、Web ページ、ログインページ、または期限切れの署名付き URL です。                    | 画像ファイルへ直接リンクしてください。                                                      |
| 400 `"images[0]" could not be downloaded: the URL returned HTTP 403`             | ホストがサーバーからのダウンロードをブロックしています（ホットリンク保護、またはプライベートなバケット）。                 | ファイルを公開するか、`POST /v1/files` でアップロードしてください。                               |
| 編集した画像が正方形で返ってくる                                                                 | `aspect_ratio` を省略したか `auto` を指定したため、正方形のフレームで描画されました。                | 希望の比率を指定するか、`size` を送ってください。                                             |
| タスクが `content_policy_violation` で `failed`                                       | プロンプト、参照画像、または生成された画像がモデレーションで拒否されました。                                | プロンプトまたは画像を変更してください。そのまま再試行しても再び失敗します。課金はされません。                          |
| タスクが `processing_timeout` で `failed`                                             | 画像が処理時間の上限内に完了しませんでした。                                                | 再試行してください。失敗したタスクは返金されています。                                              |
| 404 `POST /v1/images/generations`                                                | このモデルは非同期タスクとしてのみ提供され、同期エンドポイントは使えません。                                | `POST /v1/images/tasks` でタスクを作成し、`GET /v1/tasks/{task_id}` をポーリングしてください。 |
| 請求額が 1 枚あたりの価格と違う                                                                | 請求は生成で使ったトークンで精算されます。1 枚あたりの価格は見積もりです。                                | 完了したタスクの `data.usage` を確認してください。出力トークンを減らすには `quality: "low"` を送ります。     |## HTTP エラー早見表タスクが作られる前のエラーは、2xx 以外のレスポンスで返されます。課金はされません。`error.code` または `error.retryable` で処理を分岐してください。`message` には問題の内容が示されます。全一覧と再試行のルールは[エラー](/errors)にあります。```json
{
  "error": {
    "code": "bad_request",
    "message": "\"prompt\" is required",
    "retryable": false,
    "request_id": "req_5f0c2a9e4b7d4e31"
  }
}
```| HTTP ステータス | `error.code`                                                                                  | 対処方法                                                                             |
| ---------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| 400        | `bad_request`, `content_policy_violation`                                                     | リクエストを修正してください。メッセージにフィールド名が示されます。そのまま再試行しないでください。                               |
| 401        | `missing_api_key`, `invalid_api_key`（古いクライアントでは `unauthorized` が返ることがあります）                    | 有効なキーを `Authorization: Bearer <key>` で送信してください。                                  |
| 402        | `insufficient_credits`                                                                        | 残高をチャージするか、キーのクォータを引き上げてから、再度送信してください。                                           |
| 403        | `forbidden`                                                                                   | このキーまたはアカウントでは、このモデルを利用できない可能性があります（たとえば、無料クレジットは一部のモデルにのみ使えます）。そのまま再試行しないでください。 |
| 404        | `not_found`                                                                                   | `GET /v1/tasks/{task_id}` の場合：このキーのアカウントに該当するタスクが存在しません。ID を確認してください。            |
| 409        | `idempotency_conflict`                                                                        | 新しい `Idempotency-Key` を使うか、同じキーの最初のリクエストが完了するまで待ってください。                          |
| 429        | `rate_limit_exceeded`                                                                         | `Retry-After` の秒数（`error.retry_after_seconds` にも含まれます）だけ待ってから再試行してください。          |
| 500        | `internal_error`                                                                              | バックオフを入れて再試行してください。解消しない場合は、`request_id` を添えてサポートにお問い合わせください。                    |
| 503        | `processing_unavailable`, `processing_timeout`, `processing_failed`, `result_transfer_failed` | 課金はされていません。指数バックオフで再試行してください。                                                    |

Reference: https://docs.beatapi.io/api-reference/image-api/gpt-image-2-5-sunburst-std

## Authentication

- `Authorization` header (bearer token, required) — API キーを `Authorization: Bearer <BEATAPI_API_KEY>` として送信してください。

## Servers

- `https://api.beatapi.io` (Direct, default)
- `https://api.beatapi.io` (API)

## Request

### Headers

- `Idempotency-Key` (string, optional) — ボディは JSON で送信し、`Content-Type: application/json` を指定します。`Idempotency-Key` は任意です。論理的に 1 件のリクエストごとに一意の値（255 文字以内）を送り、まったく同じボディを再試行するときだけ再利用してください。24 時間以内に同じキーと同じボディで再試行すると、最初のレスポンスが `Idempotent-Replayed: true` 付きで再度返されます。同じキーで異なるボディを送ると `409 idempotency_conflict` が返ります。2xx 以外のレスポンスは保存されないため、400 や 402 の後の再試行は改めて実行されます。

### Body (application/json)

This endpoint expects a GptImage25SunburstStdRequest.

- `model` (enum, required) — 実行するモデルです。 **値**：`gpt-image-2.5-sunburst-std` **値が正しくない場合** - 指定がない場合：`"model" is required` - 不明なモデル ID の場合：`"model" gpt-image-9 is not catalogued` - 動画モデルをこのエンドポイントに送った場合：`"model" seedance-2.5 is served by POST /v1/videos/tasks, not this endpoint`
  - Allowed values: `gpt-image-2.5-sunburst-std`
- `prompt` (string, required) — 描きたい内容、または参照画像に加えたい変更です。被写体、スタイル、照明、構図、画像内に表示したい文字などを、普通の言葉で書くのが最適です。 **長さ**：1–5000 文字 - 長さは文字数で数えます（CJK 文字も 1 文字として数えます）。 - `images` を送る場合は、どの画像が何の役割かを書いてください。たとえば「1 枚目の画像を商品に、2 枚目の画像を背景に使う」のように指定します。 **値が正しくない場合** - 指定がない場合：`"prompt" is required` - 空、または上限を超える長さの場合：`"prompt" has an unsupported length` - 文字列でない場合：`"prompt" must be a string`
- `aspect_ratio` (enum, optional, default: auto) — 画像の形を「幅:高さ」で指定します。`resolution` と一緒に送るか、両方を省略して `size` を送ってください。 **指定できる値**：`auto`, `1:1`, `3:2`, `2:3`, `4:3`, `3:4`, `5:4`, `4:5`, `16:9`, `9:16`, `2:1`, `1:2`, `3:1`, `1:3`, `21:9`, `9:21` **デフォルト**：`auto` - デフォルトは `auto` なので、このフィールドを省略したリクエストも正方形で描画されます。 - `2:1`、`1:2`、`3:1`、`1:3`、`21:9`、`9:21` といったパノラマ形状も指定できます。最も横長または縦長のフレームは 3:1 です。 - `size` と同時には使えません。 **備考**：`auto` は「参照画像の形に従う」という意味ではありません。`images` の有無にかかわらず、選択した `resolution` の正方形のフレームを要求します。編集結果を別の形にしたい場合は、比率を指定するか、`size` を送ってください。 **値が正しくない場合** - 一覧にない値の場合：`"aspect_ratio" must be one of: [auto 1:1 3:2 2:3 4:3 3:4 5:4 4:5 16:9 9:16 2:1 1:2 3:1 1:3 21:9 9:21]` - `size` と同時に送った場合：`"size" already fixes the output; do not send "aspect_ratio" with it`
  - Allowed values: `auto`, `1:1`, `3:2`, `2:3`, `4:3`, `3:4`, `5:4`, `4:5`, `16:9`, `9:16`, `2:1`, `1:2`, `3:1`, `1:3`, `21:9`, `9:21`
- `background` (enum, optional, default: auto) — 画像の背景を塗りつぶすか、透明にするかを指定します。 **指定できる値**：`auto`, `opaque`, `transparent` **デフォルト**：`auto` - `auto`（デフォルト）は、モデルが選びます。`opaque` は塗りつぶされた背景を要求します。 - `transparent` は、背景に色のない画像を要求します。結果はアルファチャンネル付きの PNG になります。`output.media[].mime_type` で確認してください。 **値が正しくない場合** - 一覧にない値の場合：`"background" must be one of: [auto opaque transparent]`
  - Allowed values: `auto`, `opaque`, `transparent`
- `images` (list of string, optional) — 編集または合成する参照画像です。このフィールドを送ると、リクエストはテキストからの画像生成ではなく、画像編集として扱われます。 **要素数**：1–16 各要素は公開されている `https://` の URL です。ローカルファイルは先に [アップロード](/quick-guide#upload-an-input-file)（`POST /v1/files`）し、返された `data.url` を渡してください。 - 各リンクは、公開 HTTPS で画像ファイルそのもの（PNG、JPEG、WebP）を返し、サイズが 50 MB 以下である必要があります。ゲートウェイは、タスクを作成する前に、すべてのリンクの先頭バイトをダウンロードし、ファイル名や `Content-Type` ではなく、そのバイト列から形式を判定します。 - Web ページ、ログインが必要なページ、期限切れの署名付き URL、ホットリンク保護のあるホストへのリンクは、画像を返さないため拒否されます。 - エラーメッセージ中の位置は 0 始まりです。`images[0]` は 1 番目のリンクを指します。 **値が正しくない場合** - 最大数を超えた場合：`"images" accepts at most 16 items` - 空の配列の場合：`"images" requires at least 1 item` - https:// のリンクでない場合：`"images[0]" must be a public HTTPS URL` - プライベートまたは安全でないアドレスの場合：`"images[0]" must be a publicly reachable HTTPS image URL` - ホストが 4xx エラーを返した場合：`"images[0]" could not be downloaded: the URL returned HTTP 404` - リンクが PNG、JPEG、WebP 以外を返した場合：`"images[0]" is not a PNG, JPEG or WebP image: the URL returned text/html` - 50 MB を超える場合：`"images[2]" is 63.4 MB; images must be 50 MB or smaller` **例** ```json "images": [ "https://cdn.beatapi.io/samples/smart-bottle.png", "https://cdn.beatapi.io/samples/neon-singer.png" ] ```
- `quality` (enum, optional, default: medium) — モデルが画像にかける手間の度合いです。1 回の生成で使う出力トークン数を決め、そのまま価格を決めます。低い値ほど安く、高い値ほど高くなります。 **指定できる値**：`low`, `medium`, `high`, `xhigh`, `max` **デフォルト**：`medium` - 省略すると `medium` になります。このページの 1 枚あたりの価格は、この品質での見積もりです。 - 固定価格の [`gpt-image-2.5-sunburst`](/image-api/gpt-image-2-5-sunburst) はこのフィールドを受け付けず、送ると拒否されます。 **値が正しくない場合** - 一覧にない値の場合：`"quality" must be one of: [low medium high xhigh max]` **例** ```json "quality": "low" ```
  - Allowed values: `low`, `medium`, `high`, `xhigh`, `max`
- `resolution` (enum, optional, default: 1K) — 画像のサイズ区分です。区分が高いほど画像は大きくなり、料金も上がります。正確なピクセルサイズは `aspect_ratio` に依存し、モデルが決定します。 **指定できる値**：`1K`, `2K`, `4K` **デフォルト**：`1K` - 大文字の K を使ってください。`2k` は拒否されます。 - このページでは、区分ごとの正確なピクセル寸法は保証しません。正確なフレームが必要な場合は `size` を送ってください。 - `size` と同時には使えません。`size` は独自のサイズを持ちます。 **値が正しくない場合** - 一覧にない値の場合：`"resolution" must be one of: [1K 2K 4K]` - `size` と同時に送った場合：`"size" already fixes the output; do not send "resolution" with it`
  - Allowed values: `1K`, `2K`, `4K`
- `size` (string, optional) — ピクセル単位の正確な出力サイズを `WIDTHxHEIGHT` の形式で指定します。例：`1536x1024`。`resolution` と `aspect_ratio` の代わりになります。 - 両方の辺が 16 の倍数で、16～3840 px の範囲内である必要があります。 - 合計ピクセル数は 655,360～8,294,400 の範囲内で、長辺は短辺の 3 倍以下にしてください。 - 区切り文字には `x`、`X`、`×` を使えます。前後のスペースは無視されます。 - ピクセル数は出力トークン数を変え、そのまま価格を変えます。タスクの精算までは、ピクセル数が該当する区分の見積もりが予約されます。2,097,152 ピクセル以下は 1K、5,898,240 以下は 2K、それを超えると 4K です。 - `resolution` や `aspect_ratio` は、デフォルト値であっても一緒に送らないでください。 **備考**：`size` は送信した値のとおりに検証されますが、納品される画像のピクセル数がその値と完全に一致することは、このページでは保証しません。正確な寸法がパイプラインに必要な場合は、保存されたファイルを読み取ってください。 **値が正しくない場合** - 文字列でない場合：`"size" must be a string` - WIDTHxHEIGHT の形式でない場合（数字だけ、`auto`、カンマなど）：`"size" must be WIDTHxHEIGHT in pixels, for example 1536x1024` - 辺が 16 の倍数でない場合：`"size" width and height must be multiples of 16` - 辺が 16 未満または 3840 を超える場合：`"size" edges must be between 16 and 3840 pixels` - ピクセル数が少なすぎる、または多すぎる場合：`"size" must have between 655,360 and 8,294,400 pixels; 512x512 has 262,144` - 3:1 より横長または縦長の場合：`"size" must not be wider or taller than 3:1` - `resolution` と同時に送った場合：`"size" already fixes the output; do not send "resolution" with it` - `aspect_ratio` と同時に送った場合：`"size" already fixes the output; do not send "aspect_ratio" with it` **例** ```json "size": "1536x1024" ```

## Response

### 201

タスクオブジェクトです。タスクが成功するまで `output` は `null` です。「実行中」と記載されたフィールドは、タスクの完了後に表示されなくなります。

- `map from string to any`

## Errors

### 400 Bad Request Error

`bad_request`, `content_policy_violation` リクエストを修正してください。メッセージにフィールド名が示されます。そのまま再試行しないでください。

- `map from string to any`

### 401 Unauthorized Error

`missing_api_key`, `invalid_api_key`（古いクライアントでは `unauthorized` が返ることがあります） 有効なキーを `Authorization: Bearer <key>` で送信してください。

- `map from string to any`

### 402 Payment Required Error

`insufficient_credits` 残高をチャージするか、キーのクォータを引き上げてから、再度送信してください。

- `map from string to any`

### 403 Forbidden Error

`forbidden` このキーまたはアカウントでは、このモデルを利用できない可能性があります（たとえば、無料クレジットは一部のモデルにのみ使えます）。そのまま再試行しないでください。

- `map from string to any`

### 409 Conflict Error

`idempotency_conflict` 新しい `Idempotency-Key` を使うか、同じキーの最初のリクエストが完了するまで待ってください。

- `map from string to any`

### 429 Too Many Requests Error

`rate_limit_exceeded` `Retry-After` の秒数（`error.retry_after_seconds` にも含まれます）だけ待ってから再試行してください。

- `map from string to any`

### 500 Internal Server Error

`internal_error` バックオフを入れて再試行してください。解消しない場合は、`request_id` を添えてサポートにお問い合わせください。

- `map from string to any`

### 503 Service Unavailable Error

`processing_unavailable`, `processing_timeout`, `processing_failed`, `result_transfer_failed` 課金はされていません。指数バックオフで再試行してください。

- `map from string to any`

## Examples

### テキストから画像

**Request**

```json
{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "quality": "medium",
  "resolution": "2K"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "object": "task",
    "output": null,
    "poll_after_seconds": 5,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "image",
    "updated_at": 1791993600,
    "usage": {
      "credits_charged": 0.017394,
      "credits_refunded": 0,
      "credits_reserved": 0.017394,
      "credits_settled": 0
    }
  }
}
```

**SDK Code**

```python テキストから画像
import requests

url = "https://api.beatapi.io/v1/images/tasks"

payload = {
    "model": "gpt-image-2.5-sunburst-std",
    "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
    "aspect_ratio": "3:2",
    "quality": "medium",
    "resolution": "2K"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript テキストから画像
const url = 'https://api.beatapi.io/v1/images/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gpt-image-2.5-sunburst-std","prompt":"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field","aspect_ratio":"3:2","quality":"medium","resolution":"2K"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go テキストから画像
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/images/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field\",\n  \"aspect_ratio\": \"3:2\",\n  \"quality\": \"medium\",\n  \"resolution\": \"2K\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby テキストから画像
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/images/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field\",\n  \"aspect_ratio\": \"3:2\",\n  \"quality\": \"medium\",\n  \"resolution\": \"2K\"\n}"

response = http.request(request)
puts response.read_body
```

```java テキストから画像
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/images/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field\",\n  \"aspect_ratio\": \"3:2\",\n  \"quality\": \"medium\",\n  \"resolution\": \"2K\"\n}")
  .asString();
```

```php テキストから画像
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/images/tasks', [
  'body' => '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "quality": "medium",
  "resolution": "2K"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp テキストから画像
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/images/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field\",\n  \"aspect_ratio\": \"3:2\",\n  \"quality\": \"medium\",\n  \"resolution\": \"2K\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift テキストから画像
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "quality": "medium",
  "resolution": "2K"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/images/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### 低品質の下書き

**Request**

```json
{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "quality": "low",
  "resolution": "1K"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "object": "task",
    "output": null,
    "poll_after_seconds": 5,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "image",
    "updated_at": 1791993600
  }
}
```

**SDK Code**

```python 低品質の下書き
import requests

url = "https://api.beatapi.io/v1/images/tasks"

payload = {
    "model": "gpt-image-2.5-sunburst-std",
    "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
    "aspect_ratio": "3:2",
    "quality": "low",
    "resolution": "1K"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript 低品質の下書き
const url = 'https://api.beatapi.io/v1/images/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gpt-image-2.5-sunburst-std","prompt":"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field","aspect_ratio":"3:2","quality":"low","resolution":"1K"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 低品質の下書き
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/images/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field\",\n  \"aspect_ratio\": \"3:2\",\n  \"quality\": \"low\",\n  \"resolution\": \"1K\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 低品質の下書き
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/images/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field\",\n  \"aspect_ratio\": \"3:2\",\n  \"quality\": \"low\",\n  \"resolution\": \"1K\"\n}"

response = http.request(request)
puts response.read_body
```

```java 低品質の下書き
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/images/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field\",\n  \"aspect_ratio\": \"3:2\",\n  \"quality\": \"low\",\n  \"resolution\": \"1K\"\n}")
  .asString();
```

```php 低品質の下書き
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/images/tasks', [
  'body' => '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "quality": "low",
  "resolution": "1K"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp 低品質の下書き
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/images/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field\",\n  \"aspect_ratio\": \"3:2\",\n  \"quality\": \"low\",\n  \"resolution\": \"1K\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 低品質の下書き
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
  "aspect_ratio": "3:2",
  "quality": "low",
  "resolution": "1K"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/images/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### 1 枚の画像を編集

**Request**

```json
{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.",
  "aspect_ratio": "1:1",
  "images": [
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "resolution": "1K"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "object": "task",
    "output": null,
    "poll_after_seconds": 5,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "image",
    "updated_at": 1791993600
  }
}
```

**SDK Code**

```python 1 枚の画像を編集
import requests

url = "https://api.beatapi.io/v1/images/tasks"

payload = {
    "model": "gpt-image-2.5-sunburst-std",
    "prompt": "Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.",
    "aspect_ratio": "1:1",
    "images": ["https://cdn.beatapi.io/samples/smart-bottle.png"],
    "resolution": "1K"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript 1 枚の画像を編集
const url = 'https://api.beatapi.io/v1/images/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gpt-image-2.5-sunburst-std","prompt":"Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.","aspect_ratio":"1:1","images":["https://cdn.beatapi.io/samples/smart-bottle.png"],"resolution":"1K"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 1 枚の画像を編集
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/images/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.\",\n  \"aspect_ratio\": \"1:1\",\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"resolution\": \"1K\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 1 枚の画像を編集
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/images/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.\",\n  \"aspect_ratio\": \"1:1\",\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"resolution\": \"1K\"\n}"

response = http.request(request)
puts response.read_body
```

```java 1 枚の画像を編集
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/images/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.\",\n  \"aspect_ratio\": \"1:1\",\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"resolution\": \"1K\"\n}")
  .asString();
```

```php 1 枚の画像を編集
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/images/tasks', [
  'body' => '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.",
  "aspect_ratio": "1:1",
  "images": [
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "resolution": "1K"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp 1 枚の画像を編集
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/images/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.\",\n  \"aspect_ratio\": \"1:1\",\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"resolution\": \"1K\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 1 枚の画像を編集
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.",
  "aspect_ratio": "1:1",
  "images": ["https://cdn.beatapi.io/samples/smart-bottle.png"],
  "resolution": "1K"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/images/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### 複数の画像を合成

**Request**

```json
{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.",
  "aspect_ratio": "16:9",
  "images": [
    "https://cdn.beatapi.io/samples/smart-bottle.png",
    "https://cdn.beatapi.io/samples/neon-singer.png"
  ],
  "resolution": "2K"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "object": "task",
    "output": null,
    "poll_after_seconds": 5,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "image",
    "updated_at": 1791993600
  }
}
```

**SDK Code**

```python 複数の画像を合成
import requests

url = "https://api.beatapi.io/v1/images/tasks"

payload = {
    "model": "gpt-image-2.5-sunburst-std",
    "prompt": "Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.",
    "aspect_ratio": "16:9",
    "images": ["https://cdn.beatapi.io/samples/smart-bottle.png", "https://cdn.beatapi.io/samples/neon-singer.png"],
    "resolution": "2K"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript 複数の画像を合成
const url = 'https://api.beatapi.io/v1/images/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gpt-image-2.5-sunburst-std","prompt":"Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.","aspect_ratio":"16:9","images":["https://cdn.beatapi.io/samples/smart-bottle.png","https://cdn.beatapi.io/samples/neon-singer.png"],"resolution":"2K"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 複数の画像を合成
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/images/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.\",\n  \"aspect_ratio\": \"16:9\",\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\",\n    \"https://cdn.beatapi.io/samples/neon-singer.png\"\n  ],\n  \"resolution\": \"2K\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 複数の画像を合成
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/images/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.\",\n  \"aspect_ratio\": \"16:9\",\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\",\n    \"https://cdn.beatapi.io/samples/neon-singer.png\"\n  ],\n  \"resolution\": \"2K\"\n}"

response = http.request(request)
puts response.read_body
```

```java 複数の画像を合成
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/images/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.\",\n  \"aspect_ratio\": \"16:9\",\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\",\n    \"https://cdn.beatapi.io/samples/neon-singer.png\"\n  ],\n  \"resolution\": \"2K\"\n}")
  .asString();
```

```php 複数の画像を合成
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/images/tasks', [
  'body' => '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.",
  "aspect_ratio": "16:9",
  "images": [
    "https://cdn.beatapi.io/samples/smart-bottle.png",
    "https://cdn.beatapi.io/samples/neon-singer.png"
  ],
  "resolution": "2K"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp 複数の画像を合成
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/images/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.\",\n  \"aspect_ratio\": \"16:9\",\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\",\n    \"https://cdn.beatapi.io/samples/neon-singer.png\"\n  ],\n  \"resolution\": \"2K\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 複数の画像を合成
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.",
  "aspect_ratio": "16:9",
  "images": ["https://cdn.beatapi.io/samples/smart-bottle.png", "https://cdn.beatapi.io/samples/neon-singer.png"],
  "resolution": "2K"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/images/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### 正確なサイズ

**Request**

```json
{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes",
  "size": "1536x1024"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "object": "task",
    "output": null,
    "poll_after_seconds": 5,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "image",
    "updated_at": 1791993600
  }
}
```

**SDK Code**

```python 正確なサイズ
import requests

url = "https://api.beatapi.io/v1/images/tasks"

payload = {
    "model": "gpt-image-2.5-sunburst-std",
    "prompt": "A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes",
    "size": "1536x1024"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript 正確なサイズ
const url = 'https://api.beatapi.io/v1/images/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gpt-image-2.5-sunburst-std","prompt":"A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes","size":"1536x1024"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 正確なサイズ
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/images/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes\",\n  \"size\": \"1536x1024\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 正確なサイズ
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/images/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes\",\n  \"size\": \"1536x1024\"\n}"

response = http.request(request)
puts response.read_body
```

```java 正確なサイズ
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/images/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes\",\n  \"size\": \"1536x1024\"\n}")
  .asString();
```

```php 正確なサイズ
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/images/tasks', [
  'body' => '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes",
  "size": "1536x1024"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp 正確なサイズ
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/images/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes\",\n  \"size\": \"1536x1024\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 正確なサイズ
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes",
  "size": "1536x1024"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/images/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### 透明な背景

**Request**

```json
{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background",
  "aspect_ratio": "1:1",
  "background": "transparent",
  "resolution": "1K"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gpt-image-2.5-sunburst-std",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "image",
    "model": "gpt-image-2.5-sunburst-std",
    "object": "task",
    "output": null,
    "poll_after_seconds": 5,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "image",
    "updated_at": 1791993600
  }
}
```

**SDK Code**

```python 透明な背景
import requests

url = "https://api.beatapi.io/v1/images/tasks"

payload = {
    "model": "gpt-image-2.5-sunburst-std",
    "prompt": "A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background",
    "aspect_ratio": "1:1",
    "background": "transparent",
    "resolution": "1K"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript 透明な背景
const url = 'https://api.beatapi.io/v1/images/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gpt-image-2.5-sunburst-std","prompt":"A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background","aspect_ratio":"1:1","background":"transparent","resolution":"1K"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 透明な背景
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/images/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background\",\n  \"aspect_ratio\": \"1:1\",\n  \"background\": \"transparent\",\n  \"resolution\": \"1K\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 透明な背景
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/images/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background\",\n  \"aspect_ratio\": \"1:1\",\n  \"background\": \"transparent\",\n  \"resolution\": \"1K\"\n}"

response = http.request(request)
puts response.read_body
```

```java 透明な背景
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/images/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background\",\n  \"aspect_ratio\": \"1:1\",\n  \"background\": \"transparent\",\n  \"resolution\": \"1K\"\n}")
  .asString();
```

```php 透明な背景
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/images/tasks', [
  'body' => '{
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background",
  "aspect_ratio": "1:1",
  "background": "transparent",
  "resolution": "1K"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp 透明な背景
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/images/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gpt-image-2.5-sunburst-std\",\n  \"prompt\": \"A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background\",\n  \"aspect_ratio\": \"1:1\",\n  \"background\": \"transparent\",\n  \"resolution\": \"1K\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 透明な背景
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gpt-image-2.5-sunburst-std",
  "prompt": "A single cartoon red fox sitting, sticker style, thick white outline, isolated on a transparent background",
  "aspect_ratio": "1:1",
  "background": "transparent",
  "resolution": "1K"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/images/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```