Skip to main content
Every request proxied through MonoRelay is written to a local SQLite database with full token counts, latency metrics, and optional request/response body previews. The logs API lets you page through recent requests, retrieve a specific log entry with its full body, stream new entries in real time via SSE, filter by provider or model, and clear the log store when needed.

Authentication

All log endpoints require a valid JWT token:

Endpoints

GET /api/logs

Return a paginated list of recent log entries, newest first. Heavy fields (request_full, response_full) are stripped from the list view; fetch them individually via /api/logs/{id}. Query parameters:
Response envelope:

GET /api/logs/

Retrieve a single log entry by ID, including the full request and response bodies. Log IDs are integers. Pending (in-flight streaming) requests use negative temporary IDs until finalized.
Returns 404 if the ID is not found in the database or in the in-memory pending store.

GET /api/logs/stream

An SSE (Server-Sent Events) endpoint that pushes new and updated log entries in real time. The dashboard uses this to display live request activity without polling.
The stream emits two event types: A heartbeat comment (: heartbeat) is sent every 20 seconds to keep the connection alive through proxies. Example SSE output:

GET /api/logs/filtered

Return logs filtered by provider, model, status, or date range. Applies in-memory filtering after loading a larger window of recent entries. Query parameters:

POST /api/logs/clear

Delete all log entries from the database and clear any in-memory pending entries.

Log record fields

Each log entry returned by the API contains these fields:
integer
Database row ID. Negative values indicate pending (in-flight) entries not yet written to disk.
number
Unix timestamp (float) of when the request was received.
string
The resolved model name as used for the upstream request.
string
The provider that handled the request.
string
Label of the API key used, as configured in providers.<name>.keys[].label.
integer
HTTP status code returned by the upstream provider (e.g. 200, 429, 500).
number
Total request latency in milliseconds from receipt to final byte.
number
Time to first token in milliseconds. Populated for streaming requests.
integer
Number of prompt tokens consumed.
integer
Number of completion tokens generated.
number
Estimated USD cost calculated from configured cost_per_m_input / cost_per_m_output rates.
integer
Tokens served from the upstream prompt cache (Anthropic cache read).
integer
Tokens written to the upstream prompt cache (Anthropic cache creation).
boolean
true if the request used streaming mode.
string
Error description if the request failed, otherwise null.
string
Error category string, e.g. "rate_limit_error", "proxy_error".
string
Truncated preview of the request body (length controlled by logging.content_preview_length). Stripped from list endpoints; available in detail view.
string
Truncated preview of the response content. Updated in real time for streaming requests.
string
Full JSON request body. Only included in single-entry detail responses (GET /api/logs/{id}).
string
Full JSON response body. Only included in single-entry detail responses.
string
Originating client IP address, resolved from x-real-ip, x-forwarded-for, or the direct connection.
string
The User-Agent header sent by the calling client.

Logging configuration reference

Logging is configured in config.yml under the logging key: Example: