> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acedata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# GPT Image 2.6 API

> OpenAI generation API guide - Ace Data Cloud

GPT Image 2.6 を使用してテキストから画像を生成したり、参照画像に基づいて編集したりできます。まず公開モデルを選択し、同じ画像 API を使用して連携します。

## モデルを選択

| モデル | 選択と呼び出し先 |
| - | - |
| `gpt-image-2.6-flare` | Flare モデル。対応するモデルページで機能、料金、最小リクエストを確認 |
| `gpt-image-2.6-sunburst` | Sunburst モデル。対応するモデルページで機能、料金、最小リクエストを確認 |
| `:official` と `:reverse` のバリアント | モデル ID のサフィックスは公開呼び出し名の一部です。各バリアントの料金とサポートされるパラメータは、該当するモデルページを参照 |

* [Flare](https://platform.acedata.cloud/models/gpt-image-2.6-flare?m=image) · [Flare official](https://platform.acedata.cloud/models/gpt-image-2.6-flare%3Aofficial?m=image) · [Flare reverse](https://platform.acedata.cloud/models/gpt-image-2.6-flare%3Areverse?m=image)
* [Sunburst](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst?m=image) · [Sunburst official](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst%3Aofficial?m=image) · [Sunburst reverse](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst%3Areverse?m=image)

## 画像生成リクエストを準備

[アプリケーション一覧](https://platform.acedata.cloud/console/applications)で汎用アプリケーションを開き、**API KEY** の右側にあるコピーボタンをクリックします。次に、このキーを使って画像を1枚生成します。制限付きキーを使用する場合は、画像生成が許可されていることを確認してください。参照画像の編集には、画像編集の権限も必要です。

## 最初の画像を生成

```bash theme={null}
export ACEDATACLOUD_API_KEY="YOUR_API_KEY"
curl --fail-with-body 'https://api.acedata.cloud/openai/images/generations' \
  --header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-image-2.6-flare",
    "prompt": "A white ceramic coffee mug on a blue table, soft morning light, no text.",
    "size": "1024x1024",
    "n": 1,
    "response_format": "url"
  }'
```

### レスポンス JSON

以下は既存の Images レスポンスからの抜粋で、タスク ID、モデル、画像 URL の位置を示しています。選択したモデルと画像アドレスは、今回のリクエストの戻り値を参照してください。

```json theme={null}
{
  "success": true,
  "task_id": "49848451-c624-4df9-9dc2-494018daaf4c",
  "trace_id": "5ac021c2-2891-4eed-bfcf-4c6668ac1be1",
  "created": 1788831893,
  "data": [
    {
      "url": "https://cdn.acedata.cloud/assets/examples/gpt-image/49848451-c624-4df9-9dc2-494018daaf4c_0-b6d780a732ca.png"
    }
  ]
}
```

同期レスポンスが返されたら、`data[].url` から生成された画像を読み取ります。画面比率、品質、出力形式を調整する場合は、[画像生成ガイド](https://platform.acedata.cloud/documents/openai-images-generations-integration)を参照してください。`b64_json` 形式での返却を選択した場合は、ガイドに従って対応する結果をデコードします。

## 参照画像を編集

`YOUR_IMAGE_URL` をアクセス可能な参照画像のアドレスに置き換え、変更する内容を記述します。

```bash theme={null}
curl --fail-with-body 'https://api.acedata.cloud/openai/images/edits' \
  --header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-image-2.6-flare",
    "image": "YOUR_IMAGE_URL",
    "prompt": "Change the mug to dark green and keep the composition.",
    "n": 1,
    "response_format": "url"
  }'
```

### レスポンス JSON

以下は既存の Images レスポンスからの抜粋で、タスク ID、モデル、画像 URL の位置を示しています。選択したモデルと画像アドレスは、今回のリクエストの戻り値を参照してください。

```json theme={null}
{
  "success": true,
  "task_id": "49848451-c624-4df9-9dc2-494018daaf4c",
  "trace_id": "5ac021c2-2891-4eed-bfcf-4c6668ac1be1",
  "created": 1788831893,
  "data": [
    {
      "url": "https://cdn.acedata.cloud/assets/examples/gpt-image/49848451-c624-4df9-9dc2-494018daaf4c_0-b6d780a732ca.png"
    }
  ]
}
```

編集結果も同様に `data[].url` から読み取ります。複数画像、マスク、サイズ、形式の入力要件については、[画像編集ガイド](https://platform.acedata.cloud/documents/openai-images-edits-integration)を参照してください。

## 長時間タスクとエラーからの復旧

非同期方式が必要な場合は、画像インターフェースのドキュメントに従って `async=true` を設定し、返されたタスク ID を保存します。[OpenAI タスク照会](https://platform.acedata.cloud/documents/openai-tasks-integration)を使用して元のタスクの最終結果を取得し、待機中の重複送信を避けます。認証、残高、パラメータのエラーはレスポンス内の `error` に従って処理し、調査のために `trace_id` を保存します。

完全な呼び出し例とその他の機能への入り口については、[OpenAIAPI](https://github.com/AceDataCloud/OpenAIAPI)を参照してください。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.