Skip to content

REST API Reference

Complete reference for YOLO-Toys HTTP API endpoints.


📋 Overview

Base URL: http://localhost:8000

All API responses are in JSON format. Errors follow the standard HTTP status code convention.


🔍 Endpoints

Health Check

Check server status and system information.

http
GET /health

Response:

json
{
  "status": "ok",
  "version": "3.1.0",
  "device": "cuda:0",
  "default_model": "yolov8n.pt"
}

List Models

Get all available models grouped by category.

http
GET /models

Single Image Inference

Perform inference on a single image.

http
POST /infer

Content-Type: multipart/form-data

Parameters:

NameTypeRequiredDefaultDescription
fileFileYes-Image file (JPEG, PNG, WEBP)
modelstringNoyolov8n.ptModel identifier
conffloatNo0.25Confidence threshold (0.0-1.0)
ioufloatNo0.45IoU threshold for NMS

Response (200 OK):

json
{
  "width": 640,
  "height": 480,
  "task": "detect",
  "detections": [
    {
      "bbox": [100.5, 200.3, 250.8, 450.2],
      "score": 0.89,
      "label": "person"
    }
  ],
  "inference_time": 12.5,
  "model": "yolov8n.pt"
}

Image Captioning

Generate automatic description for an image.

http
POST /caption

Response:

json
{
  "caption": "a person riding a skateboard on a street",
  "inference_time": 120.5
}

Visual Question Answering

Answer questions about an image.

http
POST /vqa

Response:

json
{
  "answer": "blue",
  "inference_time": 95.2,
  "question": "What color is the car?"
}

🚦 Error Codes

Status CodeMeaningDescription
200OKRequest successful
400Bad RequestInvalid input parameters
404Not FoundModel or resource not found
500Internal Server ErrorServer processing error

🔗 Next Steps

Released under the MIT License.