376fddf18e
server/cost.py — derive_cost() counts LLM input/output tokens (gemma4 + deepseek-v4-flash), Deepgram audio minutes, Cartesia/Piper characters; derives estimated cents from scenarios/cost_rates.yaml. No enforced ceiling (D-012 pilot). CostBreakdown dataclass carries the breakdown dict stored in sessions.cost_breakdown_json. Per G-005: v0.1 logged costs are pilot-config (Ollama tier + cloud), NOT at-scale /learner economics — that requires self-hosted gemma4:e4b + Piper (post-pilot). server/session_recorder.py — SessionRecorder wires the SQLite store into the pipeline lifecycle: start() creates a session row, log_turn() writes turns with ASR/TTS text + latency + accumulates cost inputs, set_branch_path(), end() derives cost + writes outcome + debrief + updates progress. No auth — learner_id is the hardcoded learner-1 (D-007). 7 tests pass (derive_cost basic/piper-zero/breakdown-dict, load_rates yaml, no-enforced-ceiling, recorder full lifecycle with DB assertions, progress updated). ---ci--- phase: 1 milestone: v0.1 plan: 04 task: 04-03,04-04 status: execute persona: backend-engineer,data-engineer requirements: covered: [REQ-STATE-01, REQ-NFR-COST-01] ---/ci---
20 lines
885 B
YAML
20 lines
885 B
YAML
# Praxis v0.1 cost rates — per-unit pricing for the cost logging (D-012, REQ-NFR-COST-01).
|
|
# v0.1 logs actual per-session cost; no enforced ceiling (pilot).
|
|
# Per G-005: these are pilot-config rates (Ollama tier + cloud), NOT at-scale
|
|
# per-learner unit economics — the $3/learner target requires self-hosted
|
|
# gemma4:e4b + Piper (post-pilot).
|
|
|
|
# LLM role-play (gemma4:cloud) — Ollama tier (Pro plan amortized, pilot estimate).
|
|
gemma4_cloud_per_1k_tokens_cents: 0.5
|
|
|
|
# Debrief + classifier (deepseek-v4-flash:cloud) — Ollama tier.
|
|
deepseek_v4_flash_per_1k_tokens_cents: 1.0
|
|
|
|
# ASR (Deepgram Nova-3 streaming) — $0.0043/min → 0.43 cents/min.
|
|
deepgram_per_audio_minute_cents: 0.43
|
|
|
|
# TTS (Cartesia Sonic cloud) — per-char pricing (pilot estimate).
|
|
cartesia_per_1k_chars_cents: 3.0
|
|
|
|
# TTS (Piper self-hosted) — open-weights, $0 marginal cost.
|
|
piper_per_1k_chars_cents: 0.0 |