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.