feat(v0.7.0): implement cost tracking and token usage#11
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1: Basic token tracking and cost calculation
Changes:
Database:
API Changes:
Docs:
Related: