You can run OpenCode in a container restricted to local network only and communicating with local/self-hosted models.

Claude Code is linked to Anthropic's hosted models so you can't achieve this.