Coming soon! The Kael'Nyrin Scrolls: The Atlas Edict

Captain Walker

OpenRouter provider pinning in OpenWebUI

AI, AI models, cache, cost, efficiency, miss, OpenRouter, OpenWebUI

Estimated reading time at 200 wpm: 5 minutes

Having tools does not mean you’re going to do great things. You may have a great car but cannot drive it well and get the best fuel economy from it? That depends on many things: your need for speed or acceleration, dead weight stored in the booth of our car, tyre pressure and regularity of servicing.

Whether or not you agree our Fat Disclaimer applies

When it comes to AI models and platforms, I can safely say most people know ‘bugger all’. Yet they expect great things. Most of these people are unknowingly wasting money. They don’t even know how or why.

Over the last few months, moving to OpenRouter for access to over 400 AI models on PAYG basis was an extremely steep learning curve. I’m discovering new things every day.

Some people will still not know or care about cache hits and misses in the API access method via OpenRouter. They don’t need to know cuz they are stuck paying around $20 to $50 per month. Most of my AI costs are down to around $5 month while using about 10 of them in rotation depending on tasks. There is a ‘free-list’ where I can use powerful models like the NVIDIA nematron series and many others. So – most of my use is actually free of charge.

But I still watch cost-efficiency carefully I made some discoveries. This post is my notes. The learning was on:

  • Model: DeepSeek V4.1 Flash (OpenWebUI model ID deepseek/deepseek-flash-latest)
  • Route: OpenWebUI → OpenRouter API

What’s been learned could apply to any model.

The problem

  • OpenRouter sends each request to one of many providers hosting the same model.
  • Each provider keeps its own prompt cache.
  • If a turn lands on a different provider, nothing is cached there. The whole prompt is billed at full input price.
  • Cached prompts can also expire after a gap. This happened after about 34 minutes on Morph.
  • In the activity log, a cache hit shows a small database icon beside the cost.

Yes – so the model is running via various providers. That becomes important, not that providers will ‘charge differently’. It’s about cache hits and misses.

Caches are built up with one provider. It that switches to another provider, the whole thread of a discussion becomes a miss at a new provider. The same model working on that new provider will see take a bunch of data as ‘never seen before’. That means that they will bill via OpenRouter without the discounts for cache hits. So the idea is to to control staying with one provider, to get those cache hit discounts.

What OpenRouter does by default

  • It uses “sticky routing”. After a cached request, it tries to keep sending you to the same provider.
  • Sticky routing only starts after a cache hit has been detected. Early turns can go anywhere.
  • If the sticky provider is unavailable, it falls back to another provider.
  • It only applies when the provider’s cache-read price is cheaper than its normal input price.
  • Setting your own provider order replaces sticky routing.

How the provider was chosen

This is the experience.

Large turns are about 90,000 tokens in and 2,000 out. Three figures mattered:

  1. Cache read price: paid on every good turn.
  2. Throughput: how long the reply takes.
  3. Input price: what a cache miss costs.

Snapshot on 13/10/2026 (per big turn):

ProviderCached turnMissed turnSpeed
inference.net$0.0020$0.0080124 tps
DigitalOcean$0.0019$0.0162204 tps
Open Inference$0.0017$0.005214 tps
Morph$0.0022$0.005842 tps
  • Chosen: inference.net. Nearly the cheapest, fast, and misses stay cheap.
  • Providers marked “Not routable” cannot be selected.
  • Listed latency may differ from real use. Morph showed about 30 seconds of routing overhead in practice.

The custom parameter

Location in OpenWebUI:
Admin Panel → Settings → Models → pencil icon on the model → Advanced Params → + Add Custom Parameter

FieldValue
nameprovider
value{"order": ["inference-net"]}
  • Use the provider’s slug, not its display name. inference.net’s slug is inference-net.
  • Find a slug from the provider’s OpenRouter page address: openrouter.ai/provider/
  • Use straight quote marks, not curly ones.
  • Then click Save & Update.
  • Confirmed working: OpenWebUI sends the value as proper JSON.

Advantages

  • Every turn goes to the same provider, so the cache is reused.
  • Fewer cache misses, so lower cost on long conversations.
  • Predictable speed and latency.
  • Set once per model. No code needed.
  • Fallbacks stay on by default. Only if inference.net is down, will OpenRouter use another provider rather than failing.

Things to watch

  • The model ID uses latest. If DeepSeek points it to a newer model, inference.net may not host it. Requests would then go elsewhere, unpinned.
  • Check the Provider column in the OpenRouter log from time to time.
  • Prices and speeds change. Recheck the providers table now and then.
  • Cache can still expire after a long pause, even on the same provider.

How to check it is working

  1. Start a new chat with the model.
  2. Send a short message.
  3. Open the OpenRouter activity log.
  4. The newest row’s Provider column should say inference.net.
  5. On later large turns, look for the cache icon beside the cost.

Conclusion

Controlling which providers ‘take the call’ is a sound way of keeping discounts for cache hits.

Not everybody want’s cost-efficiency. They remain with choice to burn their cash how they like.