Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ntrp.io/llms.txt

Use this file to discover all available pages before exploring further.

Connect to event stream

Open a persistent SSE connection to receive all events for a session.
curl -N http://localhost:6877/chat/events/{session_id} \
  -H "Authorization: Bearer $API_KEY"
Returns a text/event-stream response. See Streaming for event types. The connection stays open with keepalive pings every 5 seconds.

Send message

Fire-and-forget message send. If an agent is already running, the message is queued for safe injection at the next turn boundary.
message
string
required
The user message to send.
images
array
Optional array of image objects to include with the message. Each image has media_type (e.g. image/jpeg, image/png) and data (base64-encoded content).
session_id
string
required
Target session ID.
skip_approvals
boolean
default:"false"
Auto-approve all tool calls.
curl -X POST http://localhost:6877/chat/message \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "What meetings do I have today?", "session_id": "abc-123"}'
With an image:
curl -X POST http://localhost:6877/chat/message \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "What is in this image?",
    "session_id": "abc-123",
    "images": [{"media_type": "image/jpeg", "data": "<base64>"}]
  }'
{"run_id": "run_abc", "session_id": "abc-123"}
The agent response arrives on the SSE event stream.

Submit tool result

Approve or reject a pending tool call.
curl -X POST http://localhost:6877/tools/result \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "run_id": "run_abc",
    "tool_id": "tc_abc123",
    "result": "Approved",
    "approved": true
  }'

Background a run

Move an active agent run into background mode. The UI is unblocked immediately and results are delivered via SSE when complete.
curl -X POST http://localhost:6877/chat/background \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"run_id": "run_abc"}'

Cancel

Cancel a running agent loop.
curl -X POST http://localhost:6877/cancel \
  -H "Authorization: Bearer $API_KEY"

Context usage

Get current token and tool-schema usage for the session. During an active run, tool counts reflect the tools visible to that run after deferred loading.
curl http://localhost:6877/context \
  -H "Authorization: Bearer $API_KEY"
{
  "model": "claude-sonnet-4-6",
  "limit": 200000,
  "total": 12500,
  "message_count": 15,
  "tool_count": 46,
  "visible_tool_count": 18,
  "deferred_tool_count": 28,
  "loaded_tool_count": 2
}
  • tool_count: total tools available after provider/service capability filtering.
  • visible_tool_count: schemas currently sent to the model.
  • deferred_tool_count: tools hidden until load_tools is called.
  • loaded_tool_count: deferred tools loaded in the active run. This resets after compaction.

Compact context

Compress conversation history to free token space.
curl -X POST http://localhost:6877/compact \
  -H "Authorization: Bearer $API_KEY"