← Help

Examples

Practical use cases for the Vision AI API

Screenshot QA

Analyze a webpage screenshot to check for visual issues.

curl -X POST https://vision.kim8.s4s.host/api/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemma-3-27b-it",
    "prompt": "Analyze this screenshot. Check for: 1) Does the page load correctly? 2) Any blank areas or broken elements? 3) Any visual errors or text overlap? 4) Is the layout responsive? Reply with a brief list of issues found or say OK if none.",
    "image": "https://example.com/screenshot.png",
    "temperature": 0.2,
    "max_tokens": 500
  }'

OCR - Text Extraction

Extract all readable text from an image.

curl -X POST https://vision.kim8.s4s.host/api/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemma-3-27b-it",
    "prompt": "Extract all text visible in this image. Preserve the structure and formatting as much as possible. Output only the extracted text.",
    "image": "https://example.com/document.png",
    "temperature": 0.1,
    "max_tokens": 2000
  }'

Multi-Model Comparison

Run the same image through multiple models and compare results.

curl -X POST https://vision.kim8.s4s.host/api/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "models": [
      "google/gemma-3-27b-it",
      "google/gemma-3-12b-it",
      "mistralai/Mistral-Small-3.2-24B-Instruct-2506"
    ],
    "prompt": "Describe the content and quality of this image in 2-3 sentences.",
    "image": "https://example.com/photo.jpg",
    "temperature": 0.3,
    "max_tokens": 300
  }'

The response data.results array contains each model's output with timing and token usage.

PHP Integration

Call the Vision AI API from PHP using curl.

<?php
$imageUrl = 'https://example.com/screenshot.png';
$prompt  = 'Describe this screenshot briefly.';

$payload = json_encode([
    'model'    => 'google/gemma-3-27b-it',
    'prompt'   => $prompt,
    'image'    => $imageUrl,
    'temperature' => 0.3,
    'max_tokens'  => 500,
]);

$ch = curl_init('https://vision.kim8.s4s.host/api/analyze');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => $payload,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 120,
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
    ],
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($result['success'] ?? false) {
    echo $result['data']['content'] . PHP_EOL;
    echo 'Model: ' . $result['data']['model'] . PHP_EOL;
    echo 'Time: ' . $result['data']['time_ms'] . 'ms' . PHP_EOL;
} else {
    echo 'Error: ' . ($result['error'] ?? 'Unknown') . PHP_EOL;
}