Complete API documentation for the SLMGEN backend.
http://localhost:8000
Protected endpoints require a Supabase JWT token in the Authorization header:
Authorization: Bearer <your_jwt_token>Upload a dataset file for processing.
Request:
Content-Type: multipart/form-data
file: <JSONL file>Response:
{
"session_id": "uuid",
"filename": "dataset.jsonl",
"size": 1024,
"message": "Upload successful"
}Analyze an uploaded dataset.
Response:
{
"session_id": "uuid",
"total_examples": 1000,
"total_tokens": 150000,
"avg_tokens_per_example": 150,
"quality_score": 0.85,
"quality_issues": [],
"format_valid": true
}Get paginated dataset examples.
Parameters:
page(int): Page number (default: 1)page_size(int): Examples per page (default: 5)
Response:
{
"examples": [
{
"index": 0,
"messages": [
{"role": "user", "content": "..."},
{"role": "assistant", "content": "..."}
],
"token_count": 150
}
],
"total_count": 1000,
"page": 1,
"page_size": 5
}Get field distribution statistics.
Response:
{
"roles": {"user": 1000, "assistant": 1000, "system": 100},
"avg_message_length": 250.5,
"token_distribution": {"0-100": 50, "100-500": 400, "500-1000": 350, "1000+": 200},
"has_system_prompts": true,
"multi_turn_percentage": 15.5
}Check for duplicate examples.
Response:
{
"count": 5,
"examples": [12, 45, 67, 89, 112]
}Get model recommendations based on dataset and requirements.
Request:
{
"session_id": "uuid",
"task_type": "instruction_following",
"deployment_target": "cloud"
}Response:
{
"recommendations": [
{
"model_id": "phi-4-mini",
"model_name": "Phi-4 Mini",
"size": "3.8B",
"score": 0.92,
"reasons": ["Best for instruction tasks", "Fits your data size"],
"is_gated": false
}
]
}Generate a fine-tuning notebook.
Request:
{
"session_id": "uuid",
"model_id": "phi-4-mini",
"training_config": {
"lora_rank": 16,
"learning_rate": 0.0002,
"num_epochs": 3
}
}Response:
{
"notebook_path": "/path/to/notebook.ipynb",
"colab_url": "https://colab.research.google.com/...",
"download_url": "/download/notebook.ipynb"
}List user's jobs.
Response:
[
{
"id": "uuid",
"session_id": "uuid",
"dataset_filename": "data.jsonl",
"status": "completed",
"created_at": "2026-01-19T00:00:00Z"
}
]Create a new job record.
Get job details.
Update job record.
Delete job and associated files.
API info and health check.
Simple health check.
{
"detail": "Error message"
}Status Codes:
400- Bad Request401- Unauthorized404- Not Found500- Internal Server Error