clawgate has two modes of operation:
Uses your existing ChatGPT Plus or Pro subscription. No API key needed.
# First time: log in
clawgate login
# Then run the proxy
clawgate
The login flow opens a browser-based OAuth authorization page. You enter
a code shown in your terminal, approve the connection, and clawgate
saves the token to ~/.clawgate/token.json. Tokens auto-refresh when
they expire.
Uses a standard OpenAI (or compatible) API key. No login step needed.
clawgate --mode=api --apiKey=sk-xxx
This mode works with any OpenAI-compatible endpoint, including:
To use a custom endpoint:
clawgate --mode=api --apiKey=sk-xxx --baseUrl=https://my.endpoint/v1
All flags are optional. Flags take precedence over environment variables.
| Flag | Default | Description |
|---|---|---|
--mode |
chatgpt |
Auth mode: chatgpt or api |
--apiKey |
– | OpenAI API key (required when --mode=api) |
--baseUrl |
https://api.openai.com/v1 |
OpenAI-compatible base URL (api mode only) |
--bigModel |
gpt-5.4 |
Model for sonnet/opus requests |
--smallModel |
gpt-5.4-mini |
Model for haiku requests |
--port |
8082 |
Server port |
--help |
– | Show help and exit |
Both single-dash and double-dash work: --mode=api and -mode=api are
equivalent. Both --flag=value and --flag value forms are accepted.
| Command | Description |
|---|---|
clawgate login |
Authenticate with ChatGPT (OAuth device flow) |
clawgate logout |
Remove saved credentials |
clawgate status |
Check login status and token validity |
clawgate help |
Show help text |
Environment variables work as a fallback when flags are not set. Useful for CI/CD, Docker, and other automated setups.
| Variable | Equivalent flag |
|---|---|
AUTH_MODE |
--mode |
OPENAI_API_KEY |
--apiKey |
OPENAI_BASE_URL |
--baseUrl |
BIG_MODEL |
--bigModel |
SMALL_MODEL |
--smallModel |
PORT |
--port |
DEBUG |
– (set to 1 to enable debug logging) |
You can also place these in a .env file in the working directory.
Precedence order: CLI flag > environment variable > .env file > default.
Example using environment variables:
AUTH_MODE=apikey OPENAI_API_KEY=sk-xxx clawgate
clawgate maps Anthropic model names to OpenAI model names:
| Claude Code sends | clawgate routes to |
|---|---|
Any model containing haiku |
--smallModel (default: gpt-5.4-mini) |
Any model containing sonnet or opus |
--bigModel (default: gpt-5.4) |
| Any other model | --bigModel |
The anthropic/, openai/, and gemini/ prefixes are stripped before
matching, so anthropic/claude-3-5-sonnet and claude-3-5-sonnet both
map to the big model.
Override the defaults:
clawgate --bigModel=gpt-4o --smallModel=gpt-4o-mini
Once clawgate is running, point Claude Code at it by setting the
ANTHROPIC_BASE_URL environment variable:
ANTHROPIC_BASE_URL=http://localhost:8082 claude
On Windows (Command Prompt):
set ANTHROPIC_BASE_URL=http://localhost:8082
claude
On Windows (PowerShell):
$env:ANTHROPIC_BASE_URL="http://localhost:8082"; claude
If you changed the port with --port, adjust the URL accordingly.
Set DEBUG=1 to log all incoming Anthropic requests and outgoing
OpenAI requests to the console:
DEBUG=1 clawgate
This is useful for troubleshooting request translation issues or verifying that tool calls are mapped correctly.
# ChatGPT mode, default settings
clawgate
# API key mode, default models
clawgate --mode=api --apiKey=sk-xxx
# Custom models and port
clawgate --mode=api --apiKey=sk-xxx --bigModel=gpt-4o --smallModel=gpt-4o-mini --port=9000
# Azure OpenAI
clawgate --mode=api --apiKey=xxx --baseUrl=https://myresource.openai.azure.com/openai/deployments/gpt-4o/v1
# Local vLLM
clawgate --mode=api --apiKey=dummy --baseUrl=http://localhost:8000/v1
# Docker / CI (environment variables)
AUTH_MODE=apikey OPENAI_API_KEY=sk-xxx PORT=8082 clawgate
| Path | Description |
|---|---|
~/.clawgate/bin/clawgate |
Binary (installed by install script) |
~/.clawgate/token.json |
Saved OAuth token (ChatGPT mode) |
.env |
Optional env file in the working directory |
“command not found” after install
Close and reopen your terminal. If it still doesn’t work, verify that
the directory containing the clawgate binary is in your PATH.
“Not logged in” error
Run clawgate login to authenticate.
“API key is required” error
Pass --apiKey=sk-... when using --mode=api, or set the
OPENAI_API_KEY environment variable.
macOS “unidentified developer” dialog
Run xattr -d com.apple.quarantine clawgate before first use. See
the macOS install guide for details.
Windows SmartScreen warning Click “More info” then “Run anyway”. See the Windows install guide for details.
429 / rate limit errors clawgate retries rate-limited requests automatically (up to 3 times with backoff). If you see persistent 429s, you’re hitting the upstream provider’s rate limit – wait a moment or reduce request frequency.