Skip to content

feat: add token usage tracking with real API data and fallback estima…#54

Merged
iohub merged 4 commits into
mainfrom
feat-openai-go
May 7, 2026
Merged

feat: add token usage tracking with real API data and fallback estima…#54
iohub merged 4 commits into
mainfrom
feat-openai-go

Conversation

@iohub
Copy link
Copy Markdown
Owner

@iohub iohub commented May 7, 2026

No description provided.

iohub added 4 commits May 7, 2026 21:51
…code_snippet, query_code_skeleton) by JSON structure detection instead of tool name
…tion

- Add TokenUsage struct to LLM Response to carry token statistics
- Extract token usage from OpenAI API responses (both streaming and non-streaming)
- Add PublishWithMetadata to message publisher for passing metadata
- Propagate token usage from agents to TUI via metadata
- Prefer real API token counts in TUI, fallback to content-based estimation
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @iohub, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@iohub iohub merged commit ea8a9eb into main May 7, 2026
1 check 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