Skip to content

docs: document routing table, cost cap, and provider fallback - #45

Merged
johnnyhuy merged 1 commit into
mainfrom
docs/routing-cap-fallback
Sep 19, 2026
Merged

johnnyhuy merged 1 commit into
mainfrom
docs/routing-cap-fallback

Conversation

@johnnyhuy

Copy link
Copy Markdown
Contributor

Summary

README update that captures the user-facing surface of #4 (PR #40) which shipped in the code without a README counterpart.

Changes

  • New "Routing, Cost Caps, and Fallbacks" section with three subsections:
    • `ROUTES_JSON` shape (route rule schema with example)
    • Per-key `max_cost_usd` enforcement (estimate formula, 429 mapping)
    • Single-hop provider fallback on retryable failures + streaming's pre-first-frame boundary
  • Configuration table gains `ROUTES_JSON`
  • Repository structure updated with the new files (`providers/anthropic.py`, `mojo_bridge/routing.py`, the two new test files, etc.)
  • Roadmap corrected to match reality:
    • Shipped (was unchecked): Postgres-backed virtual keys, Prometheus metrics, Redis rate limiting, in-binary TLS, calver release-please
    • Still pending: real Anthropic adapter (stub in-tree), Bedrock pass-through, guardrails, audit log, SSO, adaptive routing, HTTP/3
  • Test count in the philosophy section: 23 → 56

Why

The behaviour shipped in #40 (cost caps, fallback, routing table) but the README still described a pre-#4 gateway. New operators reading the README would not learn the routing controls exist. This brings the docs back in sync with the code.

Testing

  • `pytest`: 56 passed (no code change, but verified nothing regressed)
  • `ruff check`: clean

Docs-only change, safe to merge once CI is green.

Captures the user-facing surface of #4 (PR #40) that landed in
the code without a README update.

- New "Routing, Cost Caps, and Fallbacks" section: explains
  ROUTES_JSON shape, per-key max_cost_usd enforcement, single-hop
  fallback on retryable failures, and streaming fallback's
  pre-first-frame boundary.
- Configuration table gains ROUTES_JSON.
- Repository structure updated: providers/anthropic.py (stub),
  mojo_bridge/{stream,db,ratelimit,routing}.py, tests/test_cost_cap.py,
  tests/test_provider_fallback.py.
- Roadmap corrected to match reality: Anthropic stub in-tree but
  not a real adapter; Postgres-backed virtual keys, Prometheus
  metrics, Redis rate limiting, in-binary TLS, and calver
  release-please are all shipped (was marked [ ]).
- Philosophy test count bumped 23 → 56.

Co-authored-by: Claude <noreply@anthropic.com>
@johnnyhuy
johnnyhuy merged commit 6291df6 into main Sep 19, 2026
13 checks passed
@johnnyhuy
johnnyhuy deleted the docs/routing-cap-fallback branch September 19, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant