{% extends 'base.html' %} {% block title %}API Documentation{% endblock %} {% block content %}

API Documentation

Programmatic access to Video AI functionality.

Authentication: All endpoints require authentication via login session or API token (Bearer token in Authorization header).

Endpoints

GET /api/stats

Get system statistics including CPU, RAM, and GPU information.

Curl Example:

curl -H "Authorization: Bearer YOUR_API_TOKEN" {{ request.host_url }}api/stats

Response:

{
  "status": "Idle",
  "gpu_count": 1,
  "gpus": [{"name": "NVIDIA RTX 3080", "memory_used": 0.5, "memory_total": 10.0, "utilization": 0}],
  "cpu_percent": 15.2,
  "ram_used": 4.2,
  "ram_total": 16.0
}

POST /api/analyze

Perform media analysis using AI models. Costs 10 tokens (free for admins).

Parameters:

Curl Example:

curl -X POST -H "Authorization: Bearer YOUR_API_TOKEN" -H "Content-Type: application/json" -d '{
  "model_path": "Qwen/Qwen2.5-VL-7B-Instruct",
  "prompt": "Describe this video",
  "file_path": "/path/to/video.mp4",
  "interval": 30
}' {{ request.host_url }}api/analyze

Response:

{
  "result": "Analysis result here...",
  "tokens_used": 10,
  "remaining_tokens": 90
}

GET /api/api_tokens

List your API tokens.

Curl Example:

curl -H "Authorization: Bearer YOUR_API_TOKEN" {{ request.host_url }}api/api_tokens

Response:

{
  "tokens": [
    {"id": 1, "name": "My Token", "created_at": "2024-01-01T00:00:00Z", "last_used": null}
  ]
}
{% endblock %}