Anthropic API Proxy with Docker Sandbox

Hello,

I’d like to be able to proxy Claude API calls when using docker sandbox the same way I would be able to if I weren’t using the sandbox. Specifically, I want to be able to send API calls outside of the sandbox and proxy them via a local proxy running on the host.

I’ve played around and can’t figure out a way to do this. It looks to be like the sandbox is already doing something like this and using the node HTTP(S)_PROXY end variables; proxying these by the sbx process(?) on the host. However, I can’t find where those env vars are set and can’t seem to override them either.

If this is already possible, can you give me instructions on how to achieve this please? If not, can you add support for this?

FYI my current use cases are:

a) Inspecting claude requests/responses to better understand claude and how to optimize it
b) Redirecting certain calls to different models

I do this by running a proxy on my machine and normally by using HTTP_PROXY, HTTPS_PROXY, NODE_EXTRA_CA_CERTS

Thanks
Andrew

Even if you could set the variables, i don’t think you could use your own proxy directly from the sandbox. The sandbox has its own network policies, so as far as I know, first it has to route the traffic to the proxy that handles those policies.

I’m not sure if there is a native way to set a second proxy, so I tried to figure ut where you could set a proxy for the outgoing requests of the built-in proxy. I could not do it yet, but know that the sandbox uses conainerd with the nerdbox runtime to run the virtual machine so there is a proxy for that nerdbox somewhere which I could not identify yet. If I could, I would try to configure a proxy for that.