跳转到主要内容
POST
https://llm.ai-nebula.com
/
v1
/
images
/
generations
图片生成
curl --request POST \
  --url https://llm.ai-nebula.com/v1/images/generations \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "response_format": "<string>",
  "contents": [
    {}
  ]
}
'
{
  "code": 200,
  "msg": "操作成功",
  "data": {
    "data": [
      {
        "url": "",
        "b64_json": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQA...",
        "revised_prompt": ""
      }
    ],
    "created": 1757320007
  }
}

认证

Authorization
string
required
Bearer Token,如 Bearer sk-xxxxxxxxxx

请求参数

model
string
required
模型名称,如 gemini-2.5-flash-image-preview
prompt
string
文生图的提示词
response_format
string
default:"url"
响应格式:b64_jsonurl
contents
array
图生图或上下文对话的多轮内容

文生图

curl -X POST "https://llm.ai-nebula.com/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash-image-preview",
    "prompt": "一只可爱的橙色小猫坐在花园里,阳光明媚,高质量摄影",
    "response_format": "b64_json"
  }'

图生图

curl -X POST "https://llm.ai-nebula.com/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash-image-preview",
    "response_format": "b64_json",
    "contents": [
      {
        "role": "user",
        "parts": [
          {"text": "根据这张图帮我生成一张俯瞰广州塔的图片"},
          {"image": "data:image/png;base64,iVBORw0KGgoAAxxxx..."}
        ]
      }
    ]
  }'

上下文对话

curl -X POST "https://llm.ai-nebula.com/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash-image-preview",
    "response_format": "b64_json",
    "contents": [
      {
        "role": "user",
        "parts": [
          {"text": "根据这张图帮我生成一张俯瞰广州塔的图片"},
          {"image": "data:image/png;base64,iVBORw0KGgoAAxxxx..."}
        ]
      },
      {
        "role": "model",
        "parts": [
          {"text": "已为您生成1张图片"},
          {"image": "data:image/png;base64,iVBORw0KGgoAAxxxx..."}
        ]
      },
      {
        "role": "user",
        "parts": [
          {"text": "把景色换成夜色下雪的场景"}
        ]
      }
    ]
  }'
{
  "code": 200,
  "msg": "操作成功",
  "data": {
    "data": [
      {
        "url": "",
        "b64_json": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQA...",
        "revised_prompt": ""
      }
    ],
    "created": 1757320007
  }
}