OpenAI-Compatible
AI API Documentation

⚠️ Experimental Status: This OpenAI-compatible API is currently experimental and may not work as expected. Endpoints, parameters, and behavior are subject to change. For production use, please refer to the Boycott Brands API which is fully functional. Testing is welcome and feedback is appreciated.

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.

Lightning Fast
LLM Chat
Voice Cloning
Music Generation
Video Generation
Quick Start
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"
}'

Overview

Everything you need to know about the API

Base URL

https://api.univence.com

Authentication

All endpoints require authentication via:

  • API Key: Include X-API-Key: your-api-key in headers
  • Bearer Token: Include Authorization: Bearer your-jwt-token in headers
  • User Session: Or authenticate with your user account

Getting Started

1. Sign up at univence.com

2. Visit univence.com/account to generate your API key

3. Start making requests!

API Endpoints

Complete documentation for all endpoints

POST
/v1/images/generations

1. Generate Single Image

Generate a single image from a text prompt using OpenAI-compatible format. Uses the Flux2Klein 4B distilled model internally for fast, high-quality generation.

Request

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
  }'

Request Parameters

ParameterTypeRequiredDescriptionDefault
modelstringNoModel to use (mapped to internal models automatically)"z-image-turbo"
promptstringYesText description for image generation-
negative_promptstringNoThings to avoid in the image"blurry, distorted, low quality, bad anatomy, text, watermark, signature"
image_sizestringNoOutput image dimensions"1024x1024"
seedintegerNoRandom seed for reproducible resultsnull
num_inference_stepsintegerNoNumber of inference steps8
guidance_scalefloatNoGuidance scale for prompt adherencenull
cfgfloatNoCFG scale (alternative to guidance_scale)null
Note: The image, mask, and input_images parameters are not supported here. Use POST /v1/images/edits for image editing.

Supported Image Sizes

  • 256x256
  • 512x512
  • 1024x1024
  • 1024x1792
  • 1792x1024

Supported Models

ModelDescriptionMax WidthMax HeightText-to-Image
z-image-turboDefault model, fast generation17921792Yes
longcat-image-editWide aspect ratio, editing17921024Yes

Model Mapping

OpenAI/SiliconFlow model names automatically mapped: flux-schnell, qwen/qwen-image, pixart-sigma, dall-e-3, dall-e-2z-image-turbo

Response

{
  "created": 1703123456,
  "data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }]
}

Credit Cost

Non-premium users: Variable cost based on model, dimensions, and user pricing tier

Premium users: Free (0 credits)

POST
/v1/images/edits

2. Image Editing

Edit one or more images (up to 4) using the Flux2Klein 4B distilled model. Supports multi-image editing and img2img.

Request

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
  }'

Request Parameters

ParameterTypeRequiredDescriptionDefault
modelstringNoblack-forest-labs/FLUX.2-klein-4B (distilled) or black-forest-labs/FLUX.2-klein-base-4B (base)"black-forest-labs/FLUX.2-klein-4B"
promptstringYesText description for the edit-
negative_promptstringNoThings to avoid"blurry, distorted, low quality"
input_imagesarray[string]YesBase64 encoded images to edit (up to 4)-
widthintegerNoOutput width (if match_image_size = 0)Input image width
heightintegerNoOutput heightInput image height
num_stepsintegerNoNumber of inference steps4 (distilled) / 50 (base)
guidancefloatNoCFG guidance scale1.0 (distilled) / 4.0 (base)
seedintegerNoRandom seednull
match_image_sizeintegerNo0 = use specified dims, 1 = match first input0

Response

{
  "created": 1703123456,
  "data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }]
}

Credit Cost

Non-premium users: 0.5 credits per request

Premium users: Free (0 credits)

POST
/v1/images/generations/batch

3. Generate Batch Images

Generate multiple images in a single request (max 5 requests).

Request

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" }
    ]
  }'

Request Parameters

ParameterTypeRequiredDescription
requestsarrayYesArray of image generation requests (max 5)
requests[].modelstringNoModel for this request
requests[].promptstringYesText description for this image
requests[].negative_promptstringNoThings to avoid
requests[].image_sizestringNoImage dimensions
requests[].seedintegerNoRandom seed
requests[].num_inference_stepsintegerNoNumber of inference steps

Response

{
  "data": [
    { "created": 1703123456, "data": [{ "b64_json": "iVBORw0KGgo..." }] },
    { "created": 1703123457, "data": [{ "b64_json": "iVBORw0KGgoBB..." }] }
  ]
}

Credit Cost

Non-premium users: Sum of costs for all images in batch

Premium users: Free (0 credits)

GET
/v1/media/{mediaFileId}

4. Get Media File by ID

Retrieve media files including original and transcoded files. Publicly accessible (no authentication required) with caching.

Request

curl -X GET https://api.univence.com/v1/media/xyz789 -O output.png

Path Parameters

ParameterTypeRequiredDescription
mediaFileIdstringYesThe media file ID

Supported MIME Types: image/jpeg, image/png, image/gif, image/webp

Caching: 60 min sliding expiration, varies by User-Agent

POST
/v1/images/segmentations

5. Image Segmentation

Segment objects from an image using SAM3. Supports text-prompt and interactive point-based segmentation.

Request — Text Prompt

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"

Request — Point-Based

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"

Form Parameters

ParameterTypeRequiredDescription
filefileYesImage file to segment
promptstringNo*Description of what to segment. Optional if point_coords provided
point_coordsstring (JSON)NoJSON array of [x,y] pixel coordinates, e.g. [[520,375]]
point_labelsstring (JSON)NoLabels (1=foreground, 0=background). Defaults to all foreground
multimask_outputbooleanNoReturn 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

Credit Cost

Non-premium: 0.25 credits per image  |  Premium: Free

POST
/v1/images/upscale

6. Image Upscaling

Upscale an image using AI-powered methods. Supported methods: realesrgan_2x, realesrgan_4x, realesrgan_4x_anime, swin2sr, lanczos.

Request

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"
  }'

Response

{
  "created": 1703123456,
  "data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }]
}

Credit Cost

Non-premium: Variable (method & resolution)  |  Premium: Free

POST
/v1/images/remove-background

7. Background Removal (Image)

Remove background from an image using SAM3 segmentation. Returns PNG with transparent background.

Request

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"

Credit Cost

Non-premium: 0.25 credits per image  |  Premium: Free

POST
/v1/videos/remove-background

8. Background Removal (Video)

Remove background from video frame-by-frame. Returns WebM with VP9 alpha channel.

Request

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"

Credit Cost

Non-premium: 0.25 credits per frame  |  Premium: Free

Note: Frames with no detected object are skipped and not charged.

POST
/v1/chat/completions

9. LLM Chat Completions

Generate LLM responses with vision support using Qwen 3.5-4B with a 262K context window. Premium Only.

Note: The model parameter is accepted for compatibility but is ignored. Always uses Qwen 3.5-4B regardless of the specified model value.

Request — Text Chat

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
  }'

Request — Vision

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
  }'

Model Details

PropertyValue
ModelQwen 3.5-4B
Context Window262K tokens
VisionSupported
AccessPremium Only

Response

{
  "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 }
}

Credit Cost

Non-premium: Not available (premium required)  |  Premium: Free

POST
/v1/audio/clone

10. Voice Cloning

Clone a voice using Qwen3 TTS. Provide reference audio + text, and the system generates new audio with the same voice.

Request

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.wav

Credit Cost

Non-premium: 1 credit per request  |  Premium: Free

POST
/v1/music/generate

11. Music Generation

Generate original music from text prompts using ACE-Step V1.5. Supports lyrics, custom BPM, key, time signature, and instrumental mode.

Request

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.wav

Credit Cost

Non-premium: 1 credit per request  |  Premium: Free

POST
/v1/music/cover

12. Music Cover Generation

Transform a song into a different style using ACE-Step V1.5. Provide source audio and style prompt.

Credit Cost

Non-premium: 1 credit per request  |  Premium: Free

POST
/v1/music/repaint

13. Music Repaint

Repaint (inpaint) a specific region of an audio track using ACE-Step V1.5.

Credit Cost

Non-premium: 1 credit per request  |  Premium: Free

POST
/v1/images/img2video

14. Image-to-Video Generation

Generate a video from an input image using TurboDiffusion. Animates the image based on a text prompt.

Request

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"

Credit Cost

Non-premium: 1 credit per request  |  Premium: Free

GET
/v1/images/user-videos

15. Get User Videos

List user's generated videos with pagination.

Request

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"

Credit Cost

Free

Error Handling

Understanding API errors

Error Response Format

{
  "error": { "message": "Error description", "type": "error_type" }
}

Common Error Types

Error TypeDescription
invalid_request_errorInvalid request parameters or invalid model
authentication_errorAuthentication failed
insufficient_creditsNot enough credits
processing_errorError during processing
maintenance_modeAPI under maintenance
premium_requiredPremium subscription required

Credit System & Pricing

Understanding costs

Credit Value

1 Credit = $0.01 USD

Pricing Overview

ServiceNon-Premium CostPremium Cost
Image GenerationVariable (model & dimensions)Free
Batch Image GenerationVariable (sum of costs)Free
Image Editing (Flux2Klein)0.5 creditsFree
Image Segmentation0.25 creditsFree
Image UpscalingVariable (method & resolution)Free
Background Removal (Image)0.25 creditsFree
Background Removal (Video)0.25 credits per frameFree
Voice Cloning1 creditFree
Music Generation / Cover / Repaint1 creditFree
Image-to-Video1 creditFree
LLM Chat CompletionsNot AvailableFree

Premium Users: Free access to all features!

Bulk Discounts: 1000+ credits = 10% off, 10000+ = 20% off

Rate Limiting

Caching & Performance

Authentication Examples

Using API Key Header

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"}'

Using Bearer Token

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"}'

Complete Usage Examples

Basic Image 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 serene Japanese garden with cherry blossoms",
    "image_size": "1024x1024",
    "negative_prompt": "people, cars, buildings"
  }'

Multi-Image Editing

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
  }'

LLM Chat

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
  }'

Image-to-Video

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"

Model Specifications

Z-Image-Turbo

Text-to-Image
Max Resolution:1792×1792

General text-to-image generation. Runs on Flux2Klein 4B distilled internally.

FLUX.2-Klein-4B

Image Edit
Steps (Distilled):4 steps
Steps (Base):50 steps

Multi-image editing and style transfer.

Qwen 3.5-4B

LLM (Default)
Context:262K tokens
Vision:Supported
Access:Premium Only

Default LLM. Model parameter is ignored; always uses Qwen 3.5-4B.

ACE-Step V1.5

Music Generation
Type:Text-to-Music
Formats:WAV, MP3, FLAC, OPUS, AAC

Generate, cover, and repaint music.

TurboDiffusion

Video Generation
Type:Image-to-Video
Resolutions:480p, 720p, 1080p

Fast image-to-video generation.

Best Practices

Prompt Engineering

  • Be specific and descriptive in prompts
  • Use artistic style references
  • Include lighting and atmosphere details
  • Use negative prompts to avoid unwanted elements

Performance Optimization

  • Use batch generation for multiple images
  • Use multi-image editing for up to 4 images
  • Choose appropriate image sizes
  • Use distilled models for faster generation

Security

  • Never expose API keys in client-side code
  • Use environment variables for key storage
  • Validate user input before sending

Cost Optimization

  • Use appropriate image sizes
  • Batch requests are more cost-effective
  • Cache generated images
  • Consider Premium for high-volume usage

Troubleshooting

Issue: "Invalid API Key"

Solution: Verify API key is correct. Generate a new key from account dashboard.

Issue: "Insufficient credits"

Solution: Check credit balance, upgrade to premium, or reduce dimensions/batch size.

Issue: "Invalid model ID"

Solution: For images use z-image-turbo. For editing use black-forest-labs/FLUX.2-klein-4B.

Issue: "Authentication failed"

Solution: Check header format: X-API-Key: your-key or Authorization: Bearer your-token.

Ready to Get Started?

Join thousands of developers creating amazing content with our AI API