Moody Bear Platform
I run several apps that call AI models, and I wanted one honest answer to two questions... what does each AI feature cost, and how often is it wrong? So every model call from every app now goes through one gateway, and every call gets traced.
how it works
Each app gets its own gateway key instead of a provider key. The gateway forwards the call to Anthropic or OpenAI and records it in Langfuse with tokens, cost, latency and the full prompt and reply. Because the key says which app made the call, cost and quality roll up per app without any app having to report anything.
The gateway is never something an app depends on. Each app checks whether it's up, and if it isn't, or a call through it fails, the app calls the provider directly and carries on. Users get the same answers either way... the only difference is whether the call shows up in Langfuse.
the apps
- TradeInsights, my trading analytics SaaS. All of its chat calls to OpenAI and Anthropic go through the gateway when it's up, with automatic fallback. Embeddings and batch jobs always go direct.
- Party Trivia Adventure, a team trivia game for phones and tablets. Its question packs are generated and fact-checked through the gateway.
- Convergence, a modular military simulation game where role-specific packs (infantry, armor, air, naval, command) play together in the same missions. It plugs into the same gateway as its AI features come online.
- Evelora, another game I have in development. It plugs into the same gateway as its AI features come online.
what's running
- Langfuse v4 and its AI Gateway in Docker, with every secret generated by script and nothing reachable from outside the machine
- One-command start and stop, because the same machine is used for other work during the day
- TradeInsights and the trivia generator wired through it, each falling back to the provider on its own when the gateway is off
- A first real eval... a second model fact-checks every trivia question before it ships
what's next
- An agent registry in Python with FastAPI and Postgres, listing every AI feature, which app owns it, what it's allowed to do and what it costs
- A React and TypeScript dashboard across all apps... cost and quality trends in one view
- Tenant separation with Postgres row-level security, so each app only ever sees its own data
- An MCP server that gives agents read-only context from each app
ground rules
AI agents write a lot of my code, so they work under the same rules everywhere. They don't commit, and they don't run anything against a database. They write the change or the script, and I review it and run it. The platform is partly a way to make those rules visible.