Home/Docs/API Reference

FineTuneMyAI REST API

Integrate, control, and orchestrate private on-device LLMs, 18 autonomous software agents, in-browser execution sandboxes, and dataset quality audits programmatically.

v1.2.0 Active
Base URL
https://finetunemyai.com/api/v1
Local dev: http://localhost:3050/api/v1
Authentication
Bearer • HMAC • Cookie
Authorization: Bearer <token>
Zero-Upload Privacy
100% On-Device Compute
Weights & raw text never leave host

1. Authentication

FineTuneMyAI supports multiple authentication mechanisms depending on client context:

  • Web Browser Clients: Automatic session cookies (auth_token) set as HttpOnly; Secure; SameSite=Lax on login.
  • REST / API Clients: Pass the bearer token in the HTTP header: Authorization: Bearer <session_token>.
  • Paired Device Nodes: Local runner daemons authenticate with their cryptographic 256-bit bearer token and HMAC-signed timestamps issued during pairing.
POST /api/v1/auth/loginAuthenticate User
Request Body (JSON):
{
  "email": "developer@company.com",
  "password": "your_secure_password"
}
Response (200 OK):
{
  "success": true,
  "user": {
    "id": "usr_94b1a8",
    "email": "developer@company.com",
    "name": "Operator",
    "role": "USER"
  }
}

2. Autonomous Multi-Agents & Execution Sandbox

Orchestrate the 18-agent software engineering company, query running agent statuses, trigger test generations with per-call model overrides, and control the isolated live application sandbox.

MethodPathDescription
GET/api/v1/system/llmRetrieve active agent model, provider configuration, and resident models
POST/api/v1/system/llm/testExecute on-device test generation with optional per-call model override
GET/api/v1/multi-agent/projectsList active multi-agent projects and repository workspaces
POST/api/v1/projects/{id}/preview/startLaunch live in-browser application sandbox on port 5005
POST/api/v1/projects/{id}/preview/stopTerminate live application sandbox process on port 5005
GET/api/v1/projects/{id}/preview/statusQuery sandbox process state, PID, port, and auto-detected stack runner
GET/api/v1/projects/{id}/preview/logsFetch recent stdout/stderr lines from circular execution log buffer
Example: On-Device Generation with Custom Model OverridecURL
curl -X POST "https://finetunemyai.com/api/v1/system/llm/test" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Write a TypeScript function to validate semver strings.",
    "system_instruction": "You are Marcus, Senior Frontend Agent.",
    "model": "qwen2.5-coder:7b-instruct"
  }'

3. On-Device Inference & Streaming

Stream real tokens directly from your local hardware (Apple Silicon Metal GPU or NVIDIA CUDA) with real-time tokens-per-second and latency telemetry.

POST /api/v1/inference/generateStreaming Inference (SSE)
Request Body (JSON):
{
  "model_id": "mlx-community/Qwen2.5-0.5B-Instruct-4bit",
  "adapter_id": "test_adapter_v1",
  "prompt": "Explain gradient accumulation in distributed training.",
  "max_tokens": 512,
  "temperature": 0.7,
  "stream": true
}
SSE Streaming Event Format:
data: {"token": "Gradient", "done": false}
data: {"token": " accumulation", "done": false}
data: {"token": " calculates", "done": false}
...
data: {"token": "", "done": true, "tokens_per_sec": 42.8, "latency_ms": 118}

4. Compute Nodes & Agent Sync Protocol

Daemon instances on physical workstations poll the control plane, report hardware metrics, and receive training/inference execution orders.

MethodPathDescription
GET/api/v1/devicesList all registered nodes, platform architectures, and online states
POST/api/v1/pairing/startGenerate a 6-digit one-time pairing code (valid for 10 minutes)
POST/api/v1/pairing/claimNode daemon claims 6-digit code in exchange for HMAC device secrets
POST/api/v1/agent/syncNode daemon heartbeat reporting VRAM/MPS status and polling commands

5. Corpora & Quality Auditor

Datasets are audited on-device for duplicate records, length distributions, and syntax hygiene before training.

MethodPathDescription
GET/api/v1/corporaList registered datasets with token counts and quality scores
POST/api/v1/corpora/analyzeRun heuristic Section 11 quality evaluation on sample text
POST/api/v1/corpora/uploadParse multipart local file (.jsonl, .csv, .txt) and score on-device

6. SDK & Code Samples

TypeScript / Node.jsFetch API
const res = await fetch('https://finetunemyai.com/api/v1/inference/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + process.env.API_KEY,
  },
  body: JSON.stringify({
    prompt: 'Implement a binary search tree.',
    max_tokens: 256,
  }),
});
const data = await res.json();
console.log(data.text);
Pythonrequests
import requests

url = "https://finetunemyai.com/api/v1/system/llm/test"
payload = {
    "prompt": "Optimize this SQL query for MariaDB.",
    "model": "qwen2.5-coder:7b-instruct"
}
headers = {"Authorization": "Bearer your_token_here"}

res = requests.post(url, json=payload, headers=headers)
print(res.json()["response"])
Ready to test on your workstation?
Pair your physical machine in 60 seconds with our native command line daemon.