铸云 AI

图像生成

POST/v1/images/generations

请求参数

参数类型必填说明
modelstring模型,如 dall-e-3, dall-e-2
promptstring图像描述
ninteger生成数量 1-10,默认 1
sizestring图像尺寸 1024x1024, 1792x1024, 1024x1792
qualitystring标准 standard 或 高清 hd
response_formatstringurl 或 b64_json

请求示例

cURL

curl https://api.mintcloud.ai/v1/images/generations \
  -H "Authorization: Bearer $MINTCLOUD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "一只可爱的猫咪",
    "size": "1024x1024"
  }'

Python

import requests

response = requests.post(
    "https://api.mintcloud.ai/v1/images/generations",
    headers={
        "Authorization": "Bearer $MINTCLOUD_API_KEY",
        "Content-Type": "application/json",
    },
    json={
        "model": "dall-e-3",
        "prompt": "一只可爱的猫咪",
        "size": "1024x1024",
    },
)

print(response.json())

TypeScript

const response = await fetch(
  "https://api.mintcloud.ai/v1/images/generations",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer $MINTCLOUD_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "dall-e-3",
      prompt: "一只可爱的猫咪",
      size: "1024x1024",
    }),
  }
);

const data = await response.json();
console.log(data);

响应格式

{
  "created": 1699888000,
  "data": [
    {
      "url": "https://...",
      "revised_prompt": "..."
    }
  ]
}

支持的模型

dall-e-3 (推荐)dall-e-2