semblance-dev/backend/requirements.txt
Vadym Samoilenko 3e9ccafad2 Add LLM usage tracking infrastructure (Phases A-C)
- Model renames: gpt-5.2 → gpt-5.4-2026-03-05, gemini-3-pro-preview → gemini-3.1-pro-preview; retire gpt-4.1 via alias fallback
- New: llm_usage_context.py (ContextVar-based attribution), model_pricing.py (tiered pricing + 60s cache), usage_event.py (append-only telemetry), quota.py (user/FG quota enforcement with 80% warning)
- Wire _record_usage into all 3 LLM methods; set_llm_context at every service entry point
- Fix admin_required decorator (was sync, never awaited User.find_by_id); add active_required and with_user_context decorators
- Inject user_id into ContextVar from JWT on every authenticated request
- Add DB indexes for usage_events, model_pricing, users collections
- Seed script for model pricing (gpt-5.4 single-tier, gemini-3.1 two-tier 200k threshold)
- Fix parse_json_response NameError (logger undefined at module level)
- 70 passing tests: conftest.py with sys.modules stubs, test_usage_infrastructure.py (52 tests), rewrite stale test_llm_service.py (18 tests)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:08:27 +01:00

36 lines
567 B
Text
Executable file

# Web Framework (Async)
quart==0.20.0
quart-cors==0.8.0
hypercorn==0.17.3
werkzeug==3.1.3
# Database (Async)
motor==3.7.1
pymongo==4.14.1
# Authentication & Security
bcrypt==4.0.1
PyJWT==2.8.0
msal==1.24.1
# AI & LLM Services
google-genai
openai==1.99.5
llama-cloud-services==0.6.62
# WebSocket & Real-time
python-socketio==5.13.0
# HTTP Clients
httpx==0.28.1
requests==2.31.0
# Data Validation & Processing
pydantic==2.11.7
pillow==11.3.0
# Configuration & Utilities
python-dotenv==1.1.1
# Token estimation (used by backfill_usage.py script)
tiktoken>=0.9.0