Log in to Claude Code CLI

Option 1: Use Claude Pro/Max (no extra cost)

If you have a Claude Pro or Max subscription, use it here with a one-time browser login. No API key or extra billing.

  1. On your computer (Mac/PC), open a terminal and run — replace with your server hostname if different:
ssh -L 3456:localhost:3456 [email protected]

Keep this SSH session open.

  1. In that same terminal (you're now on the server), run:
export PATH=$HOME/.local/bin:$PATH && claude auth login
  1. Copy the URL it prints, open it in your local browser, and sign in. When the page redirects to localhost:3456, leave it — the tunnel sends that to the server and the CLI completes login.
  2. If you only see a “Copy authorization code” page and no redirect: paste that code in the terminal where claude auth login is running (Cmd+V or right‑click paste), then press Enter. If that terminal doesn’t accept paste or the CLI has already exited, use Option 2 below.
  3. You can close the SSH session after that. The server stays authenticated.

Callback not working? Make sure (1) the tunnel is running before you run claude auth login, (2) you don’t close the terminal until after the browser redirect, and (3) nothing else is using port 3456 on your Mac. If it still only shows the code page, try Remote auth or Option 2.

Remote auth (browser on server): Open /auth-browser — login runs in a browser on the server; you see a screenshot and click/type to complete. No tunnel needed.

Option 2: API key (works when browser auth won’t)

Create a key at console.anthropic.com. Some plans include API usage; otherwise it’s pay-as-you-go. Paste the key below and Save — no browser or tunnel needed.

← Back to chat