Meter, route, and optimize gen-AI API costs in real-time.
Built for the AI Tinkerers x ElevenLabs Generative Media Hackathon — NYC, April 11, 2026.
Track 3: Economics & Attribution | Bonus: Best Cost Reducer
GenCost is infrastructure that sits between your application and gen-AI APIs. Every API call — voice generation, LLM completion, image synthesis — flows through a metering proxy that logs cost, latency, and lineage in real-time.
Not a content tool. A content economics engine.
| Feature | What It Does |
|---|---|
| Metering Proxy | Intercepts all gen-AI API calls, calculates real cost per call |
| Smart Router | Routes requests to cheapest model meeting quality threshold |
| Content Pipeline | End-to-end generation: LLM → TTS → SFX → Image → Video, all metered |
| A/B Compare | Runs the same prompt at Draft / Standard / Premium tiers side-by-side |
| Attribution Tracker | Cost fingerprint per asset, lineage chains, remix tracking |
| Content Provenance | Voice-clone licenses, consent labels, asset provenance records |
| Waste Detection | Flags generated-but-unused assets, quantifies wasted spend |
| Teleport | Google Street View → fal.ai video + ElevenLabs audio guide (fully metered) |
| Terminal Chat | Siri-style in-app console that drives the router/pipeline from natural language |
| Dashboard | Real-time dark-themed UI with cost tickers, charts, phone-app panels, auth |
┌──────────────────────────────────────────────────────┐
│ localhost:3000 ← Dashboard (Next.js 15 + Supabase) │
│ ↑ WebSocket (real-time cost events) │
│ localhost:8000 ← FastAPI Backend │
│ │ │
│ ├── Auth (Supabase JWT verification) │
│ ├── Metering Proxy (intercepts all API calls) │
│ ├── Smart Router (cost-optimized model picks) │
│ ├── Content Pipeline (LLM → TTS → SFX → img) │
│ ├── Teleport Engine (street view → video+VO) │
│ ├── Attribution Engine (lineage + waste) │
│ ├── Provenance + Voice Licensing │
│ │ │
│ ├──→ api.elevenlabs.io (TTS, SFX, Music) │
│ ├──→ openrouter.ai (LLM routing) │
│ ├──→ api.deepseek.com (DeepSeek direct) │
│ ├──→ api.x.ai (Grok direct) │
│ ├──→ fal.ai (image + video gen) │
│ └──→ maps.googleapis.com (Street View frames) │
│ │
│ SQLite ← all cost data WebSocket ← live events │
└──────────────────────────────────────────────────────┘
| Provider | Get Key At | Cost | What It Powers |
|---|---|---|---|
| ElevenLabs | elevenlabs.io (free Creator tier at hackathon) | Free | TTS, SFX, Music, Teleport audio guide |
| OpenRouter | openrouter.ai | ~$5 credits | LLM routing (DeepSeek, Gemini, Claude, Llama) |
| DeepSeek | platform.deepseek.com | ~$2 credits | Direct cheap LLM |
| Grok/x.ai | console.x.ai | ~$2 credits | Grok 3 Mini |
| fal.ai | fal.ai | ~$5 credits | FLUX image + video generation |
| Google Maps | console.cloud.google.com (Street View Static API) | Free tier | Teleport street-view frames |
| Supabase | supabase.com | Free tier | Auth + per-user settings / API keys |
Total demo budget: ~$15-20 for real API calls.
git clone https://github.com/ron2k1/gencost.git
cd gencost
cp .env.example .env
# Fill in your API keys in .env (at minimum: ElevenLabs, OpenRouter, fal.ai, Supabase)After cloning and filling in .env, run:
install-shortcut.batThis creates a backend\.venv, installs backend + frontend dependencies, writes dashboard\.env.local, and drops a GenCost shortcut on your Desktop. Double-clicking it runs start-gencost.bat, which launches both the FastAPI backend (port 8000) and the Next.js dashboard (port 3000) in their own visible windows, waits for /api/health, and opens your browser. The scripts derive the repo location from their own path, so they work no matter where you cloned the repo.
On first launch, start-gencost.bat will also auto-heal a missing backend\.venv or dashboard\node_modules, so teammates who skip install-shortcut.bat still get a working app.
If you prefer the manual path (macOS/Linux, or just want more control), follow steps 2–4 below.
cd backend
pip install -r requirements.txt
python seed_data.py # Pre-seed 55 pipelines for demo
uvicorn app.main:app --port 8000 --reloadcd dashboard
cp .env.example .env.local # Fill in Supabase + Google Maps keys
npm install
npm run dev # Opens localhost:3000- Open
localhost:3000— see pre-seeded spend data - Click "Generate" with a prompt — watch real API costs tick up live
- Adjust quality tier — see router switch to cheaper/premium models
- Check waste detection — see undistributed asset costs
Dashboard & metering
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/stats |
Aggregated dashboard statistics |
| GET | /api/calls |
Recent API call logs with cost data |
| GET | /api/calls/{pipeline_id} |
Calls scoped to a single pipeline |
| GET | /api/health |
Health check + API key status |
| WS | /ws |
Real-time cost events via WebSocket |
Pipelines & assets
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/pipeline |
Trigger content generation (auth required) |
| GET | /api/pipelines |
List pipeline runs with total costs |
| GET | /api/pipelines/{id} |
Full pipeline detail (calls + assets) |
| GET | /api/assets/{id}/file |
Serve a generated asset file |
| POST | /api/compare |
Run the same prompt at draft / standard / premium in parallel (auth) |
Attribution, waste & provenance
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/attribution/{pipeline_id} |
Cost attribution breakdown |
| GET | /api/lineage/{asset_id} |
Parent/child asset lineage tree |
| GET | /api/waste |
Waste report (generated but unused) |
| POST | /api/distribute/{asset_id} |
Mark an asset as distributed (clears from waste) |
| GET | /api/provenance/{asset_id} |
Consent / provenance label for an asset |
| GET | /api/licenses |
List licensed voice clones |
| GET | /api/licenses/{voice_id} |
Single voice-clone license detail |
Router, models & budget
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/router/table |
Full routing table with model pricing |
| GET | /api/router/decide |
Explain which model the router would pick |
| GET | /api/models |
All known provider models with prices |
| GET | /api/budget |
Current budget + quality tier |
| POST | /api/budget |
Update budget controls (auth) |
User settings (Supabase-backed)
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/settings/keys |
List user's stored API keys (redacted) |
| POST | /api/settings/keys |
Add / update a user's provider key |
| DELETE | /api/settings/keys/{provider} |
Remove a user's provider key |
| POST | /api/generate-icon |
Generate an icon via fal.ai |
Terminal & Teleport
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/terminal/chat |
Siri-style natural-language console (auth) |
| POST | /api/teleport |
Street-view → video + audio guide teleport run (auth) |
| GET | /api/teleport/check |
Street-view availability for a location |
| GET | /api/teleport/streetview-url |
Signed Street View Static image URL |
| Layer | Technology |
|---|---|
| Backend | Python 3.11+, FastAPI, httpx, SQLite, Pydantic, PyJWT, MoviePy |
| Frontend | Next.js 15, React 19, Tailwind v4, Framer Motion, Recharts, Lottie |
| Auth | Supabase (SSR cookies + JWT verification in FastAPI) |
| APIs | ElevenLabs, OpenRouter, DeepSeek, Grok, fal.ai, Google Street View |
| Real-time | Native WebSocket (FastAPI) |
| Database | SQLite (zero-config, hackathon-speed) |
| Module | Files |
|---|---|
| Metering Proxy | backend/app/proxy/ |
| Smart Router | backend/app/router/ |
| Content Pipeline | backend/app/pipeline/ |
| Attribution | backend/app/attribution/ |
| Teleport (Street View → video + VO) | backend/app/teleport/ |
| WebSocket hub | backend/app/ws/ |
| Auth / Supabase JWT | backend/app/auth.py |
| Dashboard | dashboard/src/ |
| Infra / Demo | scripts/, backend/seed_data.py, start-gencost.bat |
| Model | Cost |
|---|---|
| Flash v2.5 | $0.18/1K chars |
| Multilingual v2 | $0.30/1K chars |
| SFX v2 | $0.04/generation |
| Model | Input/1M | Output/1M |
|---|---|---|
| DeepSeek V3 | $0.14 | $0.28 |
| Gemini 2.5 Flash | $0.15 | $0.60 |
| Grok 3 Mini | $0.30 | $0.50 |
| Claude Sonnet 4 | $3.00 | $15.00 |
| Model | Cost |
|---|---|
| FLUX Schnell | $0.003/image |
| FLUX Dev | $0.025/image |
| FLUX Pro 1.1 | $0.05/image |
MIT