API

API Reference

GET /api/models
Danh sách model IDs cho tích hợp.
curl -X GET http://127.0.0.1:9999/api/models \
  -H "Authorization: Bearer lcAi_u_<USER_KEY>"
POST /api/chat
Trả về response full text (đã sanitize). Phù hợp server-to-server.
curl -X POST http://127.0.0.1:9999/api/chat \
  -H "Authorization: Bearer lcAi_u_<USER_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"model":"locaith-omni","message":"Soạn công văn đôn đốc nợ theo Nghị định 30","conversation_id":"conv_001"}'
POST /api/chat/stream
SSE streaming: phát token theo thời gian thực.
curl -N http://127.0.0.1:9999/api/chat/stream \
  -H "Authorization: Bearer lcAi_u_<USER_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"model":"locaith-omni","message":"Soạn công văn","conversation_id":"conv_stream_001"}'
SSE event schema
{"type":"stream","data":"..."}
{"type":"complete_response","data":"<full text>"}
{"type":"error","data":"..."}
{"type":"log","data":"..."}
POST /api/pdf/process
Proxy PDF tools (iLoveAPI). Nhận multipart form-data và trả file output (PDF hoặc ZIP).
curl -X POST http://127.0.0.1:9999/api/pdf/process \
  -H "Authorization: Bearer lcAi_u_<USER_KEY>" \
  -F "tool=compress" \
  -F "options_json={\"compression_level\":\"recommended\"}" \
  -F "files=@/path/to/file.pdf"