PromptBusPromptBus

Welcome to PromptBus

PromptBus is a local reverse proxy for Claude Code that automatically routes API requests to the cheapest capable model. It classifies task difficulty using keyword heuristics and rewrites the model and effort fields — saving you money without changing your workflow.


Quick Start

Install and run PromptBus in three commands:

Terminal
npm install -g @promptbus/promptbus
promptbus install
promptbus start

That's it. Claude Code is now configured to route through PromptBus. Open the dashboard at http://localhost:4702 to monitor routing decisions and track savings.


Architecture Overview

PromptBus sits transparently between Claude Code and the Anthropic API:

┌─────────────┐     ┌──────────────┐     ┌─────────────────┐
│ Claude Code │────▶│  PromptBus   │────▶│ api.anthropic.com │
│             │     │  (port 4701) │     │                  │
└─────────────┘     └──────┬───────┘     └─────────────────┘
                           │
                    ┌──────▼───────┐
                    │   Dashboard  │
                    │  (port 4702) │
                    │  + SQLite DB │
                    └──────────────┘

The proxy:

  • Listens on 127.0.0.1:4701
  • Parses each Messages API request
  • Classifies the task type using keyword heuristics
  • Applies your routing rules to select the best model
  • Streams responses without buffering
  • Logs every decision to a local SQLite database

Key Concepts

Task Types

Every request is classified into one of seven task types:read_explain, small_edit, multi_file_refactor, planning, debug_loop, test_generation, or unknown.

Routing Rules

Configured in config/rules.yaml, these rules map task types to target models with configurable confidence floors and effort levels.

Safety First

If the classifier is uncertain (below the confidence threshold) or encounters an error, the request passes through unmodified.