API概览

UGOOE提供RESTful API接口,支持GPT Image 2图像生成、AI对话等核心服务。所有API通过HTTPS协议访问,返回JSON格式数据。 基础URL:https://api.ugooe.cn/v1

快速开始

使用您的API密钥进行身份验证,密钥可在控制台获取。

Python示例

import requests

API_KEY = "your-api-key-here"
headers = {"Authorization": f"Bearer {API_KEY}"}

# 生成图像
response = requests.post(
    "https://api.ugooe.cn/v1/images/generations",
    headers=headers,
    json={
        "prompt": "一只在月球上打太极的熊猫,赛博朋克风格",
        "n": 1,
        "size": "1024x1024"
    }
)
print(response.json()["data"][0]["url"])

curl示例

curl -X POST https://api.ugooe.cn/v1/images/generations \
  -H "Authorization: Bearer your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"赛博朋克风格的未来城市","n":1,"size":"1024x1024"}'

API端点

GET /v1/models 获取可用模型列表
POST /v1/images/generations 根据提示词生成图像
POST /v1/chat/completions AI对话补全