Reve Art API 文档

欢迎使用 Reve Art 的图像生成 API。该服务通过简单的 REST API 提供最先进的 AI 驱动的图像生成功能。

Reve Image 1.0 简介

Reve Image 1.0 是我们旗舰的文本到图像生成模型,其重点在于:

  • 卓越的提示词遵循性
  • 高审美质量
  • 准确的排版渲染
  • 直观的文本到图像生成

该模型旨在生成高质量的结果,而无需高级的提示词工程专业知识,这使其对初学者和经验丰富的用户都具有可访问性。您可以在 创建图像 免费试用。

用例

Reve Art API 可以集成到各种应用程序中:

  • 内容创作:为博客、文章和社交媒体生成独特的视觉效果
  • 电子商务:创建产品模型和变体
  • 设计与原型设计:快速可视化设计概念
  • 游戏与娱乐:生成游戏素材和角色设计
  • 教育:创建教育材料和插图

身份验证

所有 API 请求都需要使用 API 密钥进行身份验证。

将 API 密钥添加到 Authorization 标头:

curl -X POST https://reve-art.com/v1/reve-image/generate \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{"prompt": "your prompt here", "aspect_ratio": "1:1"}'

如何获取 API 密钥

请登录并在 仪表板 > API 密钥 页面中添加您的 API 密钥。

然后使用 API 密钥生成图像。

生成图像

图像生成端点允许您从文本描述中创建图像。您可以通过参数控制生成的各个方面。

最佳实践

  1. 提示词工程

    • 在提示词中保持具体和描述性
    • 使用艺术术语进行风格指导
    • 包含关于光照、透视和情绪的细节
  2. 宽高比选择

    • 根据您的预期用例选择
    • 1:1 用于社交媒体帖子
    • 16:9 用于演示文稿/横幅
    • 9:16 用于移动内容
  3. 异步生成

    • 使用 async=true 进行更长时间的生成
    • 实施状态轮询以获得更好的用户体验

POST /v1/images/generate

请求体

{
  "prompt": "string",           // 必需:图像生成提示词
  "negative_prompt": "string",  // 可选:图像中要避免的事物
  "aspect_ratio": "string",    // 必需:图像宽高比 (default: "1:1")
  "async": boolean             // 可选:异步生成 (default: false)
}

宽高比

图像的宽高比。支持的比例:"1:1", "16:9", "4:3", "3:4", "9:16", "2:3", "3:2"。

同步响应

{
  "id": "img_123",
  "status": "completed",
  "url": "https://cdn.reve-art.com/img_123.png",
  "metadata": {
    "prompt": "your prompt",
    "width": 1024,
    "height": 1024,
    "created_at": "2024-01-01T00:00:00Z"
  }
}

异步响应

{
  "id": "img_123",
  "status": "pending"
}

示例用法

Python:

import requests

api_key = "your_api_key"
headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

response = requests.post(
    "https://api.reve-art.com/v1/reve-image/generate",
    headers=headers,
    json={
        "prompt": "a beautiful sunset over mountains",
        "aspect_ratio": "16:9"
    }
)

if response.ok:
    result = response.json()
    print(f"Image URL: {result['url']}")
else:
    print(f"Error: {response.text}")

Node.js:

async function generateImage(prompt: string) {
  const response = await fetch("https://api.reve-art.com/v1/reve-image/generate", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      prompt,
      aspect_ratio: "1:1",
      async: true,
    }),
  });

  if (!response.ok) {
    throw new Error(`Failed to generate image: ${response.statusText}`);
  }

  const result = await response.json();
  
  if (result.status === "pending") {
    // Poll for completion
    return await checkImageStatus(result.id);
  }

  return result;
}

检查图像状态

GET /v1/reve-image/status/image_id

响应

{
  "id": "img_123",
  "status": "completed",
  "url": "https://cdn.reve-art.com/img_123.png",
  "metadata": {
    "prompt": "original prompt",
    "width": 1024,
    "height": 1024,
    "model": "text2image_v1",
    "created_at": "2024-01-01T00:00:00Z"
  }
}

示例用法

async function checkImageStatus(imageId: string) {
  const response = await fetch(
    `https://reve-art.com/v1/reve-image/status/${imageId}/`,
    {
      headers: {
        "Authorization": `Bearer ${apiKey}`,
      },
    }
  );

  if (!response.ok) {
    throw new Error(`Failed to check status: ${response.statusText}`);
  }

  return await response.json();
}

速率限制

API 请求受到您的订阅计划和可用积分的限制。

  • 每次图像生成消耗 1 个积分
  • 免费计划:包含 3 个积分
  • 基本计划:每月 100 个积分
  • 速率限制:每分钟 10 个请求
  • 如果您需要更多积分,请 升级您的计划购买更多积分