Token usage mismatch when stopping generation mid-stream #9309
Unanswered
398168441
asked this question in
Troubleshooting
Replies: 1 comment 2 replies
-
Token metadata is not available from the provider when cancelling a request since the connection is severed, so an estimate is made instead. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
When I click Stop during streaming, the values passed to spendTokens.tokenUsage.promptTokens and .completionTokens don’t match the tokens actually charged by OpenRouter.
Version Information
When I click Stop during streaming, the values passed to spendTokens.tokenUsage.promptTokens and .completionTokens don’t match the tokens actually charged by OpenRouter.
Steps to Reproduce
1. Send a prompt.
2. While the model is streaming, click Stop.
3. Compare tokenUsage from spendTokens with OpenRouter’s reported usage.
Expected: tokenUsage.promptTokens and completionTokens match OpenRouter’s actual usage.
Actual: They do not match.
Steps to Reproduce
Steps to Reproduce
1. Send a prompt.
2. While the model is streaming, click Stop.
3. Compare tokenUsage from spendTokens with OpenRouter’s reported usage.
What browsers are you seeing the problem on?
Chrome
Relevant log output
Expected: tokenUsage.promptTokens and completionTokens match OpenRouter’s actual usage. Actual: They do not match.
Screenshots
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions