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

API Documentation

Programmatic access to Video AI functionality

Authentication Required

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

GET

/api/stats

Get real-time system statistics including CPU usage, RAM consumption, 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 AI-powered media analysis using advanced language models. Costs 10 tokens (free for admins).

Parameters

model_path string (optional)
AI model to use (default: "Qwen/Qwen2.5-VL-7B-Instruct")
prompt string (optional)
Analysis prompt (default: "Describe this image.")
file_path string (required)
Path to the media file to analyze
interval integer (optional)
Frame sampling interval for videos (default: 10)

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

Retrieve a list of your active API tokens for programmatic access.

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 %}