Skip to content

feat(v0.7.0): implement cost tracking and token usage#11

Merged
dongkoony merged 1 commit into
mainfrom
feat/cost-tracking-v0.7.0
Jan 20, 2026
Merged

feat(v0.7.0): implement cost tracking and token usage#11
dongkoony merged 1 commit into
mainfrom
feat/cost-tracking-v0.7.0

Conversation

@dongkoony
Copy link
Copy Markdown
Owner

Phase 1: Basic token tracking and cost calculation

Changes:

  • Add token usage fields to llm_logs table (input/output/cached/reasoning)
  • Add cost tracking fields (cost_input_usd, cost_output_usd, cost_total_usd)
  • Create llm_model_pricing table for model pricing configuration
  • Implement cost calculation logic in cost_utils.py
  • Update llm_client.py to extract token information from API responses
  • Modify /chat endpoint to save token and cost data
  • Add architecture design document for v0.7.0
  • Add AI agent documentation (agent/ directory)

Database:

  • Migration script: scripts/migrate_v0.7.0.sql
  • New table: llm_model_pricing with 7 initial models
  • New columns in llm_logs: 8 fields (5 token + 3 cost)

API Changes:

  • ChatResponse now includes usage and cost fields (optional)
  • Backwards compatible: existing API calls work without changes

Docs:

  • docs/ARCHITECTURE_v0.7.0.md: Complete v0.7.0 design document
  • agent/: AI agent documentation for Claude Code and OpenAI Codex

Related:

  • Issue: Cost tracking feature request
  • Roadmap: v0.7.0 milestone

Phase 1: Basic token tracking and cost calculation

Changes:
- Add token usage fields to llm_logs table (input/output/cached/reasoning)
- Add cost tracking fields (cost_input_usd, cost_output_usd, cost_total_usd)
- Create llm_model_pricing table for model pricing configuration
- Implement cost calculation logic in cost_utils.py
- Update llm_client.py to extract token information from API responses
- Modify /chat endpoint to save token and cost data
- Add architecture design document for v0.7.0
- Add AI agent documentation (agent/ directory)

Database:
- Migration script: scripts/migrate_v0.7.0.sql
- New table: llm_model_pricing with 7 initial models
- New columns in llm_logs: 8 fields (5 token + 3 cost)

API Changes:
- ChatResponse now includes usage and cost fields (optional)
- Backwards compatible: existing API calls work without changes

Docs:
- docs/ARCHITECTURE_v0.7.0.md: Complete v0.7.0 design document
- agent/: AI agent documentation for Claude Code and OpenAI Codex

Related:
- Issue: Cost tracking feature request
- Roadmap: v0.7.0 milestone
@dongkoony dongkoony merged commit 5f79046 into main Jan 20, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant