Kerdos InfrasoftSafe AI infrastructure

Kerdos
Infrasoft

Initialising000
Skip to content
Kerdos Infrasoft

REST API v1

A stateful, session-based REST API for document Q&A. Upload any document, build a FAISS vector index, and query it with LLaMA 3.1 8B — all in three HTTP calls.

Base URL
https://kerdosdotio-kerdos-llm-rag-api.hf.space
Auth
hf_token in body (chat only)
Session TTL
60 minutes (configurable)

Endpoints

All Endpoints

POST
/sessions
Create a new isolated session. Returns a session_id.

Response

{ "session_id": "uuid-v4" }
GET
/sessions/{id}
Get the status and metadata of an existing session.

Response

{ "session_id": "...", "created_at": "...", "doc_count": 2 }
DELETE
/sessions/{id}
Delete the session and free all in-memory resources (FAISS index + documents).

Response

{ "deleted": true }
POST
/sessions/{id}/documents
Upload and index one or more files. Supported: PDF, DOCX, TXT, MD, CSV (max 50 MB each).

Body

multipart/form-data — field: files (one or more)

Response

{ "indexed": ["report.pdf", "policy.docx"] }
POST
/sessions/{id}/chat
hf_token
Ask a question. Returns a grounded answer generated only from the uploaded documents. Optionally pass hf_token to use production LLaMA inference.

Body

{ "question": "string", "hf_token": "hf_..." (optional) }

Response

{ "answer": "Based on the document..." }
DELETE
/sessions/{id}/history
Clear the conversation history for a session (keeps the indexed documents).

Response

{ "cleared": true }
GET
/health
Health check. Returns API status and version.

Response

{ "status": "ok", "version": "1.0.0" }

Code Samples

Typical Integration Workflow

Create session → upload document → ask question → delete session. Three steps, three endpoints.

BASE="https://kerdosdotio-kerdos-llm-rag-api.hf.space"

# 1. Create session
SESSION=$(curl -s -X POST $BASE/sessions | jq -r '.session_id')
echo "Session: $SESSION"

# 2. Upload a document
curl -X POST "$BASE/sessions/$SESSION/documents" \
  -F "files=@your_doc.pdf"

# 3. Ask a question
curl -X POST "$BASE/sessions/$SESSION/chat" \
  -H "Content-Type: application/json" \
  -d '{"question": "Summarise this document", "hf_token": "hf_..."}'

# 4. Delete session
curl -X DELETE "$BASE/sessions/$SESSION"

Configuration

Authentication & Environment Variables

HuggingFace Token (hf_token)

Required only for the POST /sessions/{id}/chat endpoint. The token is passed in the JSON request body — never as a header.

Must have read access to meta-llama/Llama-3.1-8B-Instruct (accept the licence on HuggingFace)
VariableDefaultDescription
HF_TOKEN—HuggingFace token for LLaMA inference
SESSION_TTL_MINUTES60Session auto-expiry in minutes
MAX_UPLOAD_MB50Max file size per upload in MB

Ready to integrate?

Try the demo now or contact us for a private, on-premise enterprise deployment with your own models and infrastructure.