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.
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.