跳轉到主要內容
ARouter 透過與 OpenAI 相容的 /v1/images/generations 端點支援圖像生成。

快速開始

curl https://api.arouter.ai/v1/images/generations \
  -H "Authorization: Bearer lr_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/dall-e-3", "prompt": "A futuristic city skyline at sunset, photorealistic", "n": 1, "size": "1024x1024"}'
from openai import OpenAI
client = OpenAI(base_url="https://api.arouter.ai/v1", api_key="lr_live_xxxx")
response = client.images.generate(
    model="openai/dall-e-3",
    prompt="A futuristic city skyline at sunset, photorealistic",
    n=1, size="1024x1024", quality="hd"
)
print(response.data[0].url)

請求參數

參數類型描述
modelstring圖像生成模型 ID
promptstring所需圖像的文字描述。DALL-E 3 最多 4,000 個字元,DALL-E 2 最多 1,000 個字元。
ninteger生成圖像數量(預設 1)。DALL-E 3 僅支援 n=1
sizestring圖像尺寸(因模型而異)
qualitystring"standard""hd"(僅 DALL-E 3,預設 "standard"
stylestring"vivid"(超現實)或 "natural"(僅 DALL-E 3)
response_formatstring"url"(預設)或 "b64_json"

回應格式

{
  "created": 1234567890,
  "data": [
    {"url": "https://...", "revised_prompt": "A photorealistic futuristic city skyline at sunset..."}
  ]
}

圖像尺寸

DALL-E 3

尺寸長寬比
1024x1024正方形(1:1)
1792x1024橫向(16:9)
1024x1792縱向(9:16)

支援的模型

模型提供商解析度風格控制
openai/dall-e-3OpenAI最高 1792×1024style 參數
openai/dall-e-2OpenAI最高 1024×1024
stability/stable-diffusion-3-largeStability AI最高 1024×1024
black-forest-labs/flux-1-proReplicate彈性

定價

模型尺寸費用
openai/dall-e-3 標準版1024×1024$0.040
openai/dall-e-3 標準版1024×1792 或 1792×1024$0.080
openai/dall-e-3 HD 版1024×1024$0.080
openai/dall-e-3 HD 版1024×1792 或 1792×1024$0.120
openai/dall-e-21024×1024$0.020
ARouter 返回的圖像 URL 在 1 小時後過期。請下載並儲存您想保留的圖像。