4K Upscaler

Enhance and upscale your images to 4K resolution with AI-powered technology. Improve image quality, increase resolution, and enhance details while maintaining natural appearance.

Credit Cost

Each 4K Upscaler request costs 1 credit. Ensure you have sufficient credits before making requests.

Endpoint

HTTP Method
POST https://api.mnmlai.dev/v1/upscale

Request

Send a POST request with multipart/form-data containing your image and upscaling parameters.

Required Parameters

ParameterTypeDescription
imageFileThe image to upscale (multipart/form-data)

Optional Parameters

ParameterTypeDefaultDescription
scaleNumber2Upscaling factor (2, 4, 8, etc.)
face_enhanceBooleanfalseEnable face enhancement for better portrait results

Response

The 4K Upscaler endpoint processes your image asynchronously. You'll receive a request ID that you can use to check the status and retrieve the upscaled image.

Success Response (200 OK)

{
  "status": "success",
  "id": "upscale_1703123456789_abc12345"
}

Examples

Basic Example

curl -X POST https://api.mnmlai.dev/v1/upscale \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "image=@/path/to/image.jpg"

Advanced Example with Parameters

curl -X POST https://api.mnmlai.dev/v1/upscale \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "image=@/path/to/image.jpg" \
  -F "scale=4" \
  -F "face_enhance=true"

Node.js Example

const FormData = require('form-data');
const fs = require('fs');
const axios = require('axios');

const form = new FormData();
form.append('image', fs.createReadStream('image.jpg'));
form.append('scale', '4');
form.append('face_enhance', 'true');

const response = await axios.post(
  'https://api.mnmlai.dev/v1/upscale',
  form,
  {
    headers: {
      'Accept': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY',
      ...form.getHeaders()
    }
  }
);

console.log('Request ID:', response.data.id);

Python Example

import requests

url = 'https://api.mnmlai.dev/v1/upscale'

files = {
    'image': open('image.jpg', 'rb')
}

data = {
    'scale': '4',
    'face_enhance': 'true'
}

headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
}

response = requests.post(url, headers=headers, files=files, data=data)
result = response.json()

print(f"Request ID: {result['id']}")

Processing Status

After submitting your request, use the Status Check endpoint with the returned ID to monitor processing progress:

Status Check Endpoint
GET https://api.mnmlai.dev/v1/status/{id}

Best Practices

Image Requirements

  • • Use high-quality source images for best results (minimum 1KB)
  • • Images are automatically resized to 1400px width for processing
  • • Supported formats: JPG, PNG, GIF (max 8MB)
  • • Higher resolution source images produce better upscaled results

Upscaling Tips

  • • Use scale factor of 2-4 for most images
  • • Enable face_enhance for portrait photos
  • • Higher scale factors take longer to process
  • • Test with smaller images first to optimize your workflow

Performance Tips

  • • Each request costs 1 credit, making it very affordable
  • • Process multiple images in parallel for efficiency
  • • Use appropriate scale factors based on your needs
  • • Monitor your credit usage to avoid interruptions

Error Handling

Common Error Responses

// 400 Bad Request - Missing required parameters
{
  "status": "error",
  "code": "MISSING_IMAGE",
  "message": "Image file is required"
}

// 400 Bad Request - Insufficient credits
{
  "status": "error",
  "code": "NO_CREDITS",
  "message": "You do not have enough credits to use this feature",
  "details": {
    "credits": 0
  }
}

// 400 Bad Request - Image too small
{
  "status": "error",
  "code": "IMAGE_TOO_SMALL",
  "message": "Image file is too small",
  "details": {
    "size": 512,
    "minSize": 1024,
    "unit": "bytes"
  }
}

// 400 Bad Request - Image too large
{
  "status": "error",
  "code": "IMAGE_TOO_LARGE",
  "message": "Image file is too large",
  "details": {
    "size": 10485760,
    "maxSize": 8388608,
    "unit": "bytes"
  }
}

// 400 Bad Request - Invalid image type
{
  "status": "error",
  "code": "INVALID_IMAGE_TYPE",
  "message": "Invalid image type",
  "details": {
    "receivedType": "image/bmp",
    "allowedTypes": ["image/jpeg", "image/png", "image/gif"]
  }
}

// 401 Unauthorized - Invalid API key
{
  "status": "error",
  "code": "UNAUTHORIZED",
  "message": "User ID not found in request"
}

// 500 Internal Server Error
{
  "status": "error",
  "code": "INTERNAL_SERVER_ERROR",
  "message": "An unexpected error occurred",
  "details": {
    "error": "Error message",
    "timestamp": "2024-01-01T00:00:00.000Z"
  }
}

Related Endpoints

Explore other AI-powered image processing tools: