This is a self-hosted LiteLLM proxy with a PostgreSQL ledger. It sits in front of cloud OpenAI calls from MarkUs, the grading platform. It logs each call for billing and audit. It blocks a call that goes over a course budget or the term-wide cap.
ai-telemetry-gateway/
├── README.md (this file)
├── docs/ decision record and user guide
├── lib/ LiteLLM proxy hooks (attribution, gatekeeper, telemetry, CAD FX, encryption, dead-letter drain)
├── db/ SQL migrations, seeds, and named health-check queries
├── tests/ pytest suite against a live local database
└── local-stack/ docker-compose for local development
The gateway works end to end on a local docker-compose stack. A call takes this path:
- MarkUs
- the autotester
- the AI feedback library
- the LiteLLM proxy
- a mock or OpenAI
- the PostgreSQL ledger
docs/USER_GUIDE.md shows how to run it and test it.
MarkUs (Rails) ──► Autotester ──► [ this project ] ──► OpenAI cloud
│
▼
PostgreSQL
(ledger + budgets)
Two proxies split the traffic:
- Local-model traffic (Ollama, llama.cpp) still goes through the existing
markus-ai-serverproxy ("polymouth"). - Cloud OpenAI traffic goes through this project.
See local-stack/README.md.