Claude Code
Claude Code is Anthropic’s official CLI for Claude. When pointed at a private-gpt server it routes all requests through your private, self-hosted API instead of api.anthropic.com.
Compatibility
Prerequisites
claudebinary installed — see Claude Code docsprivate-gptserver running (see serve)
Run
private-gpt run resolves the server URL and API key from your settings and injects them automatically before launching Claude Code:
The server is started automatically if it is not already running. Pass --no-server to skip that check when the server is managed externally.
With a specific model:
Resume a previous session:
CI / non-interactive:
Manual setup
If you prefer to manage the environment variables yourself:
macOS / Linux
Windows (PowerShell)
Add the exports to ~/.zshrc or ~/.bashrc for a persistent setup.
What gets injected
private-gpt run claude-code writes these variables into the environment before exec. Values are derived from your server settings at launch time.

