-
Notifications
You must be signed in to change notification settings - Fork 22
Add token usage tracker #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lingtonglu
commented
Aug 3, 2025
- add a token usage tracker service for all the endpoints
- update the providers to extract the cached & reasoning tokens
- implement the tombstone forge key / provider key deletion
- code refactoring
* add a token usage tracker service for all the endpoints * update the providers to extract the cached & reasoning tokens * implement the tombstone forge key / provider key deletion * code refactoring
| def upgrade() -> None: | ||
| op.add_column('provider_keys', sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True)) | ||
| op.add_column('forge_api_keys', sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True)) | ||
| op.alter_column('forge_api_keys', 'key', nullable=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does "key" can be nullable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the user is trying to deleted this record. I would like to wipe out the key value to be None so there is no security issue. We only keep the id/name and the created/deleted timestamp for reference check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same goes for provider keys, I would wipe out the encrypted_api_key value there. Probably base_url as well?