Learn how to integrate Reve Art image generation into your application
All API requests require authentication using an API key.
Add the API key to the Authorization header:
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"}'
Please login and add your api-key in the Dashboard > API Key page.
Then use the api-key to generate images.
{
"prompt": "string", // Required: The image generation prompt
"negative_prompt": "string", // Optional: Things to avoid in the image
"aspect_ratio": "string", // Required: Image aspect ratio (default: "1:1")
"async": boolean // Optional: Async generation (default: false)
}
The aspect ratio of the image. Supported ratios: "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;
}
{
"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 requests are limited by your subscription plan and available credits.