tokencost icon indicating copy to clipboard operation
tokencost copied to clipboard

Bug + solution: openrouter models are not continuously updated

Open thiswillbeyourgithub opened this issue 6 months ago • 6 comments

Hi,

It seems that the openrouter prices are not automatically updated even though could be updated automatically using their API.

I went in depth in code example to do this very simply in the following issue: https://github.com/k-zehnder/gophersignal/issues/418

thiswillbeyourgithub avatar Jun 09 '25 19:06 thiswillbeyourgithub

Is this planned?

thiswillbeyourgithub avatar Aug 13 '25 07:08 thiswillbeyourgithub

LiteLLM is a superset of the openrouter models, so it's safer to rely on those

areibman avatar Aug 13 '25 14:08 areibman

I'm not sure I understand. How can it be safer to rely on litellm for openrouter models instead of relying on openrouter itself for its own costs?

thiswillbeyourgithub avatar Aug 13 '25 14:08 thiswillbeyourgithub

@dot-agi can explain in more detail, but essentially they have an action that runs every day that fetches openrouter prices and updates their superset dictionary

areibman avatar Aug 13 '25 16:08 areibman

Thanks I didn't know. But still, that means that one of the github branch is at most 24h late. Then you have to wait litellm to release. Then you have to yourself bump the litellm version. Then the user has to bump the version.

Unless you fetch the latest data automatically when your code starts? I assumed it was hardcoded but indeed that might be stupid of me.

thiswillbeyourgithub avatar Aug 13 '25 18:08 thiswillbeyourgithub

We simply wait for litellm to update their dictionary, and it gets updated here automatically. We almost always get the data within 24 hours.

dot-agi avatar Aug 13 '25 18:08 dot-agi