Professional-grade AI image generation with advanced segmentation, video processing, and media retrieval capabilities. OpenAI-compatible API with state-of-the-art models.
Generate your first image in just a few minutes
Sign up at univence.com and generate your API key from the dashboard.
Use our comprehensive REST API for image generation, segmentation, and media management. The API is fully compatible with OpenAI's format.
Get your generated images instantly with URLs you can use anywhere.
curl -X POST "https://api.univence.com/v1/images/generations" \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key-here" \
-d '{
"model": "z-image-turbo",
"prompt": "a beautiful sunset over mountains, digital art, highly detailed",
"image_size": "1024x1024"
}'
Everything you need for professional image generation
Lightning-fast generation with state-of-the-art AI models optimized for speed and quality.
Generate up to 5 images simultaneously with our batch API endpoint for maximum efficiency.
Fine-tune your generations with negative prompts, seeds, inference steps, and more.
Advanced AI-powered segmentation to identify and separate objects within images for precise editing.
Per-frame mask generation for video content with object tracking and separation capabilities.
Comprehensive file access and management for all your generated content and media assets.
Drop-in replacement for OpenAI's image generation API with familiar interface.
Complete documentation for all endpoints, parameters, and examples
Generate a single image from a text prompt using advanced AI models. Supports various image sizes and generation parameters.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
model |
string | Yes | The AI model to use for generation | "z-image-turbo" |
prompt |
string | Yes | Text description of the image to generate | "a beautiful sunset over mountains" |
image_size |
string | No | Output image dimensions | "1024x1024" |
negative_prompt |
string | No | Things to avoid in the image | "blurry, low quality" |
seed |
integer | No | Random seed for reproducible results | 12345 |
num_inference_steps |
integer | No | Number of denoising steps (1-100) | 50 |
guidance_scale |
float | No | How closely to follow the prompt (1-20) | 7.5 |
{
"created": 1634567890,
"data": [
{
"url": "https://api.univence.com/v1/media/abc123.jpg",
"revised_prompt": "a beautiful sunset over mountains, digital art"
}
]
}
Generate up to 5 images simultaneously in a single request for maximum efficiency.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
requests |
array | Yes | Array of generation requests (max 5) | [{...}, {...}] |
response_format |
string | No | Response format: "url" or "b64_json" | "url" |
curl -X POST "https://api.univence.com/v1/images/generations/batch" \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key-here" \
-d '{
"requests": [
{
"model": "z-image-turbo",
"prompt": "a red sports car"
},
{
"model": "z-image-turbo",
"prompt": "a blue sports car"
}
]
}'
Enhance and upscale existing images using advanced AI algorithms. Supports multiple upscaling methods and factors (2x, 4x, 8x).
| Model | Description | Best For | Supported Factors |
|---|---|---|---|
realesrgan_2x |
Real-ESRGAN 2x upscaling | General photos, landscapes | 2x |
realesrgan_4x |
Real-ESRGAN 4x upscaling | High-quality photos, portraits | 4x |
realesrgan_4x_anime |
Real-ESRGAN optimized for anime | Anime, cartoon, illustrations | 4x |
swin2sr |
Swin2SR transformer-based | High-detail restoration | 2x, 4x |
lanczos |
Classical Lanczos interpolation | Simple upscaling, fast processing | 2x, 4x, 8x |
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
image_url |
string | Yes | URL of the image to upscale | "https://example.com/image.jpg" |
upscale_factor |
integer | Yes | Upscaling factor: 2, 4, or 8 | 4 |
model |
string | No | Upscaling model (defaults to realesrgan_4x) | "realesrgan_4x" |
enhance_details |
boolean | No | Enhance fine details during upscaling | true |
noise_reduction |
boolean | No | Apply noise reduction before upscaling | false |
output_format |
string | No | Output format: "png", "jpg", "webp" | "png" |
{
"created": 1634567890,
"data": [
{
"url": "https://api.univence.com/v1/media/upscale_abc123.jpg",
"original_size": "512x512",
"upscale_factor": 4,
"new_size": "2048x2048",
"model_used": "realesrgan_4x",
"processing_time": 2.34,
"file_size": "2.1MB"
}
]
}
curl -X POST "https://api.univence.com/v1/images/upscale" \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key-here" \
-d '{
"image_url": "https://example.com/low-res.jpg",
"upscale_factor": 4,
"model": "realesrgan_4x",
"enhance_details": true,
"noise_reduction": true,
"output_format": "png"
}'
// JavaScript/Node.js Example
async function upscaleImage(imageUrl, factor = 4) {
const response = await fetch('https://api.univence.com/v1/images/upscale', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key'
},
body: JSON.stringify({
image_url: imageUrl,
upscale_factor: factor,
model: 'realesrgan_4x',
enhance_details: true
})
});
if (!response.ok) {
throw new Error(`Upscaling failed: ${response.statusText}`);
}
const result = await response.json();
return result.data[0].url;
}
// Python Example
import requests
def upscale_image(image_url, factor=4, model='realesrgan_4x'):
url = "https://api.univence.com/v1/images/upscale"
headers = {
"Content-Type": "application/json",
"X-API-Key": "your-api-key"
}
data = {
"image_url": image_url,
"upscale_factor": factor,
"model": model,
"enhance_details": True
}
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
result = response.json()
return result['data'][0]['url']
AI-powered object segmentation and mask generation for precise image editing and analysis.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
image_url |
string | Yes | URL of the image to segment | "https://example.com/image.jpg" |
model |
string | No | Segmentation model type | "sam-vit-h" |
confidence_threshold |
float | No | Minimum confidence for segmentation (0-1) | 0.7 |
output_format |
string | No | Mask output format: "png" or "json" | "png" |
Per-frame mask generation for video content with object tracking and separation capabilities.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
video_url |
string | Yes | URL of the video to segment | "https://example.com/video.mp4" |
model |
string | No | Video segmentation model | "video-sam" |
frame_interval |
integer | No | Process every N frames (1-30) | 5 |
max_duration |
integer | No | Maximum video duration in seconds | 300 |
Comprehensive file access and management for all generated content and media assets.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
mediaFileId |
string | Yes | Unique identifier for the media file | "abc123def456" |
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
format |
string | No | Output format: "original", "jpg", "png", "webp" | "jpg" |
quality |
integer | No | Compression quality (1-100) | 90 |
Secure your API requests with API key authentication
All API requests require authentication using your API key. Include it in the request headers.
curl -X POST "https://api.univence.com/v1/images/generations" \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key-here" \
-d '{"model": "z-image-turbo", "prompt": "a beautiful sunset"}'
const response = await fetch('https://api.univence.com/v1/images/generations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key-here'
},
body: JSON.stringify({
model: 'z-image-turbo',
prompt: 'a beautiful sunset over mountains'
})
});
const result = await response.json();
import requests
url = "https://api.univence.com/v1/images/generations"
headers = {
"Content-Type": "application/json",
"X-API-Key": "your-api-key-here"
}
data = {
"model": "z-image-turbo",
"prompt": "a beautiful sunset over mountains"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
Understanding and handling API errors effectively
| Status Code | Description | Common Causes |
|---|---|---|
200 |
Success | Request completed successfully |
201 |
Created | Resource created successfully (batch operations) |
400 |
Bad Request | Invalid parameters, malformed JSON |
401 |
Unauthorized | Missing or invalid API key |
402 |
Payment Required | Insufficient credits or billing issues |
404 |
Not Found | Media file not found or expired |
413 |
Payload Too Large | Image/video file too large |
429 |
Rate Limited | Too many requests, quota exceeded |
500 |
Server Error | Internal server error, try again later |
503 |
Service Unavailable | Model temporarily unavailable |
{
"error": {
"code": "INVALID_MODEL",
"message": "The specified model 'invalid-model' is not available",
"type": "invalid_request_error",
"details": {
"available_models": ["z-image-turbo", "longcat-image-edit"],
"request_id": "req_123456789",
"timestamp": "2025-12-20T18:20:05Z"
}
}
}
| Error Code | Description | Solution |
|---|---|---|
INVALID_API_KEY |
API key is missing or invalid | Check your API key and ensure it's properly formatted |
INSUFFICIENT_CREDITS |
Not enough credits for the request | Add credits to your account or upgrade your plan |
RATE_LIMIT_EXCEEDED |
Too many requests in a short time | Implement rate limiting or upgrade your plan |
INVALID_IMAGE_URL |
Image URL is inaccessible or invalid | Verify the image URL is publicly accessible |
PROMPT_TOO_LONG |
Prompt exceeds maximum length | Shorten your prompt or use our prompt optimization |
INVALID_UPSCALE_FACTOR |
Upscale factor must be 2, 4, or 8 | Use only supported upscale factors |
VIDEO_TOO_LONG |
Video exceeds maximum duration | Shorten video or increase max_duration parameter |
BATCH_SIZE_EXCEEDED |
Batch request exceeds 5 images | Limit batch requests to 5 images maximum |
Understanding API rate limits and best practices
| Plan | Requests/Minute | Requests/Hour | Concurrent Requests |
|---|---|---|---|
| Free Tier | 10 | 100 | 1 |
| Premium | 60 | 1000 | 5 |
| Enterprise | 200 | 5000 | 20 |
All responses include rate limit information:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1634567890
X-RateLimit-Window: 60
import time
import requests
def generate_image_with_retry(prompt, max_retries=3):
for attempt in range(max_retries):
try:
response = requests.post(
'https://api.univence.com/v1/images/generations',
headers={'X-API-Key': 'your-api-key'},
json={'model': 'z-image-turbo', 'prompt': prompt}
)
if response.status_code == 429:
# Rate limited, wait and retry
reset_time = int(response.headers.get('X-RateLimit-Reset', 60))
wait_time = min(reset_time, 60)
print(f"Rate limited. Waiting {wait_time} seconds...")
time.sleep(wait_time)
continue
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
if attempt == max_retries - 1:
raise e
time.sleep(2 ** attempt) # Exponential backoff
Optimize your API usage with effective caching strategies
Generated images and media files are cached for performance:
// Client-side caching example
class MediaCache {
constructor() {
this.cache = new Map();
this.ttl = 24 * 60 * 60 * 1000; // 24 hours
}
generateCacheKey(prompt, params) {
return btoa(JSON.stringify({prompt, ...params}));
}
isValid(timestamp) {
return Date.now() - timestamp < this.ttl;
}
async getOrGenerate(prompt, params, generator) {
const key = this.generateCacheKey(prompt, params);
const cached = this.cache.get(key);
if (cached && this.isValid(cached.timestamp)) {
return cached.data;
}
const result = await generator(prompt, params);
this.cache.set(key, {
data: result,
timestamp: Date.now()
});
return result;
}
}
Choose from our collection of powerful AI models
Delivers strong photorealistic image generation while maintaining excellent aesthetic quality.
Large-scale image editing model for advanced image manipulation and style transfer.
Flexible pricing that grows with your needs
Professional-grade AI image generation
Credit System: 1 Credit = $0.01 USD. Premium users get free access to all features including image generation, segmentation, and media retrieval!
New Pricing: Image Generation ($0.002/image), Image Segmentation ($0.0025/image), Video Segmentation ($0.0025/frame)
Join thousands of developers creating amazing images with our AI API