Comprehensive API for image generation, LLM chat, voice cloning, segmentation, upscaling, and background removal. OpenAI-compatible with powerful additional features.
Everything you need to know about the API
https://api.univence.com
All endpoints require authentication via:
X-API-Key: your-api-key in headers1. Sign up at univence.com
2. Visit univence.com/account to generate your API key
3. Start making requests!
Complete documentation for all endpoints
Generate a single image from a text prompt using OpenAI-compatible format.
curl -X POST https://api.univence.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"model": "z-image-turbo",
"prompt": "A beautiful sunset over mountains",
"negative_prompt": "blurry, distorted, low quality",
"image_size": "1024x1024",
"seed": 12345
}'
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
model |
string | No | Model to use for generation | "z-image-turbo" |
prompt |
string | Yes | Text description for image generation | - |
negative_prompt |
string | No | Things to avoid in the image | "blurry, distorted, low quality, bad anatomy, text, watermark, signature" |
image_size |
string | No | Output image dimensions | "1024x1024" |
seed |
integer | No | Random seed for reproducible results | null |
batch_size |
integer | No | Number of images to generate | 1 |
num_inference_steps |
integer | No | Number of inference steps | null |
guidance_scale |
float | No | Guidance scale for generation | null |
cfg |
float | No | CFG scale | null |
image |
string | No | Base64 encoded image for img2img | null |
256x256512x5121024x10241024x17921792x1024| Model | Description | Max Width | Max Height | Text-to-Image |
|---|---|---|---|---|
z-image-turbo |
Default model, fast generation | 1792 | 1792 | Yes |
longcat-image-edit |
Wide aspect ratio, editing | 1792 | 1024 | Yes |
The following OpenAI/SiliconFlow model names are automatically mapped to internal models:
flux-schnell → z-image-turboqwen/qwen-image → z-image-turbopixart-sigma → z-image-turbodall-e-3 → z-image-turbodall-e-2 → z-image-turbo{
"created": 1703123456,
"data": [
{
"url": "https://api.univence.com/v1/media/abc123",
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
"revised_prompt": null
}
]
}
Non-premium users: Variable cost based on model, dimensions, and user pricing tier
Premium users: Free (0 credits)
Generate multiple images in a single request (max 5 requests).
curl -X POST https://api.univence.com/v1/images/generations/batch \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"requests": [
{
"model": "z-image-turbo",
"prompt": "A red sports car",
"image_size": "512x512"
},
{
"model": "z-image-turbo",
"prompt": "A blue ocean wave",
"image_size": "1024x1024"
}
]
}'
| Parameter | Type | Required | Description |
|---|---|---|---|
requests |
array | Yes | Array of image generation requests (max 5) |
requests[].model |
string | No | Model for this request |
requests[].prompt |
string | Yes | Text description for this image |
requests[].negative_prompt |
string | No | Things to avoid |
requests[].image_size |
string | No | Image dimensions |
requests[].seed |
integer | No | Random seed |
{
"data": [
{
"created": 1703123456,
"data": [
{
"url": "https://api.univence.com/v1/media/abc123",
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
"revised_prompt": null
}
]
},
{
"created": 1703123457,
"data": [
{
"url": "https://api.univence.com/v1/media/def456",
"b64_json": "iVBORw0KGgoAAAANSUhEUgBB...",
"revised_prompt": null
}
]
}
]
}
Non-premium users: Sum of costs for all images in batch
Premium users: Free (0 credits)
Retrieve media files including original and transcoded files. This endpoint is publicly accessible (no authentication required) and supports caching.
curl -X GET https://api.univence.com/v1/media/xyz789
| Parameter | Type | Required | Description |
|---|---|---|---|
mediaFileId |
string | Yes | The media file ID |
Returns media file directly with appropriate MIME type headers.
Supported MIME Types:
image/jpegimage/pngimage/gifimage/webpSegment objects from an image using AI-powered SAM3 segmentation.
curl -X POST https://api.univence.com/v1/images/segmentations \
-H "X-API-Key: your-api-key" \
-F "file=@image.jpg" \
-F "prompt=segment person in image"
| Parameter | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | Image file to segment |
prompt |
string | Yes | Description of what to segment |
Returns segmented image as PNG:
Content-Type: image/pngContent-Disposition: inline; filename="segmented_image.png"Non-premium users: 0.25 credits per image
Premium users: Free (0 credits)
Upscale an existing image using various AI-powered upscaling methods.
curl -X POST https://api.univence.com/v1/images/upscale \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"image": "iVBORw0KGgoAAAANSUhEUgAA...",
"method": "realesrgan_4x",
"scale": 4,
"face_enhance": false
}'
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
image |
string | Yes | Base64 encoded image data | - |
method |
string | Yes | Upscaling method to use | - |
scale |
integer | No | Scale factor for backward compatibility | 2 |
face_enhance |
boolean | No | Enable face enhancement | false |
| Method | Scale Factor | Description | Best For |
|---|---|---|---|
realesrgan_2x |
2x | Real-ESRGAN 2x upscaling | General purpose, fast |
realesrgan_4x |
4x | Real-ESRGAN 4x upscaling | High quality, general purpose |
realesrgan_4x_anime |
4x | Real-ESRGAN 4x with anime optimization | Anime, cartoon images |
swin2sr |
2x-4x | Swin2SR transformer-based upscaling | High quality, research |
lanczos |
2x-8x | Traditional Lanczos resampling | Simple upscaling, small files |
{
"created": 1703123456,
"data": [
{
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
]
}
Non-premium users: Variable cost based on method and target resolution
Premium users: Free (0 credits)
Remove background from an image using AI-powered segmentation. The system segments specified object(s) and makes the background transparent.
curl -X POST https://api.univence.com/v1/images/remove-background \
-H "X-API-Key: your-api-key" \
-F "file=@photo.jpg" \
-F "prompt=person"
| Parameter | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | Image file to process |
prompt |
string | Yes | Description of object to keep (background will be removed) |
Returns processed image with transparent background as PNG:
Content-Type: image/pngContent-Disposition: inline; filename="background_removed.png"Non-premium users: 0.25 credits per image
Premium users: Free (0 credits)
Remove background from a video frame-by-frame using AI-powered segmentation. The system processes each frame, applies segmentation masks, and returns a WebM video with transparency.
curl -X POST https://api.univence.com/v1/videos/remove-background \
-H "X-API-Key: your-api-key" \
-F "file=@video.mp4" \
-F "prompt=person walking"
| Parameter | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | Video file to process |
prompt |
string | Yes | Description of object to keep (background will be removed) |
Returns a WebM video with transparent background:
Content-Type: video/webmContent-Disposition: inline; filename="background_removed_video.webm"Non-premium users: 0.25 credits per processed frame
Premium users: Free (0 credits)
Note: Frames where no object is detected (mask is all black) are skipped and not charged.
Generate LLM responses with optional vision support. This endpoint supports both text-only and multimodal (text + image) inputs. Users can choose between two models: mistralai/Ministral-3-3B-Reasoning-2512 (vision model with image understanding capabilities) and Nanbeige/Nanbeige4.1-3B (text-only model). Premium Only - requires an active premium subscription.
curl -X POST https://api.univence.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello, how are you?"
}
],
"temperature": 0.7,
"max_tokens": 1000
}'
curl -X POST https://api.univence.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What do you see in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
}
}
]
}
],
"max_tokens": 500
}'
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
model |
string | No | Model to use: mistralai/Ministral-3-3B-Reasoning-2512 or Nanbeige/Nanbeige4.1-3B |
mistralai/Ministral-3-3B-Reasoning-2512 |
messages |
array | Yes | Array of message objects | - |
messages[].role |
string | Yes | Message role: "system", "user", "assistant" | - |
messages[].content |
object | Yes | Message content (string or array for vision) | - |
temperature |
number | No | Sampling temperature (0.0-2.0) | null |
top_p |
number | No | Nucleus sampling (0.0-1.0) | null |
max_tokens |
integer | No | Maximum tokens to generate | null |
stream |
boolean | No | Enable streaming responses | false |
Text-only:
{
"role": "user",
"content": "Hello, how are you?"
}
Multimodal (text + images):
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,iVBORw0KGgo..."
}
}
]
}
Image URL Formats:
"url": "data:image/jpeg;base64,...""url": "https://example.com/image.jpg"| Model | Type | Capabilities | Vision Support |
|---|---|---|---|
mistralai/Ministral-3-3B-Reasoning-2512 |
Vision-Language Model (VLM) | Text generation, image understanding, multimodal reasoning, step-by-step reasoning | Yes - Use this model to send images |
Nanbeige/Nanbeige4.1-3B |
Text-Only Model | Text generation, reasoning, conversational AI | No - Text input only |
Access: All models require Premium subscription
Default Model: If no model parameter is specified, mistralai/Ministral-3-3B-Reasoning-2512 is used by default.
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1703123456,
"model": "mistralai/Ministral-3-3B-Reasoning-2512",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm doing well, thank you for asking. How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 15,
"total_tokens": 35
}
}
| Reason | Description |
|---|---|
stop |
Model completed generation normally |
length |
Generation stopped due to max_tokens limit |
content_filter |
Content was filtered by safety filters |
Non-premium users: Not available (premium required)
Premium users: Free (0 credits) for both models
Clone a voice using Qwen3 TTS by providing reference audio and text. The system analyzes the reference audio to capture voice characteristics and generates new audio with the same voice style.
curl -X POST https://api.univence.com/v1/audio/clone \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"text": "Hello, this is a test of voice cloning system.",
"ref_audio": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA=",
"ref_text": "This is reference audio that defines the voice style.",
"language": "English",
"stream": false
}'
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
text |
string | Yes | The text to synthesize using cloned voice | - |
ref_audio |
string | Yes | Base64 encoded reference audio file (WAV format recommended) | - |
ref_text |
string | Yes | The text spoken in the reference audio | - |
language |
string | No | Language for the synthesized speech | "English" |
stream |
boolean | No | Enable streaming audio response | false |
Common languages supported include:
When stream is false or omitted:
Content-Type: audio/wavContent-Disposition: attachment; filename="cloned_voice.wav"Response: Binary WAV audio file
When stream is true:
Content-Type: audio/wavContent-Range: Supports range requests for progressive loadingResponse: Streaming WAV audio data
Non-premium users: 1 credit per request
Premium users: Free (0 credits)
ref_text must match what's spoken in ref_audioUnderstanding and handling API errors effectively
All endpoints return consistent error responses:
{
"error": {
"message": "Error description",
"type": "error_type"
}
}
| Error Type | Description |
|---|---|
invalid_request_error |
Invalid request parameters, invalid model, or model doesn't support vision |
authentication_error |
Authentication failed |
insufficient_credits |
Not enough credits for the request |
processing_error |
Error during image/video processing |
maintenance_mode |
API is under maintenance |
premium_required |
Premium subscription required for endpoint |
{
"error": {
"message": "We're in maintenance mode now. Please try again later",
"type": "maintenance_mode"
}
}
{
"error": {
"message": "The dimensions 2048x2048 exceed the maximum allowed for the z-image-turbo model (1792x1792)",
"type": "invalid_request_error"
}
}
{
"error": {
"message": "You do not have enough credits. Required: 10, Available: 5",
"type": "insufficient_credits"
}
}
{
"error": {
"message": "Authentication failed. Provide a valid API Key in the 'X-API-Key' header or log in.",
"type": "authentication_error"
}
}
{
"error": {
"message": "This endpoint requires a premium subscription. Please upgrade to access LLM generation with vision support.",
"type": "premium_required"
}
}
{
"error": {
"message": "Invalid model ID 'invalid-model'. Supported models: mistralai/Ministral-3-3B-Reasoning-2512, Nanbeige/Nanbeige4.1-3B",
"type": "invalid_request_error"
}
}
{
"error": {
"message": "Model 'Nanbeige/Nanbeige4.1-3B' does not support vision. Use 'mistralai/Ministral-3-3B-Reasoning-2512' for image inputs.",
"type": "invalid_request_error"
}
}
Understanding costs and credit usage
1 Credit = $0.01 USD
Credits are the universal currency for all API operations. Purchase credits in bulk for discounts.
| Service | Non-Premium Cost | Premium Cost |
|---|---|---|
| Image Generation | Variable (model & dimensions) | Free |
| Batch Image Generation | Variable (sum of individual costs) | Free |
| Image Segmentation | 0.25 credits per image | Free |
| Image Upscaling | Variable (method & resolution) | Free |
| Background Removal (Image) | 0.25 credits per image | Free |
| Background Removal (Video) | 0.25 credits per frame | Free |
| Voice Cloning | 1 credit per request | Free |
| LLM Chat Completions | Not Available (Premium Required) | Free (both models) |
Premium Users: Get free access to all features including image generation, segmentation, upscaling, background removal, voice cloning, and LLM chat completions!
Bulk Discounts: Purchase 1000+ credits for 10% discount, 10000+ credits for 20% discount!
Understanding API rate limits and best practices
Optimize your API usage with effective caching strategies
media_file_{mediaFileId}Code examples for authenticating API requests
curl -X POST https://api.univence.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "X-API-Key: sk-your-api-key-here" \
-d '{"prompt": "A beautiful landscape"}'
curl -X POST https://api.univence.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-jwt-token" \
-d '{"prompt": "A beautiful landscape"}'
End-to-end examples for common use cases
curl -X POST https://api.univence.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"model": "z-image-turbo",
"prompt": "A serene Japanese garden with cherry blossoms",
"image_size": "1024x1024",
"negative_prompt": "people, cars, buildings"
}'
curl -X POST https://api.univence.com/v1/images/generations/batch \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"requests": [
{
"model": "z-image-turbo",
"prompt": "A futuristic cityscape at night",
"image_size": "1792x1024"
},
{
"model": "z-image-turbo",
"prompt": "A peaceful mountain lake at sunrise",
"image_size": "1024x1792"
}
]
}'
curl -X POST https://api.univence.com/v1/images/segmentations \
-H "X-API-Key: your-api-key" \
-F "file=@photo.jpg" \
-F "prompt=isolate the main subject"
curl -X POST https://api.univence.com/v1/images/upscale \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"image": "iVBORw0KGgoAAAANSUhEUgAA...",
"method": "realesrgan_4x",
"scale": 4,
"face_enhance": false
}'
curl -X POST https://api.univence.com/v1/images/remove-background \
-H "X-API-Key: your-api-key" \
-F "file=@portrait.jpg" \
-F "prompt=person"
curl -X POST https://api.univence.com/v1/videos/remove-background \
-H "X-API-Key: your-api-key" \
-F "file=@walking.mp4" \
-F "prompt=person"
Expected Output: A WebM video with transparent background showing the person walking.
curl -X POST https://api.univence.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"messages": [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a Python function to reverse a string."
}
],
"temperature": 0.7,
"max_tokens": 500
}'
curl -X POST https://api.univence.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"model": "mistralai/Ministral-3-3B-Reasoning-2512",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What objects do you see in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
}
]
}
],
"max_tokens": 300
}'
curl -X POST https://api.univence.com/v1/audio/clone \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"text": "This is a test of voice cloning.",
"ref_audio": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA=",
"ref_text": "Reference text here",
"language": "English",
"stream": false
}' \
--output cloned_voice.wav
curl -X GET https://api.univence.com/v1/media/abc123 \
--output image.png
Available AI models and their capabilities
Delivers strong photorealistic image generation while maintaining excellent aesthetic quality.
Large-scale image editing model for advanced image manipulation and style transfer.
Guidelines for optimal API usage
Solutions to common issues
Solution: Verify your API key is correct and properly formatted. Generate a new key from your account dashboard if needed.
Solution: Check user credit balance, consider upgrading to premium, or reduce image dimensions/batch size.
Solution: Verify model name spelling. Check supported models list: mistralai/Ministral-3-3B-Reasoning-2512, Nanbeige/Nanbeige4.1-3B. Use default mistralai/Ministral-3-3B-Reasoning-2512 if unsure.
Solution: Check model specifications and reduce image size.
Solution: Verify API key is valid and check header format: X-API-Key: your-key.
Solution: Wait and try again later. Check status page for updates.
Solution: Ensure prompt describes objects visible in video. Try a different, more specific prompt.
Solution: Verify prompt matches objects in image/video. Try more specific or different prompts. Ensure image/video quality is sufficient for detection.
Join thousands of developers creating amazing content with our AI API