Skip to main content
Claude Code can be launched using the GitHub Copilot proxy in several ways. The easiest method is using the provided launch script, which automatically handles proxy startup and configuration.

Using the launch script

The recommended way to start Claude Code is with the launch.sh script:
./scripts/launch.sh
This script:
  • Checks for authentication credentials
  • Starts the proxy (via Docker if available, otherwise as a background process)
  • Launches Claude Code with the correct environment variables
  • Handles proxy health checks and startup timeouts

What the launch script does

1

Check authentication

The script verifies that ~/.claude-copilot-auth.json exists. If not, it prompts you to run authentication first:
node scripts/auth.mjs
2

Check for running proxy

It checks if a proxy is already running on the configured port by hitting the /health endpoint:
curl -s "http://localhost:$PORT/health"
3

Start proxy if needed

If no proxy is running, it attempts to start one using Docker first (with restart: always for persistence), falling back to a direct Node.js process if Docker is unavailable.
4

Launch Claude Code

Finally, it launches Claude Code with the required environment variables pointing to the local proxy.

Manual launch methods

You can also launch Claude Code manually using different approaches depending on your setup.

Environment variables

The following environment variables configure the launch process:
COPILOT_PROXY_PORT
integer
default:"18080"
The port on which the proxy server runs. Must match between proxy and Claude Code.
COPILOT_PROXY_PORT=18081 ./scripts/launch.sh
COPILOT_AUTH_FILE
string
default:"~/.claude-copilot-auth.json"
Path to the saved GitHub Copilot authentication token.
COPILOT_AUTH_FILE=~/custom-auth.json ./scripts/launch.sh
ANTHROPIC_BASE_URL
string
required
Must be set to the proxy URL (e.g., http://localhost:18080) for Claude Code to connect to the proxy.
ANTHROPIC_API_KEY
string
required
Must be set to copilot-proxy (or any non-empty value). The actual authentication uses the GitHub Copilot token.

Launch scenarios

# 1. Authenticate with GitHub Copilot
node scripts/auth.mjs

# 2. Launch Claude Code
./scripts/launch.sh
The auth script opens a browser for GitHub device code authentication. Your token is saved for future use.
# Just run the launch script
./scripts/launch.sh
If you’re using Docker, the proxy may already be running from a previous session. The script detects this and skips proxy startup.
# Start proxy on custom port
COPILOT_PROXY_PORT=18081 docker compose up -d

# Launch Claude Code with matching port
ANTHROPIC_BASE_URL=http://localhost:18081 \
ANTHROPIC_API_KEY=copilot-proxy \
claude
You can run multiple Claude Code instances by using different proxy ports:
# Terminal 1
COPILOT_PROXY_PORT=18080 node scripts/proxy.mjs &
ANTHROPIC_BASE_URL=http://localhost:18080 ANTHROPIC_API_KEY=copilot-proxy claude

# Terminal 2
COPILOT_PROXY_PORT=18081 node scripts/proxy.mjs &
ANTHROPIC_BASE_URL=http://localhost:18081 ANTHROPIC_API_KEY=copilot-proxy claude

Health checks

The proxy provides a /health endpoint that returns the server status:
curl http://localhost:18080/health
{
  "status": "ok",
  "provider": "github-copilot"
}
The launch script uses this endpoint to verify the proxy is running before starting Claude Code:
# Wait for proxy to be ready (from launch.sh:30-36)
for i in $(seq 1 30); do
    if curl -s "http://localhost:$PORT/health" > /dev/null 2>&1; then
        break
    fi
    sleep 0.5
done

Troubleshooting

If you see authentication errors:
 Not authenticated. Run authentication first:
  node scripts/auth.mjs
Your GitHub Copilot token may have expired. Re-run the auth script:
rm ~/.claude-copilot-auth.json
node scripts/auth.mjs
If the proxy port is already occupied:
# Find and kill the process using port 18080
lsof -ti:18080 | xargs kill -9

# Or use a different port
COPILOT_PROXY_PORT=18081 ./scripts/launch.sh
If the proxy fails to start in Docker, the launch script automatically falls back to Node.js:
 Docker proxy failed to start, falling back to node...
Check Docker status:
docker info
If Claude Code can’t connect to the proxy:
  1. Verify the proxy is running:
    curl http://localhost:18080/health
    
  2. Check environment variables are set:
    echo $ANTHROPIC_BASE_URL
    echo $ANTHROPIC_API_KEY
    
  3. Ensure the port matches:
    # Both should use the same port
    COPILOT_PROXY_PORT=18080
    ANTHROPIC_BASE_URL=http://localhost:18080
    

Next steps

Web search

Configure web search functionality

Model selection

Switch between available Claude models