Files
dd0c/products/01-llm-cost-router
Max Mayfield 6403e7a3bf
Some checks failed
CI — P3 Alert / test (push) Has been cancelled
CI — P5 Cost / test (push) Has been cancelled
CI — P2 Drift (Go + Node) / agent (push) Failing after 46s
CI — P2 Drift (Go + Node) / saas (push) Failing after 1m17s
CI — P4 Portal / test (push) Failing after 16s
CI — P6 Run / saas (push) Failing after 17s
CI — P1 Route (Rust) / test (push) Failing after 11m13s
Move CI workflows to repo root .gitea/workflows/ (Gitea requires root location)
- 6 per-product CI workflows with path filters
- P1: Rust (cargo test + clippy + fmt)
- P2: Go agent (go test + vet) + Node SaaS (tsc + npm test)
- P3-P6: Node (npm ci + tsc + npm test)
- Removed old per-product .gitea dirs (Gitea ignores non-root workflows)
2026-03-01 06:19:42 +00:00
..

dd0c/route — LLM Cost Router & Optimization Dashboard

Drop-in OpenAI-compatible proxy that routes AI requests to the cheapest capable model.

Quick Start

# Start local infra
docker compose up -d

# Run the proxy
OPENAI_API_KEY=sk-your-key cargo run --bin dd0c-proxy

# Test it
curl http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer your-dd0c-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello"}]}'

Architecture

  • Proxy Engine (Rust/Axum) — <5ms overhead, SSE streaming, async telemetry
  • Router Brain — Complexity classification, cost-based routing, fallback chains
  • Dashboard API — REST API for config, analytics, team management
  • TimescaleDB — Time-series telemetry with continuous aggregates
  • PostgreSQL — Config, auth, routing rules
  • Redis — API key cache, rate limiting

Project Structure

src/
  proxy/     — Proxy server (main entry point)
  api/       — Dashboard API server
  worker/    — Background jobs (digests, alerts)
  router/    — Routing logic & complexity classifier
  auth/      — API key validation, JWT, OAuth
  config/    — App configuration
  data/      — Data layer traits (EventQueue, ObjectStore)
  analytics/ — PostHog PLG instrumentation
migrations/  — PostgreSQL + TimescaleDB schemas
tests/       — Unit, integration, E2E tests
infra/       — CDK / deployment configs

Pricing

Tier Price Requests/mo Retention
Free $0 10K 7 days
Pro $49/mo 1M 90 days
Enterprise Custom Unlimited 1 year