Workaround for OpenClaw Claude Access via Claude Code CLI

✍️ OpenClawRadar📅 Published: April 14, 2026🔗 Source
Workaround for OpenClaw Claude Access via Claude Code CLI
Ad

Workaround for Maintaining Claude Access in OpenClaw

A Reddit user has documented a workaround for maintaining Claude subscription access in OpenClaw after Anthropic cut off direct access for third-party harnesses. The method involves routing OpenClaw requests through the Claude Code CLI, which remains covered by existing Claude subscriptions.

Key Steps from the Source

The workaround requires several configuration steps:

  • Install Claude Code CLI globally: npm install -g u/anthropic-ai/claude-code
  • Verify installation with claude --version
  • Generate a setup token by running claude setup-token on a machine with a browser (not on a headless server)
  • Use the OAuth token (starting with sk-ant-oat01-) with the CLAUDE_CODE_OAUTH_TOKEN environment variable, not ANTHROPIC_API_KEY
  • Add the token to ~/.bashrc as CLAUDE_CODE_OAUTH_TOKEN
  • Test the token with: CLAUDE_CODE_OAUTH_TOKEN="<token>" claude -p "Say: TEST_OK" --output-format text (should print TEST_OK)
  • Update all anthropic:* profiles in ~/.openclaw/agents/main/agent/auth-profiles.json with the new token using python3
  • Run these OpenClaw configuration commands:
    openclaw config set plugins.entries.acpx.enabled true
    openclaw config set plugins.entries.acpx.config.permissionMode approve-all
    openclaw config set acp.enabled true
    openclaw config set acp.backend acpx
    openclaw config set acp.defaultAgent claude
    openclaw config set 'acp.allowedAgents' '["claude"]' --json
  • Create a systemd override at ~/.config/systemd/user/openclaw-gateway.service.d/claude-oauth.conf with the CLAUDE_CODE_OAUTH_TOKEN
  • Reload and restart the service: systemctl --user daemon-reload && systemctl --user restart openclaw-gateway
  • Verify the gateway is running and authentication shows the new token
Ad

Important Notes

The source notes several critical implementation details:

  • The token is an OAuth token that must be used with the CLAUDE_CODE_OAUTH_TOKEN environment variable
  • Do not run claude setup-token on a headless server as it requires a browser
  • Do not write to ~/.claude/.credentials.json as it doesn't work—the environment variable is the only reliable method
  • Update auth-profiles.json directly with python3 instead of using the interactive openclaw models auth paste-token command, which hangs on headless servers
  • The workaround adds an extra hop through the CLI, making it slightly slower
  • Anthropic could patch this method in the future

📖 Read the full source: r/openclaw

Ad

👀 See Also