Connecting Applications

Connecting a program to Proxy Agent is simple: where the vendor’s address used to be, put your server’s address, and instead of the vendor key — your access key. Nothing inside the program needs rewriting, so almost any will do: code editors, chats, bots, internal scripts.

Three addresses

The server understands the two common “languages” for talking to models, and can show the model list at a third address.

  • POST /api/chat/completions — the OpenAI language. Nearly every program and library understands it.
  • POST /api/v1/messages — the Anthropic language. Claude and the programs tuned to it use this one.
  • GET /api/models — the list of active models in the usual shape. From it a program understands which models it can use.

The program picks the address by its own language — you do not need to decide for it. The program’s language does not have to match the model vendor’s language: protocol conversion takes care of that.

Authorization

Instead of a vendor key, programs present your access key. Two familiar ways are supported:

Authorization: Bearer proxyagent-name-24chars
x-api-key: proxyagent-name-24chars

One of them is enough. If the key is missing, unknown or deactivated, the request is refused with a clear message about the key.

What changes in the program

  • The vendor address is replaced with your server’s address.
  • The vendor key is replaced with your access key.
  • The model is named by its public name from the “Models” section — the same ones visible in GET /api/models.

Example: Claude Code

Claude Code is configured with two environment variables. The base address is your server’s address with /api at the end — exactly the hint the “Access Keys” section shows:

ANTHROPIC_BASE_URL=https://your-server/api
ANTHROPIC_AUTH_TOKEN=proxyagent-name-24chars

After that Claude Code talks to your server, and the server forwards the requests on — to the vendor written on the chosen model.

Example: an ordinary check

You can make sure everything works with one command — it stands in for any program:

curl https://your-server/api/chat/completions \
  -H "Authorization: Bearer proxyagent-name-24chars" \
  -H "Content-Type: application/json" \
  -d '{"model":"model-name","messages":[{"role":"user","content":"Hello"}]}'

An ordinary model reply comes back. If an error text arrives instead, it names the cause itself: an unknown model, a disallowed model, or an exhausted spending limit.

The error format

Errors come back in the language you called with: a program speaking the OpenAI language gets the reply in that shape, a program speaking Anthropic — in its own. This matters for programs that parse replies automatically.

One peculiarity worth knowing: a key refusal always comes in the OpenAI language — even if you called in the Anthropic language. That is a fixed trait of the product; do not rely on a single error format for every failure.

How to tell it is working

The simplest sign is a row in the request log. Send one request from the program and refresh the log: a row with the model name, the key name, the cost and the duration should appear. If there is no row, the request never reached the server — check the address and the key in the program’s settings.

Next: what happens when a program and a vendor speak different languages — in the Protocol Conversion section.

← Back to the documentation index