# Connect an agent through the supplied proxy

Download `proxy.py` into a working folder. It needs Python 3 and no extra packages.
Run the commands below from that folder. Keep the proxy running while using the agent.

## Claude Code

In one terminal:

```sh
python3 proxy.py --port 8041
```

In another terminal:

```sh
ANTHROPIC_BASE_URL=http://localhost:8041 claude
```

Send a short message. The proxy terminal prints the requests and replies.

## Codex with a ChatGPT login

Use Codex's existing ChatGPT login. In one terminal:

```sh
python3 proxy.py --port 8041 --upstream https://chatgpt.com/backend-api/codex
```

In another terminal, start Codex with these settings for this run:

```sh
codex \
  -c 'model_provider="course_proxy"' \
  -c 'model_providers.course_proxy.name="Course proxy"' \
  -c 'model_providers.course_proxy.base_url="http://localhost:8041"' \
  -c 'model_providers.course_proxy.requires_openai_auth=true'
```

Send a short message and find its request in the proxy terminal. These overrides
apply to this launch and do not require editing your permanent configuration.
They use HTTP streaming, which the supplied script supports. This example is for
ChatGPT login, not an OpenAI API-key setup.

The proxy's startup hint always prints a Claude command. For Codex, use the Codex
command above. Run one of these setups at a time on this port. If you choose a
different port, change it in both the proxy command and the agent's local address.

## Stop

Exit the agent and press Ctrl-C in the proxy terminal. A later ordinary agent
launch uses its normal configuration.
