๐Ÿ”ท
Locentra OS
๐Ÿ”ท
Locentra OS
  • ๐Ÿง  Introduction
  • โš™๏ธ Features
  • ๐Ÿ›  Under The Hood
  • ๐Ÿงฉ Installation
  • ๐Ÿš€ Usage
  • ๐Ÿงฎ CLI Commands
  • ๐Ÿ”Œ API Reference
  • ๐Ÿค– Agents System
  • ๐Ÿง  Semantic Memory
  • ๐ŸŽ“ Training & Fine-Tuning
  • ๐Ÿ” $LOCENTRA Token Access
  • ๐Ÿ— System Architecture
  • ๐Ÿงฉ Extending the System
  • ๐Ÿงช Testing & Quality Assurance
  • ๐Ÿ“„ License & Open Source
Powered by GitBook
On this page
  • ๐Ÿงญ API Structure
  • ๐Ÿ”’ Authentication
  • ๐Ÿงช Testing & Debugging

๐Ÿ”Œ API Reference

Locentra OS exposes a full REST API built on FastAPI, enabling easy integration with external tools, scripts, or web UIs.

  • ๐Ÿ”— Base URL:

    http://localhost:8000
  • ๐Ÿ“˜ Swagger Docs:

    http://localhost:8000/docs

๐Ÿงญ API Structure

All endpoints are prefixed with:

/api/

๐Ÿ“ค POST /api/llm/query

Send a prompt to the model and receive a generated response.

๐Ÿงพ Request

{
  "prompt": "Explain rollups in Ethereum"
}

โœ… Response

{
  "response": "Rollups are a Layer 2 scaling solution that batch transactions..."
}

๐Ÿงช Curl Example

curl -X POST http://localhost:8000/api/llm/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "What is Solana?"}'

๐ŸŽ“ POST /api/llm/train

Train the model on a new prompt โ†’ completion pair.

๐Ÿงพ Request

{
  "prompt": "What is slippage?",
  "completion": "Slippage refers to the difference between expected and actual execution price."
}

โœ… Response

{
  "status": "ok",
  "message": "Training sample processed."
}

๐Ÿง  Optional Add-ons (via metadata)

  • Semantic vectorization of the prompt

  • Tagging (for filtered memory access)

  • Dry-run flag (simulate training without execution)

Use this endpoint to feed real-world data into your model โ€” one sample at a time.


๐Ÿ‘ค POST /api/user/create

Registers a new user.

๐Ÿงพ Request

{
  "username": "alice"
}

Note: email is optional and unused unless extended.

โœ… Response

{
  "username": "alice",
  "api_key": "d3f3b38e-42aa-4c9c-9447-b5409b09f123"
}

Used internally by scripts and agents to track prompt provenance or session state.


๐Ÿ“ก GET /api/system/logs

Streams live logs from backend activity.

โœ… Response

[2025-05-19 13:44] Training started: 12 samples
[2025-05-19 13:45] Vector memory updated
[2025-05-19 13:46] Inference: Prompt received from CLI

Supports optional filtering by level and limit: /api/system/logs?level=INFO&limit=100


๐Ÿ”’ Authentication

Locentra OS ships with open API endpoints by default to support local-first development.

If you need access control:

  • ๐Ÿ” Add middleware in: backend/api/middleware/auth.py

  • ๐Ÿ”‘ Enable token-auth or key-auth in server.py

  • ๐Ÿงฑ Use Docker network isolation or NGINX ACLs for perimeter security

Locentra doesnโ€™t lock you inโ€”but it gives you the hooks to lock things down.


๐Ÿงช Testing & Debugging

You can explore all endpoints via Swagger:

http://localhost:8000/docs

Or test manually with tools like:

  • curl (command line)

  • httpie

  • Postman / Insomnia

  • Python scripts using requests

Every call hits the same backend used by the CLI and Web UI โ€” itโ€™s all one engine.

Previous๐Ÿงฎ CLI CommandsNext๐Ÿค– Agents System

Last updated 18 hours ago

Page cover image