Ir al contenido

Proxy Configuration

Esta página aún no está disponible en tu idioma.

Precedence: CLI flag > environment variable > config file > default. Every key mirrors its environment variable one to one.

KeyEnvDefaultWhat it does
bindRTK_PROXY_BIND127.0.0.1:8080Listen address
ccrRTK_PROXY_CCRtruePermission only: CCR runs when a rule names it (Large tool results); false keeps it off regardless
anthropic_upstreamRTK_PROXY_ANTHROPIC_UPSTREAMhttps://api.anthropic.comWhere /v1/messages goes
openai_upstreamRTK_PROXY_OPENAI_UPSTREAMhttps://api.openai.comWhere /v1/chat/completions goes
dbRTK_PROXY_DBrtk-proxy.dbUsage store — the database rtk gain reads
relay_borrowingRTK_PROXY_RELAY_BORROWINGtrueLets a pipeline task with no key of its own borrow the credential your agent is already relaying (Tasks)
Terminal window
rtk llm-proxy config get

The upstreams cannot be set over HTTP; cache_align and normalize are boot-only. A pipeline change takes effect on restart (rtk llm-proxy stop && rtk llm-proxy start) — the daemon does not watch the file.

There is no body-logging switch: the daemon does not store prompt or completion text. The one exception is opt-in — CCR keeps the originals it compresses, see Large tool results.

DialectRouteMeasuredCompressed
Anthropic Messages/v1/messagesyesyes
OpenAI Chat Completions/v1/chat/completionsyesno

Every shipped transform is Anthropic-only. An OpenAI-dialect client is forwarded unchanged — usage, cache-hit accounting and rtk gain still work, compression does not.

RoutePurpose
POST /v1/messagesAnthropic Messages API — intercept and forward
POST /v1/chat/completionsOpenAI Chat Completions — forward and measure; not compressed
GET /healthLiveness (what rtk llm-proxy status polls)
GET /stats/{summary,by-compression}Usage reads — aggregate counts only, no request content
GET / PUT /admin/settingsRuntime settings. PUT requires the x-rtk-proxy header and does not accept the upstream URLs
POST /admin/shutdownGraceful shutdown (what stop calls). Requires the x-rtk-proxy header
/v1/messages/* (e.g. count_tokens)Relayed verbatim to the Anthropic upstream
anything else404 with a JSON routing_unknown error — never relayed

A client points its whole base URL at the proxy, so it also calls sibling endpoints. Paths under /v1/messages/ go to the one upstream that dialect is bound to. Any other path gets a JSON 404 instead of being relayed: guessing an upstream would send your API key to whichever provider was guessed. A client that needs other endpoints should talk to its provider directly.

Request bodies are accepted up to 64 MB — long conversations and big tool results routinely exceed the usual 2 MB default.

There is no PID file and no signal handling: stop, status, stats and config are HTTP clients, so they work however the daemon was launched.

Both optional, both consumed by the proxy and never forwarded upstream:

HeaderEffect
x-rtk-sessionTags the usage row with a session. Without it, rows share one default session.
x-rtk-projectTags the usage row, so savings can be attributed per codebase.