🌐 On-Device AI Node

Local AI HTTP Server

Turn your smartphone into a high-performance, private AI inference server on your local Wi-Fi network using standard JSON and Base64.

🚀 Quick Start (4 Steps)

1

Unlock Premium in Photo Cartoonizer

Open Photo Cartoonizer on your iPhone or Android phone and ensure you have an active VIP subscription.

2

Turn On Local Server

Tap the 📶 Tethering Icon in the top header and toggle the server switch to ON.

3

Find Your Device URL

Your local IP and port will be displayed (e.g. http://192.168.1.50:8080). Ensure your client is on the same Wi-Fi.

4

Send JSON Request

Send a JSON payload with a Base64-encoded image and receive a Base64-encoded cartoonized PNG in response.

💻 Code Examples (JSON + Base64)

Replace 192.168.1.50:8080 with your phone's actual IP address shown in the app.

# 1. Check Server Status
curl http://192.168.1.50:8080/status

# 2. Encode image to base64 and POST JSON
IMAGE_B64=$(base64 -i portrait.jpg)

curl -s -X POST http://192.168.1.50:8080/cartoonize \
  -H "Content-Type: application/json" \
  -d "{\"image\": \"$IMAGE_B64\", \"style\": \"anime\"}" \
  | jq -r '.image' | base64 --decode > cartoon.png
import base64
import requests

url = "http://192.168.1.50:8080/cartoonize"

# 1. Read and encode local image
with open("portrait.jpg", "rb") as f:
    b64_image = base64.b64encode(f.read()).decode("utf-8")

# 2. POST JSON payload
payload = {
    "image": b64_image,
    "style": "3d_pixar"
}

response = requests.post(url, json=payload, timeout=60)

if response.status_code == 200:
    data = response.json()
    # 3. Decode base64 PNG output
    cartoon_bytes = base64.b64decode(data["image"])
    with open("cartoon.png", "wb") as out:
        out.write(cartoon_bytes)
    print(f"Success! Style: {data['style']}. Saved cartoon.png")
else:
    print(f"Error {response.status_code}: {response.text}")
import fs from 'fs';
import fetch from 'node-fetch';

async function cartoonize() {
  // 1. Read image as base64
  const imageBase64 = fs.readFileSync('portrait.jpg', { encoding: 'base64' });

  // 2. Send JSON payload
  const res = await fetch('http://192.168.1.50:8080/cartoonize', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      image: imageBase64,
      style: 'ghibli',
    }),
  });

  if (res.ok) {
    const data = await res.json();
    // 3. Save decoded base64 PNG
    const buffer = Buffer.from(data.image, 'base64');
    fs.writeFileSync('cartoon.png', buffer);
    console.log('Cartoon saved to cartoon.png');
  } else {
    console.error('Failed:', await res.text());
  }
}

cartoonize();
// Directly from your browser on the same Wi-Fi (CORS enabled)
async function cartoonize(file) {
  const reader = new FileReader();
  reader.readAsDataURL(file); // produces data:image/...;base64,...
  reader.onload = async () => {
    const res = await fetch('http://192.168.1.50:8080/cartoonize', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        image: reader.result,
        style: 'comic',
      }),
    });

    if (res.ok) {
      const data = await res.json();
      // Render base64 image directly in  element
      document.getElementById('result').src = 'data:image/png;base64,' + data.image;
    }
  };
}

📖 JSON API Reference

1. Health Check: GET /status

Returns real-time node telemetry, IP, port, and requests processed.

{
  "status": "running",
  "device": "Photo Cartoonizer Mobile AI Node",
  "ip": "192.168.1.50",
  "port": 8080,
  "requests_served": 14,
  "models_ready": true
}

2. Cartoonize Image: POST /cartoonize

Executes on-device diffusion & multimodal character preservation.

Request JSON:

Property Type Required Description
image String (Base64) Yes Base64-encoded image string or Data URI
style String No Style preset key (default: anime)

Response JSON:

{
  "success": true,
  "style": "anime",
  "format": "png",
  "image": "iVBORw0KGgoAAAANSUhEUgAA..."
}

🎨 Available Style Keys

Key Name Visual Aesthetic
anime Anime Japanese animation character style
comic Comic Book Pop-art halftone textures and bold outlines
ghibli Studio Ghibli Lush hand-painted Miyazaki aesthetic
3d_pixar 3D Character Cute, expressive 3D animation look
oil_paint Oil Painting Textured classical canvas painting
watercolor Watercolor Soft pastel watercolor brushstrokes
sketch Pencil Sketch Charcoal and graphite cross-hatch drawing
cyberpunk Cyberpunk Neon synthwave lighting and sci-fi palette

🛠️ Troubleshooting & Best Practices

📱
Keep App Open in Foreground: Mobile operating systems (iOS and Android) automatically throttle or suspend background network sockets when the phone is locked or an app is minimized. Keep the app open on your screen while running batch tasks.
📶
Wi-Fi Isolation / AP Isolation: If you receive Connection Refused or timeout, check that your Wi-Fi router does not have "Client Isolation" turned on. Alternatively, use your phone's Wi-Fi hotspot to connect your laptop directly.