uezo / aiproxy

🦉AIProxy is a reverse proxy for ChatGPT API that provides monitoring, logging, and filtering requests and responses.
Apache License 2.0
38 stars 1 forks source link

Use API-supported token counting for ChatGPT stream #34

Closed uezo closed 3 months ago

uezo commented 3 months ago

Implemented the stream_options={"include_usage": True} option in the requests for ChatGPT's stream to utilize the API's new feature for token counting. This change allows the application to receive token usage directly from the API, streamlining the process by reducing the need for manual token counting on our end.