Reve Art API 文件
歡迎使用 Reve Art 的圖像生成 API。該服務透過簡單的 REST API 提供了最先進的 AI 圖像生成能力。
Reve Image 1.0 簡介
Reve Image 1.0 是我們的旗艦文字轉圖像生成模型,其設計重點在於:
- 卓越的提示詞遵循性
- 高美學品質
- 精確的排版渲染
- 直觀的文字轉圖像生成
該模型旨在產生高品質的結果,而無需進階的提示工程專業知識,這使得初學者和經驗豐富的使用者都可以輕鬆使用。您可以在 Create Image 免費試用。
用例
Reve Art API 可以整合到各種應用程式中:
- 內容創作:為部落格、文章和社群媒體生成獨特的視覺效果
- 電子商務:建立產品模型和變化
- 設計與原型製作:快速視覺化設計概念
- 遊戲與娛樂:產生遊戲資產和角色設計
- 教育:建立教育材料和插圖
身份驗證
所有 API 請求都需要使用 API 金鑰進行身份驗證。
將 API 金鑰新增到授權標頭:
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 金鑰
請登入並在 Dashboard > API Key 頁面中新增您的 API 金鑰。
然後使用 API 金鑰生成圖像。
產生圖像
圖像生成端點允許您從文字描述中建立圖像。您可以透過參數控制生成過程的各個方面。
最佳實踐
-
提示詞工程
- 在您的提示詞中保持具體和描述性
- 使用藝術術語來引導風格
- 包括有關光線、視角和氛圍的詳細資訊
-
長寬比選擇
- 根據您的預期用途進行選擇
- 1:1 用於社群媒體貼文
- 16:9 用於簡報/橫幅
- 9:16 用於行動內容
-
非同步生成
- 使用 async=true 進行較長的生成
- 實施狀態輪詢以獲得更好的使用者體驗
POST /v1/images/generate
Request Body
{
"prompt": "string", // 必填:圖像生成提示詞
"negative_prompt": "string", // 可選:圖像中要避免的事物
"aspect_ratio": "string", // 必填:圖像長寬比(預設值:"1:1")
"async": boolean // 可選:非同步生成(預設值: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 請求受到您的訂閱方案和可用點數的限制。