Oct 1, 2026 by Thibault Debatty | 126 views
Claude Code is a powerful tool for terminal-based development, but for many developers, sending sensitive codebase information directly to Anthropic’s servers is a dealbreaker. What if you could enjoy the seamless CLI experience of Claude Code while keeping your data strictly within your own infrastructure?
Because Open WebUI provides an API compatible with the Anthropic format, you can reroute Claude Code to your own self-hosted models. In this guide, I’ll show you how to configure Claude Code to use Open WebUI as your LLM provider, giving you the best of both worlds: advanced coding automation and total data sovereignty.
Prerequisites
To follow along this blog post, you will need a working instance of Open WebUI running and accessible via network.
In Open WebUI, open the Settings page at the bottom left, then Account and finally scroll down to create or reveal your API key.
curl -fsSL https://claude.ai/install.sh | bash
nano ~/.claude/settings.json
{
"theme": "auto",
"env": {
"ANTHROPIC_BASE_URL": "https://your.openwebui.instance/api",
"ANTHROPIC_AUTH_TOKEN": "sk-youropenwebuitoken"
},
"model": "gemma4:26b"
}
Important notes:
ANTHROPIC_BASE_URL must exactly match the URL of your instance, and end with /api without trailing slash /model must exactly match the name of a reasoning model available on your Open WebUI instanceYou can now test your claude setup.
Known caveat
You will probably be greeted with a welcome message stating that your model (gemma4:26b in the example) is not recognized, but it will not prevent claude to use your Open WebUI model.
This blog post is licensed under
CC BY-SA 4.0