Comprehensive API for image generation, LLM chat, voice cloning, image editing, music generation, video generation, 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 headersAuthorization: Bearer your-jwt-token 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. Uses the Flux2Klein 4B distilled model internally for fast, high-quality generation.
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,
"num_inference_steps": 8
}'
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
model | string | No | Model to use (mapped to internal models automatically) | "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 |
num_inference_steps | integer | No | Number of inference steps | 8 |
guidance_scale | float | No | Guidance scale for prompt adherence | null |
cfg | float | No | CFG scale (alternative to guidance_scale) | null |
image, mask, and input_images parameters are not supported here. Use POST /v1/images/edits for image editing.
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 |
OpenAI/SiliconFlow model names automatically mapped: flux-schnell, qwen/qwen-image, pixart-sigma, dall-e-3, dall-e-2 → z-image-turbo
{
"created": 1703123456,
"data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }]
}Non-premium users: Variable cost based on model, dimensions, and user pricing tier
Premium users: Free (0 credits)
Edit one or more images (up to 4) using the Flux2Klein 4B distilled model. Supports multi-image editing and img2img.
curl -X POST https://api.univence.com/v1/images/edits \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"model": "black-forest-labs/FLUX.2-klein-4B",
"prompt": "Make the background tropical",
"negative_prompt": "blurry, distorted, low quality",
"input_images": ["iVBORw0KGgo...", "iVBORw0KGgo..."],
"width": 1024, "height": 1024,
"num_steps": 4, "guidance": 1.0, "seed": 12345,
"match_image_size": 0
}'| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
model | string | No | black-forest-labs/FLUX.2-klein-4B (distilled) or black-forest-labs/FLUX.2-klein-base-4B (base) | "black-forest-labs/FLUX.2-klein-4B" |
prompt | string | Yes | Text description for the edit | - |
negative_prompt | string | No | Things to avoid | "blurry, distorted, low quality" |
input_images | array[string] | Yes | Base64 encoded images to edit (up to 4) | - |
width | integer | No | Output width (if match_image_size = 0) | Input image width |
height | integer | No | Output height | Input image height |
num_steps | integer | No | Number of inference steps | 4 (distilled) / 50 (base) |
guidance | float | No | CFG guidance scale | 1.0 (distilled) / 4.0 (base) |
seed | integer | No | Random seed | null |
match_image_size | integer | No | 0 = use specified dims, 1 = match first input | 0 |
{
"created": 1703123456,
"data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }]
}Non-premium users: 0.5 credits per request
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 |
requests[].num_inference_steps | integer | No | Number of inference steps |
{
"data": [
{ "created": 1703123456, "data": [{ "b64_json": "iVBORw0KGgo..." }] },
{ "created": 1703123457, "data": [{ "b64_json": "iVBORw0KGgoBB..." }] }
]
}Non-premium users: Sum of costs for all images in batch
Premium users: Free (0 credits)
Retrieve media files including original and transcoded files. Publicly accessible (no authentication required) with caching.
curl -X GET https://api.univence.com/v1/media/xyz789 -O output.png| Parameter | Type | Required | Description |
|---|---|---|---|
mediaFileId | string | Yes | The media file ID |
Supported MIME Types: image/jpeg, image/png, image/gif, image/webp
Caching: 60 min sliding expiration, varies by User-Agent
Segment objects from an image using SAM3. Supports text-prompt and interactive point-based 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"curl -X POST https://api.univence.com/v1/images/segmentations \
-H "X-API-Key: your-api-key" \
-F "file=@image.jpg" \
-F 'point_coords=[[520,375],[100,200]]' \
-F 'point_labels=[1,0]' \
-F "multimask_output=true"| Parameter | Type | Required | Description |
|---|---|---|---|
file | file | Yes | Image file to segment |
prompt | string | No* | Description of what to segment. Optional if point_coords provided |
point_coords | string (JSON) | No | JSON array of [x,y] pixel coordinates, e.g. [[520,375]] |
point_labels | string (JSON) | No | Labels (1=foreground, 0=background). Defaults to all foreground |
multimask_output | boolean | No | Return multiple candidate masks (only with point_coords) |
* At least one of prompt or point_coords is required.
Response: Returns PNG image. Content-Type: image/png
Non-premium: 0.25 credits per image | Premium: Free
Upscale an image using AI-powered methods. Supported methods: realesrgan_2x, realesrgan_4x, realesrgan_4x_anime, swin2sr, lanczos.
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"
}'{
"created": 1703123456,
"data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }]
}Non-premium: Variable (method & resolution) | Premium: Free
Remove background from an image using SAM3 segmentation. Returns PNG with transparent background.
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"Non-premium: 0.25 credits per image | Premium: Free
Remove background from video frame-by-frame. Returns WebM with VP9 alpha channel.
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"Non-premium: 0.25 credits per frame | Premium: Free
Note: Frames with no detected object are skipped and not charged.
Generate LLM responses with vision support using Qwen 3.5-4B with a 262K context window. Premium Only.
model parameter is accepted for compatibility but is ignored. Always uses Qwen 3.5-4B regardless of the specified model value.
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 is in this image?" },
{ "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0KGgo..." } }
]
}],
"max_tokens": 500
}'| Property | Value |
|---|---|
| Model | Qwen 3.5-4B |
| Context Window | 262K tokens |
| Vision | Supported |
| Access | Premium Only |
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1703123456,
"model": "Qwen/Qwen3.5-4B",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "Hello! How can I help you today?" },
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 20, "completion_tokens": 15, "total_tokens": 35 }
}Non-premium: Not available (premium required) | Premium: Free
Clone a voice using Qwen3 TTS. Provide reference audio + text, and the system generates new audio with the same voice.
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.",
"ref_audio": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA=",
"ref_text": "Reference text here",
"language": "English",
"stream": false
}' \
--output cloned_voice.wavNon-premium: 1 credit per request | Premium: Free
Generate original music from text prompts using ACE-Step V1.5. Supports lyrics, custom BPM, key, time signature, and instrumental mode.
curl -X POST https://api.univence.com/v1/music/generate \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"prompt": "Energetic electronic dance music with heavy bass",
"lyrics": "Pumping beats and flashing lights",
"bpm": 128, "key_scale": "C Major", "time_signature": "4/4",
"vocal_language": "en", "duration": 30, "instrumental": false,
"audio_format": "wav"
}' \
--output generated_music.wavNon-premium: 1 credit per request | Premium: Free
Transform a song into a different style using ACE-Step V1.5. Provide source audio and style prompt.
Non-premium: 1 credit per request | Premium: Free
Repaint (inpaint) a specific region of an audio track using ACE-Step V1.5.
Non-premium: 1 credit per request | Premium: Free
Generate a video from an input image using TurboDiffusion. Animates the image based on a text prompt.
curl -X POST https://api.univence.com/v1/images/img2video \
-H "X-API-Key: your-api-key" \
-F "image=@input_photo.jpg" \
-F "prompt=a dramatic cinematic dolly zoom" \
-F "negative_prompt=blurry, distorted" \
-F "num_frames=81" -F "num_steps=4" -F "resolution=480p" -F "use_ode=false"Non-premium: 1 credit per request | Premium: Free
List user's generated videos with pagination.
curl -X GET "https://api.univence.com/v1/images/user-videos?limit=20&offset=0&sortBy=newest&sortOrder=desc" \
-H "X-API-Key: your-api-key"Free
Understanding API errors
{
"error": { "message": "Error description", "type": "error_type" }
}| Error Type | Description |
|---|---|
invalid_request_error | Invalid request parameters or invalid model |
authentication_error | Authentication failed |
insufficient_credits | Not enough credits |
processing_error | Error during processing |
maintenance_mode | API under maintenance |
premium_required | Premium subscription required |
Understanding costs
1 Credit = $0.01 USD
| Service | Non-Premium Cost | Premium Cost |
|---|---|---|
| Image Generation | Variable (model & dimensions) | Free |
| Batch Image Generation | Variable (sum of costs) | Free |
| Image Editing (Flux2Klein) | 0.5 credits | Free |
| Image Segmentation | 0.25 credits | Free |
| Image Upscaling | Variable (method & resolution) | Free |
| Background Removal (Image) | 0.25 credits | Free |
| Background Removal (Video) | 0.25 credits per frame | Free |
| Voice Cloning | 1 credit | Free |
| Music Generation / Cover / Repaint | 1 credit | Free |
| Image-to-Video | 1 credit | Free |
| LLM Chat Completions | Not Available | Free |
Premium Users: Free access to all features!
Bulk Discounts: 1000+ credits = 10% off, 10000+ = 20% off
media_file_{mediaFileId}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"}'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/edits \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"model": "black-forest-labs/FLUX.2-klein-4B",
"prompt": "Transform into a winter wonderland",
"input_images": ["base64_1", "base64_2"],
"num_steps": 4, "guidance": 1.0
}'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": "Write a Python function to reverse a string." }
],
"temperature": 0.7, "max_tokens": 500
}'curl -X POST https://api.univence.com/v1/images/img2video \
-H "X-API-Key: your-api-key" \
-F "image=@landscape.jpg" \
-F "prompt=cinematic dolly zoom" \
-F "num_frames=81" -F "resolution=480p"General text-to-image generation. Runs on Flux2Klein 4B distilled internally.
Multi-image editing and style transfer.
Default LLM. Model parameter is ignored; always uses Qwen 3.5-4B.
Generate, cover, and repaint music.
Fast image-to-video generation.
Solution: Verify API key is correct. Generate a new key from account dashboard.
Solution: Check credit balance, upgrade to premium, or reduce dimensions/batch size.
Solution: For images use z-image-turbo. For editing use black-forest-labs/FLUX.2-klein-4B.
Solution: Check header format: X-API-Key: your-key or Authorization: Bearer your-token.
Join thousands of developers creating amazing content with our AI API