Comment by bensyverson
6 hours ago
OpenRouter is a proxy, not an automatic router. Rather than building API clients for five different AI providers, you build one client to OpenRouter, and switching models become extremely easy. This matters when new models are coming out virtually every day.
Dumb question but aren’t they all OpenAI API compliant? I thought that was pretty standard, eg I know Anthropic works with it. Also Claude Code can work with different models, they’re probably not using OpenRouter for that?
The APIs are similar but not the same, which is to say: different. Definitely not as simple as swapping out the base URL.
Claude Code has no built-in way to use non-Anthropic models. It does support overriding the API URL with an environment variable, but there are drawbacks. OpenRouter is not used within Claude Code at all.
Effectively but not quite. Anthropic does mostly support the OpenAI API but there are minor feature gaps. You have to use Anthropic's bespoke API to use everything (which may or may not be important to you).
There are some gotchas with it too. e.g. The "system" role message isn't supported in the Anthropic API. It's not the biggest deal but it's a potential footgun.
On the other hand, the openrouter SDK + API takes care of this for you: Their one gateway has ways of enabling provider-specific features. You can switch the model name and pretty much be good to go.
Claude Code does not work with other models out of the box. You need a wrapper around Claude Code that translates other model requests + respondes to what the harness expects.
Does that means if by any chance all frontier model companies agrees to use an open protocol for the API open router would go out of business?
All the model companies except kind of Anthropic (and even they half-assedly do) implement the OpenAI API. It's not an open standard but, like the S3 API, it effectively is.
And, to answer your question, no. The existence of a common API makes it trivial to change zero code and send requests to a different model.
Isn't this what LiteLLM is doing? And is Open Source? Maybe I am asking a dumb question because this is the age-old SaaS vs OSS debate, but I am struggling to find the angle here.
The Anthropic messages API is a competing standard (it's just better than the OpenAI API which even OpenAI has moved away from) and some Chinese providers use it as their standard.
It's more complicated than that. Lots of providers use an "OpenAI-ish" API, but many of them have subtle differences in things like tool calling or thinking blocks. OpenRouter normalizes the wire format.
OpenRouter does more than just proxying; they also aggregate providers for open-weight models, which has a stabilizing effect on pricing and gives you protection against a single provider's downtime.
no. i don't know if openrouter even guarantees consistent protocl across models.
the value of openrouter is it offers centralized billing. you can route your calls to any provider you want, test a whole bunch of models against each other, and you just get one bill from openrouter. switching to a new model, or a new provider of the same model, doesn't mean setting up a new billing account with a new provider.
I see, that make sense, thanks for the explanation. Because otherwise I was thinking their whole business model would be just to provide an API tool library.