PromptBusPromptBus

API Reference

The PromptBus dashboard server exposes a REST API for monitoring and configuration. All endpoints are served from http://localhost:4702.
Responses are JSON unless otherwise specified.


Endpoints

GET/api/summary

Aggregated statistics

json
{
  "total_requests": 1247,
  "downgraded": 843,
  "cost_saved": 12.45,
  "reroute_rate": 0.67
}
GET/api/logs?limit=50

Recent request logs

json
[
  {
    "id": 1,
    "timestamp": "2026-07-13T12:34:56Z",
    "model_requested": "claude-sonnet-5",
    "task_type": "read_explain",
    "model_used": "claude-haiku-4-5",
    "effort": "low",
    "downgraded": true,
    "reason": "Matched read_explain rule",
    "latency_ms": 1234
  }
]
GET/api/log/:id

Single log detail with full TaskProfile

json
{
  "id": 1,
  "model_requested": "claude-sonnet-5",
  "task_type": "read_explain",
  "model_used": "claude-haiku-4-5",
  "downgraded": true,
  "reason": "Matched read_explain rule",
  "matched_rule": "read_explain → haiku",
  "confidence": 0.85,
  "signals": {
    "prompt_length_tokens": 45,
    "num_files_in_context": 1,
    "num_tool_calls_so_far_in_turn": 0,
    "contains_keywords": true
  }
}
GET/api/logs/export?start=&end=

CSV export of logs within date range

json
CSV file download
GET/api/rules

Current routing rules configuration

json
{
  "version": 1,
  "enabled": true,
  "default_model": "claude-sonnet-5",
  "confidence_floor_for_any_downgrade": 0.6,
  "routes": [...]
}
PUT/api/rules

Update and save routing rules

json
{
  "version": 1,
  "enabled": true,
  "routes": [...]
}
GET/api/status

Proxy and system status

json
{
  "proxy_running": true,
  "proxy_port": 4701,
  "dashboard_port": 4702,
  "enabled": true,
  "claude_configured": true
}
PUT/api/config

Toggle routing enabled/disabled

json
{ "enabled": false }

Status Codes

  • 200 OK — Successful GET or PUT
  • 400 Bad Request — Invalid configuration data
  • 404 Not Found — Log ID not found
  • 500 Internal Server Error — Server-side failure

Error Format

Error Response
{ "error": "Invalid configuration: missing field 'version'" }