Hacker News new | ask | show | jobs
by AyishikD 15 hours ago
Hi, congratulations on your growth. As far as my knowledge umm providers cache kinda differently like claude defaults at 5 mins and openai longer and cache occurs on hitting same prefix. If by chance it falls back or switches mid session whole cache lost and next req is costly. So umm gomodel keeps a session pinned to one provider or show cache hit rate per route?
1 comments

That's correct - cache lifetime differs per provider.

Today GoModel has session affinity for load balancing (6 hour TTL by default) and api keys rotation.

As for fallback:

1) Yes, you lose the prompt caching in this case - but usually it's better to keep your app/agent working than to save money here.

2) Actually your comment inspired me to add this... As of today the session is not sticky to the fallback target - but I think it's reasonable to do it by default (with an option to opt-out)

I'd like to mention that we also have a more advanced provider cache awareness for the early Pro/commercial features which can save you money - prompt compression / intelligent routing.

Umm yeah sticky fallback by default sounds right. But when a fallback happens can you show the cost of a lost cache. So people can see their loss. And a small question, does it send a request to the provider where the conversation prefix is already cached?
Yes, it sends the request to the provider where it was cached.

The load-balancing strategy (failover included) doesn't know whether the cache is still warm or not.

The idea of showing cost of a lost cache is sound. I need to think about how to show it. The data is already there.