Privacy-First Coding: Using Claude Code with Self-Hosted Models via Open WebUI

Oct 1, 2026 by Thibault Debatty | 126 views

AI Data Sovereignty

https://cylab.be/blog/528/privacy-first-coding-using-claude-code-with-self-hosted-models-via-open-webui

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.

Get your Open WebUI API key

In Open WebUI, open the Settings page at the bottom left, then Account and finally scroll down to create or reveal your API key.

openwebui-API-key.png

Install Claude Code

curl -fsSL https://claude.ai/install.sh | bash

claude-install.png

Configure Claude Code

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:

  • the ANTHROPIC_BASE_URL must exactly match the URL of your instance, and end with /api without trailing slash /
  • the model must exactly match the name of a reasoning model available on your Open WebUI instance

Test

You can now test your claude setup.

claude-openwebui.png

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.

References

This blog post is licensed under CC BY-SA 4.0 creative commons attribution share-alike

This website uses cookies. More information about the use of cookies is available in the cookies policy.
Accept