APIリファレンス
画像生成と編集
OpenAI互換の画像APIで画像を生成または編集します。
画像APIは生成と編集をサポートしています。正確なサイズ、品質値、フォーマット、ストリーミングのサポートはモデルとアップストリームチャネルによって異なります。
エンドポイント
| メソッド | パス | 説明 |
|---|---|---|
POST | /v1/images/generations | 画像を生成します |
POST | /v1/images/edits | 画像を編集します。JSONまたはマルチパートフォーム入力に対応 |
POST | /v1/edits | 互換パス。/v1/images/edits の使用を推奨 |
リクエストフィールド
| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
model | string | 必須 | 画像モデルID |
prompt | string | 生成時は必須 | 画像プロンプト |
n | integer | 任意 | 画像の枚数、デフォルトは1 |
size | string | 任意 | 1024x1024 のような画像サイズ。乗算記号 × は使用しないでください |
quality | string | 任意 | standard、hd または auto などの品質 |
response_format | string | 任意 | url または b64_json などのレスポンス形式、モデルにより異なります |
style | any | 任意 | OpenAI画像拡張フィールド |
background, moderation | any | 任意 | 新しい画像モデルの拡張フィールド |
output_format, output_compression | any | 任意 | 出力形式と圧縮オプション |
partial_images, stream | any | 任意 | ストリーミングに対応した画像モデルで使用 |
image, images | file/string/array | 編集時は必須 | 編集対象の画像。マルチパートでは image、image[] または image[n] を受け付けます |
mask | file/string | 任意 | 編集マスク |
input_fidelity | any | 任意 | 入力忠実度、モデルにより異なります |
watermark | boolean | 任意 | 透かしのオン/オフ、チャネルのサポート状況により異なります |
画像を生成する
curl https://api.tensoraxis.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TENSORAXIS_API_KEY" \
-d '{
"model": "gpt-image-1",
"prompt": "A minimalist poster of a futuristic city",
"size": "1024x1024"
}'画像を編集する
ローカルファイルをアップロードする場合はマルチパートフォームデータを使用します:
curl https://api.tensoraxis.com/v1/images/edits \
-H "Authorization: Bearer $TENSORAXIS_API_KEY" \
-F model="gpt-image-1" \
-F prompt="Change the background to a night city" \
-F image="@input.png"選択したモデルが対応している場合、JSON形式の画像URLも使用できます:
{
"model": "gpt-image-1",
"prompt": "Change the background to a night city",
"image": "https://example.com/input.png"
}レスポンス形式
{
"created": 1710000000,
"data": [
{
"url": "https://example.com/result.png",
"b64_json": "",
"revised_prompt": "..."
}
]
}動画生成は画像APIではありません。Seedance / Doubao の動画モデルについては、動画生成 の非同期タスクボディを使用してください。