tarasglek / chatcraft.org

Developer-oriented ChatGPT clone
https://chatcraft.org/
MIT License
154 stars 33 forks source link

openrouter cost tracking #176

Open tarasglek opened 1 year ago

tarasglek commented 1 year ago

openrouter has an api endpoint to see how much credit is left. this might actually be more useful than toktoken for counting costs.

/api/v1/auth/key with the token

AnhChienVu commented 2 weeks ago

Hi @tarasglek, I'm interested in your issue and I want to give it a try. However, can you help me clarify where do you want to implement this feature ?

tarasglek commented 2 weeks ago

Oh this would be so cool. Chatcraft has a feature:

image

to track token usage.

It's shown like:

image

Would be cool to show cost instead of tokens when on OpenRouter by polling /api/v1/auth/key endpoint before and after chat completion.