Skip to main content

接口

POST https://api.omniakey.com/v1/images/generations
此接口兼容 OpenAI Images API。使用多个供应商从文本描述生成图像。

请求示例

from openai import OpenAI

client = OpenAI(
    api_key="your-omniakey-api-key",
    base_url="https://api.omniakey.com/v1"
)

response = client.images.generate(
    model="dall-e-3",
    prompt="宁静的山景在日落时分,数字艺术风格",
    n=1,
    size="1024x1024",
    quality="hd"
)

print(response.data[0].url)

响应

{
  "created": 1709251200,
  "data": [
    {
      "url": "https://api.omniakey.com/files/img-abc123.png",
      "revised_prompt": "一幅令人叹为观止的山景,沐浴在日落的温暖金色光芒中..."
    }
  ]
}

Base64 格式响应

response_format 设为 b64_json 时:
{
  "created": 1709251200,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
    }
  ]
}

请求参数

model
string
required
要使用的模型 ID。可选值:dall-e-3dall-e-2stable-diffusion-3flux-1-promidjourney-v6
prompt
string
required
期望图像的文本描述。最大长度因模型而异(DALL-E 3 最多支持 4000 字符)。
n
integer
要生成的图像数量。范围:1-10。默认:1。注意:DALL-E 3 仅支持 n=1
size
string
图像尺寸。可选值取决于模型:
  • DALL-E 3:1024x10241024x17921792x1024
  • DALL-E 2:256x256512x5121024x1024
  • Stable Diffusion 3:1024x1024768x10241024x768
默认:1024x1024
quality
string
图像质量。可选值:standardhd。默认:standard。仅 DALL-E 3 支持。
style
string
图像风格。可选值:vividnatural。默认:vivid。仅 DALL-E 3 支持。
response_format
string
响应格式。可选值:urlb64_json。默认:url。URL 在 1 小时后过期。

支持的模型

模型供应商最大分辨率特性
DALL-E 3OpenAI1792x1024高清质量、风格控制、提示词优化
DALL-E 2OpenAI1024x1024批量生成(最多 10 张)
Stable Diffusion 3Stability AI1024x1024精细控制、反向提示词
FLUX.1 ProBlack Forest Labs1024x1024照片级真实感
Midjourney V6Midjourney1024x1024艺术风格、高美感

查看全部模型

查看完整列表