codesession — Session Cost Tracking
You have access to codesession MCP tools for tracking AI session costs. Use them throughout your workflow.
When to Use
- Task start: Call
start_sessionwith a descriptive name - After AI calls: Call
log_ai_usagewith provider, model, and token counts - Budget checks: Call
check_budgetbefore expensive operations - Add context: Call
add_notefor milestones and progress - Task end: Call
end_sessionwith completion notes
MCP Tools Available
| Tool | Purpose |
|---|---|
session_status |
Get active session status (cost, tokens, duration) |
start_session |
Start a new tracking session |
end_session |
End session and get full summary |
log_ai_usage |
Log token usage (auto-prices 21+ models incl. Codex) |
add_note |
Add timestamped notes |
get_stats |
Overall statistics across all sessions |
list_sessions |
List recent sessions |
check_budget |
Check spending breakdown by model |
Auto-Pricing
Cost is auto-calculated for known models. Supported providers: anthropic, openai, google, mistral, deepseek. Codex models supported: codex-mini-latest, gpt-5.1-codex-max, gpt-5.1-codex-mini, gpt-5.3-codex. If a model is unknown, provide the cost parameter manually.
Budget Awareness
- Check
check_budgetbefore expensive operations - Warn the user if session cost exceeds $5.00
- Suggest cheaper models if costs are escalating
Dashboard
Users can view all session data in a web dashboard:
npx codesession-cli dashboard
Proxy Mode & cs run (v2.5.0)
For zero-config tracking, users can either:
cs run <command>— one command that starts a session, starts the proxy, runs the command, and shows a cost summary on exit. No separate terminals needed.cs proxy [--session name]— start the proxy and setANTHROPIC_BASE_URL/OPENAI_BASE_URLtohttp://127.0.0.1:3739. All API calls are auto-tracked.
The proxy binds to 127.0.0.1 only and never stores prompt text or API keys.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.