画像生成(Image Generation)

複数のスタイルとサイズに対応したAI画像生成インターフェースです。テキストの説明から高品質な画像を生成します。

APIエンドポイント

POST/image/generation

画像の生成

リクエストパラメータ

パラメータ必須説明
modelstring必須モデル名:image-01
promptstring必須画像の説明テキスト
ninteger任意生成する画像の枚数、デフォルト1
sizestring任意画像サイズ(例:1024x1024)
aspect_ratiostring任意アスペクト比(例:16:9、1:1)

リクエスト例

リクエスト例
{
  "model": "image-01",
  "prompt": "一幅水墨画风格的山水画,远处有云雾缭绕的山峰",
  "n": 1,
  "aspect_ratio": "16:9"
}

レスポンス例

レスポンス例
{
  "data": [
    {
      "url": "https://...",
      "revised_prompt": "..."
    }
  ],
  "usage": {
    "image_count": 1
  }
}

コード例

import requests

url = "https://your-proxy-domain.com/v1/image/generation"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "model": "image-01",
    "prompt": "一幅水墨画风格的山水画,远处有云雾缭绕的山峰",
    "n": 1,
    "aspect_ratio": "16:9"
}

response = requests.post(url, headers=headers, json=data)
result = response.json()
print("图片URL:", result["data"][0]["url"])