Skip to main content
MonoRelay exposes a management API at /api/ for programmatic administration — the same API the dashboard frontend uses internally. These endpoints let you inspect server status, manage provider configuration, test connectivity, control the response cache, and track per-client usage without touching the config file directly.

Authentication

Most /api/ endpoints require a valid JWT token issued after login. Pass the token as a Bearer header:
Endpoints marked public do not require a token and are accessible immediately after server start.

Server information

GET /api/info

Returns the server’s network addresses, connection info, and live system resource metrics. This endpoint is public and requires no authentication.
string
The server’s detected public or local IP address.
string
The bind host from server configuration.
integer
The port the server is listening on (default 8787).
string
The constructed OpenAI-compatible base URL clients should point to, e.g. http://1.2.3.4:8787/v1.
boolean
Whether static access-key authentication is enabled in addition to JWT.
object
Live resource snapshot:
  • cpu_percent — CPU utilization (0–100)
  • memory_total / memory_used / memory_percent — RAM in bytes and percent
  • disk_total / disk_used / disk_percent — disk in bytes and percent
Example response:

GET /health

Lightweight health check. Returns 200 OK with provider status when the server is running. Public endpoint.
string
Always "ok" when the server is healthy.
object
One entry per configured provider:
  • enabled — whether the provider is active
  • keys — number of configured API keys
  • base_url — the upstream endpoint

Providers

GET /api/providers

List all configured providers with their current status, key inventory, and routing settings. This endpoint is public. Query parameters:
boolean
true on a successful response.
object
Map of provider name to provider info:
  • enabled — whether the provider is active
  • provider_type — "api" or "web_reverse"
  • base_url — upstream API base URL
  • keys — array of key summaries (key value, label, weight, enabled)
  • rate_limit_cooldown — cooldown in seconds after a rate-limit hit
  • timeout — per-request timeout in seconds
  • models — include/exclude model filter lists
  • test_model — model used for connectivity tests

POST /api/providers//test

Send a minimal test request to the specified provider to verify API key validity and network reachability.
string
"ok" on success, "error" on failure.
string
Human-readable result message.

POST /api/providers//verify

Run a deeper multi-probe verification against a provider. Runs text generation, tool calling, and streaming probes in parallel and returns per-probe results. Request body:
array
List of probes to run. Accepted values: "text-gen", "tool-call", "streaming". Defaults to all three.
string
Override the model used for probing. Falls back to the provider’s test_model or a built-in default.
string
"pass" if all probes succeeded, "partial" if some are unsupported, "fail" if any probe failed.
object
Per-probe result with status, latency_ms, error, and summary fields.

Configuration

GET /api/config

Return the raw YAML config file content, preserving comments. Requires authentication.
string
Raw YAML string of the current config.yml.

PUT /api/config

Update the config file with new YAML content and hot-reload all components without restarting. Validates YAML syntax and the MonoRelay config schema before writing.
string
required
Complete YAML config file content to write. Must be valid YAML that parses into a valid AppConfig.

GET /api/config/full

Return the full configuration as a parsed JSON object, including secrets (admin-only). Requires admin privileges.

PUT /api/config/full

Replace the full configuration from a JSON body (admin-only). Accepts the same structure returned by GET /api/config/full. Secrets are stored separately in the secrets manager.

Response cache

GET /api/cache/stats

Return current response cache statistics.
integer
Number of cache hits since last clear.
integer
Number of cache misses.
integer
Current number of cached entries.
integer
Maximum cache capacity.

POST /api/cache/clear

Invalidate the response cache. Pass an optional model query parameter to clear only entries for a specific model.

POST /api/cache/enable

Enable or reconfigure the response cache at runtime.

Per-client usage

GET /api/usage/stats

Return usage statistics tracked per client identity. Pass client_id to scope results to one client.

POST /api/usage/clear

Reset usage stats. Pass client_id to clear only that client’s counters.