New development preview: Go + TypeScript Request Inspector.
Hosted read-only inspector: https://inspector.selena.ink.
Run pnpm dev:inspector for a local tool-call and failure lab; no provider key is needed.
Run pnpm demo:inspector for the browser-only offline demo, including event playback and JSON snapshot import/export. It needs neither Go nor an API key.
See the two-minute walkthrough and engineering notes, or optional free API testing.
The existing gateway below remains available during this new phase.
An authenticated, OpenAI-compatible LLM gateway with streaming proxying, encrypted provider credentials, per-key rate limits, and a real-time React control plane.
Live demo: honobox.selena.ink — choose the read-only demo to explore synthetic traffic, failover metrics, models, and request logs without a token.
HonoBox focuses on the parts of an LLM gateway that are easy to get subtly wrong:
- Streaming lifecycle — downstream disconnects propagate through
AbortSignaland cancel the upstream request. - Failure isolation — per-model circuit breakers and retry-before-first-token failover avoid cascading provider failures without mixing streamed output.
- Separated access paths — gateway API keys protect inference traffic; an independent admin token protects the control plane.
- Secret handling — gateway keys are stored as SHA-256 hashes and provider keys are encrypted with AES-256-GCM.
- Request visibility — trace IDs, latency, token usage, errors, and live SSE updates are available in the dashboard.
- Metrics — authenticated Prometheus counters and latency histograms expose served models, fallback traffic, status codes, and upstream failures.
- Provider adapters — OpenAI-compatible providers, Anthropic, and DeepSeek share one request contract.
See the architecture and failure-path diagrams for the complete request lifecycle.
Application React control plane
│ Bearer sk-... │ Bearer ADMIN_TOKEN
▼ ▼
┌──────────────────────────────────────────────────────────┐
│ Hono gateway │
│ auth → rate limit → circuit breaker → provider adapter │
│ retry/failover → stream lifecycle │
└───────────────────┬───────────────────────┬──────────────┘
│ │
LLM providers PostgreSQL
configs + traces
| Layer | Technology |
|---|---|
| Gateway | Hono, Node.js, TypeScript |
| Control plane | React 19, TanStack Query, Recharts |
| Persistence | PostgreSQL, Drizzle ORM |
| Streaming | Web Streams, SSE, AbortSignal |
| Quality | Vitest, TypeScript project references, GitHub Actions |
Requirements: Node.js 22+, pnpm, and Docker.
pnpm install
cp apps/gateway/.env.example apps/gateway/.env
# Edit ADMIN_TOKEN and MODEL_ENCRYPTION_KEY first.
pnpm db:up
pnpm db:push
pnpm dev- Dashboard: http://localhost:5173
- Gateway: http://localhost:3000
- Health check: http://localhost:3000/health
The dashboard asks for ADMIN_TOKEN on first load and keeps it only in the current browser tab.
Use the dashboard, or call the control-plane API with the admin token:
curl -X POST http://localhost:3000/api/models \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "GPT-4o",
"provider": "openai",
"modelId": "gpt-4o",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "your-provider-key"
}'
curl -X POST http://localhost:3000/api/api-keys \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"local-app","rateLimit":100}'The generated gateway key is returned once. Only its hash and display prefix are persisted. A model can optionally reference another enabled model as its fallback in the dashboard or through the fallbackModelId field.
Failover is intentionally conservative: only network errors, timeouts, rate limits, and upstream 5xx responses are retryable. Streaming requests switch providers only before the first chunk reaches the client; once output begins, HonoBox never combines content from two providers.
curl -N http://localhost:3000/v1/chat/completions \
-H "Authorization: Bearer sk-your-gateway-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role":"user","content":"Hello"}],
"stream": true
}'Available models are exposed at GET /v1/chat/models and require the same gateway key.
pnpm checkThis runs linting, type checking, tests, and production builds for every workspace package. The same command runs in GitHub Actions.
The check also imports the compiled Node.js application and sends a smoke request, catching ESM resolution errors that type checking alone cannot detect.
docker compose up -d --wait postgres
pnpm --filter @ai-gateway/gateway build
pnpm lab:faultThe deterministic lab injects primary-provider HTTP 503 responses, verifies non-streaming and streaming failover, checks Prometheus output, and reports P50/P95 latency. See the latest measured report.
ADMIN_TOKENis for control-plane operations and must not be used as an inference key.- Gateway API keys are shown once and compared by hash.
- Provider credentials are encrypted at rest with
MODEL_ENCRYPTION_KEY. - Deploy behind HTTPS and rotate both admin and encryption secrets through your platform's secret manager.
- HonoBox is currently a single-node gateway; rate limits and traces are shared through PostgreSQL, while circuit state is process-local.
- Weighted provider routing and health-aware failover
- Distributed circuit-breaker state for multi-node deployments
- OpenTelemetry traces and multi-process metric aggregation
- Longer-running public-cloud soak tests
MIT

