Do you need a proxy at all?
Probably not for a single app. The API on this site speaks the OpenAI protocol, so any OpenAI SDK works once you change the base URL to https://api.claudeapiproxy.com/v1 and use your key. For one script or one service, that is the whole setup.
A proxy starts to pay off when you have several of these:
- more than one app or developer, and you want a single internal URL they all use;
- a wish to keep the real key out of client machines and containers;
- central logging of requests, token counts and errors;
- one place to set retries, timeouts and local rate limits;
- the option to swap the upstream later without touching every app.
One clarification before the configs. This service is an independent provider of one open-weight model. It is not Anthropic's API, and a proxy in front of it does not make it one. The configs below forward requests to this API with the model ID uncensored.
Option A: LiteLLM as the gateway
LiteLLM is an open-source proxy that exposes an OpenAI-style API and forwards to many backends. For an OpenAI-compatible upstream like this one, you declare the model with the openai/ prefix and set the upstream base URL. Install it and write a config:
pip install 'litellm[proxy]'
cat > config.yaml <<'EOF'
model_list:
- model_name: uncensored
litellm_params:
model: openai/uncensored
api_base: https://api.claudeapiproxy.com/v1
api_key: os.environ/UPSTREAM_API_KEY
rpm: 300
max_parallel_requests: 8
EOF
export UPSTREAM_API_KEY="paste-your-key-here"
export LITELLM_MASTER_KEY="sk-choose-a-long-random-string"
litellm --config config.yaml --port 4000
The os.environ/ prefix tells LiteLLM to read the value from the environment, so the key never appears in the file. The master key is the credential your own apps use to call the gateway. Option names can change between LiteLLM releases, so check its documentation for the version you install.
Now point a client at the gateway. The base URL is your proxy, and the model name is the alias from the config:
import os
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:4000/v1", # your proxy, which forwards to https://api.claudeapiproxy.com/v1
api_key=os.environ["LITELLM_MASTER_KEY"],
)
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Reply with the word ready."}],
)
print(r.choices[0].message.content)
If you want separate keys per team with their own budgets, LiteLLM supports that through its virtual keys, which need a database behind the proxy. That is a larger setup, and its docs describe it better than a summary here.
Option B: nginx as a plain forwarder
If all you need is one internal hostname and a place to attach the key, nginx is enough. Two details trip people up: streaming and body size. Responses are sent as server-sent events, so nginx must not buffer them, and the default request body limit of 1 MB is below the 8 MB the API accepts.
server {
listen 8080;
client_max_body_size 8m;
location /v1/ {
proxy_pass https://api.claudeapiproxy.com/v1/;
proxy_http_version 1.1;
proxy_ssl_server_name on;
proxy_set_header Host api.claudeapiproxy.com;
proxy_set_header Authorization "Bearer paste-your-key-here";
proxy_set_header Connection "";
proxy_buffering off;
proxy_read_timeout 300s;
}
}
Here the proxy injects the key, so clients send none. That also means anyone who can reach port 8080 can spend your credit. Bind it to a private interface, add an allow list or basic authentication, and keep the config file readable only by the nginx user. Test it with curl:
curl -i http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "uncensored", "stream": true, "messages": [{"role": "user", "content": "Count to five."}]}'
You should see the tokens arrive in pieces, not in one block at the end. If they arrive all at once, something between you and the API is still buffering.
Plan for the shared limits
A proxy does not multiply your capacity. Every client behind it shares one upstream key, and a full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. A streamed request holds its concurrency slot until the stream ends, so a few long generations can block everyone else.
When a limit is hit, the API returns HTTP 429. The error code rate_limited means too many requests per minute, and concurrency means too many at once. On temporary overload you also get a 429 with a Retry-After: 5 header. Handle them like this:
- Retry 429s with a short, increasing delay, and honour
Retry-Afterwhen present. - Cap parallel requests at the proxy at or just under 8, so callers queue at your side and not at the API.
- Give batch jobs a lower priority or a separate time window than interactive users.
- If one team needs more headroom, an account that has topped up can hold up to 5 keys, and you can run more than one upstream key behind the gateway.
The response headers X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency state the limits for the key in use. Log them once so you know what your proxy is actually facing.
Key handling and rotation
A gateway concentrates risk: one upstream key now serves everyone. Treat it accordingly.
- Store the key in an environment variable or a secret manager, never in the repo that holds the proxy config.
- Give apps a gateway credential, not the upstream key, so you can revoke them one at a time.
- Rotate when someone leaves or a file leaks. On the API key page you can regenerate the key yourself. The old key stops working at once, so update the proxy's environment and restart it in the same minute.
- Use separate labelled keys for staging and production once your account has topped up, so a test never drains the production key's limits.
Do not log request headers in full. The Authorization header carries the key, and log pipelines are a common place for it to leak.
Check that it works end to end
After the first request succeeds, verify four things.
- Models.
GET /v1/modelsthrough the proxy returns the model list, so routing and auth work. - Streaming. A request with
stream: truereturns events progressively. - Headers.
X-Balance-USDandX-Request-Idreach the client. nginx forwards them by default. Some gateways drop or rewrite headers, so look at a raw response. - Errors. Send a request with a wrong key and confirm the client gets a readable error, not a timeout.
Costs through a proxy are the same as direct calls: $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit. The gateway adds nothing to the bill, but a retry loop that resends large prompts adds real tokens whenever a retry succeeds. The pricing page has the rates, the docs list endpoints and error codes, and the article on proxy billing mistakes covers the usual traps. The trial key is a cheap way to run all four checks before you load credit.
