model-finops
CLAUDE.md0 starsChanged 4 months agoMITView on GitHub
Intelligent LLM router that reduces AI API costs by routing prompts to the most cost-efficient model — FastAPI backend with semantic caching (pgvector), multi-tenant RLS, MCP integration for Claude Desktop, and a Next.js cost dashboard. Requires: SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_KEY, GOOGLE_API_KEY, ANTHROPIC_API_KEY, OPENROUTER_API_KEY
- Reads credentials
In this repository2 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- ai-cost-optimizerSkill
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 54
No OpenAI as primary provider — Anthropic Claude or OpenRouter only
- Distinctive: line 56
All cost calculations in USD cents for precision
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — model-finops
Intelligent LLM router that reduces AI API costs by routing prompts to the most cost-efficient model — FastAPI backend with semantic caching (pgvector), multi-tenant RLS, MCP integration for Claude Desktop, and a Next.js cost dashboard.
Stack
- Backend: FastAPI + Python 3.10+
- Frontend: Next.js 15 + Tailwind CSS + shadcn/ui
- Database: Supabase (PostgreSQL + pgvector for semantic caching)
- AI: Multi-provider — Anthropic Claude, Google Gemini, Cerebras, OpenRouter (NO OpenAI)
- Deployment: RunPod (backend) + Vercel (frontend dashboard)
- Infrastructure: Docker, MCP server for Claude Desktop
Quick Start
./init.shKey Files
app/main.py— FastAPI entry pointapp/routing/engine.py— RoutingEngine with ComplexityStrategy / LearningStrategy / HybridStrategyapp/database/cost_tracker_async.py— Semantic cache with 95% similarity thresholdapp/database/supabase_client.py— Async Supabase wrapperapp/embeddings/generator.py— sentence-transformers (all-MiniLM-L6-v2, 384D)app/experiments/tracker_async.py— A/B testing frameworkapp/auth.py— JWT auth middlewaremcp/server.py— MCP server for Claude Desktopfrontend/— Next.js cost dashboardmigrations/— Supabase SQL migrations (pgvector, RLS)requirements.txt— Python deps
Development
# Backend
python app/main.py
# or: uvicorn app.main:app --reload
# Frontend
cd frontend && npm run dev
# Tests
pytest tests/Environment
Requires: SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_KEY, GOOGLE_API_KEY, ANTHROPIC_API_KEY, OPENROUTER_API_KEY
Policy
- No OpenAI as primary provider — Anthropic Claude or OpenRouter only
- Routing logic lives exclusively in
app/routing/ - All cost calculations in USD cents for precision
- Provider classes must implement
send_message()method
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

