Relay: the gateway on your side of the wire.
A local gateway for OpenAI and Anthropic clients that serves the exact model you name on your own provider keys. It lifts known credentials before requests leave, logs every call locally, and never calls vitna.ai.
On npmvitna-runtime 0.2.0 · Apache-2.0 · Node 22.13+ · no Vitna account
OPENAI_BASE_URL · ANTHROPIC_BASE_URLhttp://127.0.0.1:8787api.openai.com · api.anthropic.com · openrouter.aiWhere a name goes, and what leaves with it.
The commands answer in this tab. /route prints where Relay would send a model name and what the seller mirror read, /redact runs a sketch of the redaction here, and /status and /ledger print illustrative readings. A browser page cannot reach a Relay on your machine, so nothing here sends a request.
Illustrative, except /route, which prints the seller mirror's reading, and /redact, which runs in this tab. Type /route, /redact, /status or /ledger
The provider's answer, and a line on your disk.
Your client reads the provider's own response, a stream byte for byte, with each stand-in put back. What Relay keeps is a ledger row per request and a status page, both on your machine. Below, one request as Relay walks it, and the row it writes.
Illustrative. One request as Relay walks it; nothing here calls anything.
{
"at": "2026-10-09T23:08:41.204Z",
"model": "claude-opus-5-5",
"units": 1,
"lane": null,
"sku": null,
"provider": "anthropic",
"via": "direct",
"decision": null,
"policy": null,
"routed": false,
"serve": "primary",
"outcome": "served",
"status": 200,
"latencyMs": 9850,
"inputTokens": 41220,
"outputTokens": 812,
"cacheReadTokens": 38912,
"cacheWriteTokens": 1406,
"cache_hit": null,
"secretsLifted": 2,
"secretsRestored": 2,
"requestId": null,
"listPriceUsd": null,
"chargedUsd": null,
"error": null
}- routed: false
- Nothing chose the model: it went as it was named. lane, sku, decision and policy are null for the same reason.
- provider, via
- Who served it, and by which route: direct here, or openrouter for a name sent through OpenRouter.
- inputTokens, outputTokens
- What the provider reported, and null where it reported nothing. inputTokens is the whole input, prompt-cache reads and writes included.
- cacheReadTokens, cacheWriteTokens
- The parts of that input the provider read from its prompt cache and wrote to it, which it bills at their own rates.
- secretsLifted, secretsRestored
- Two credentials taken out of the request and two put back into the answer. Counts only: no secret is ever on a row.
- listPriceUsd, chargedUsd
- Null. Relay writes tokens and never a price, and estimates nothing.
Illustrative values in the runtime's own columns, shown wrapped and shortened: in ~/.vitna/relay/ledger.jsonl it is one line, with the runtime's other columns beside these. The ledger says what each field means.
The status page ships inside the runtime.
GET /status answers with what has been served, refused and lifted since start, and which keys are set, never what they are. No collector, no database, no account.
Keys, and what each carries
The last three ledger rows
Illustrative figures. There is no reader's gateway for this page to read.
Install the runtime, then run vitna-relay.
vitna-relay is a command in vitna-runtime, on npm since 0.2.0. Four steps on the machine your client runs on, then one base URL in the client.
- 01 · Installvitna-runtime 0.2.0On npm since 2026-10-07, and the package the vitna-relay command comes in. It needs Node 22.13 or later and has no dependencies.
npm install -g vitna-runtime - 02 · KeysRelay's own keysThe keys Relay answers with, set in the environment it starts from: the one place a real key goes. Set the ones you have. A client's own credential is never forwarded.
export OPENAI_API_KEY=sk-... export ANTHROPIC_API_KEY=sk-ant-... export OPENROUTER_API_KEY=sk-or-... - 03 · Runvitna-relayStarts the runtime with no policy on 127.0.0.1:8787, redaction on and a ledger in ~/.vitna/relay/. Its start lines say which key bills which account for what, and the base URL each kind of client takes.
vitna-relay - 04 · CheckGET /healthzAsks for no key and says two things: that it is up, and which version. GET /status is the full page.
curl http://127.0.0.1:8787/healthz{ "ok": true, "version": "0.2.0" }
Shell profileOn loopback any token will do, since nothing reads it. Claude Code keeps its thinking and its prompt cache, and your ANTHROPIC_API_KEY stays with Relay.
export ANTHROPIC_BASE_URL="http://127.0.0.1:8787" export ANTHROPIC_AUTH_TOKEN="relay" claude
The client's .envopenai-python, openai-node and the tools built on them. Name the model as the provider behind Relay names it.
OPENAI_BASE_URL="http://127.0.0.1:8787/v1" OPENAI_API_KEY="relay" # openai/gpt-5.6-luna through OpenRouter, # gpt-5.6-luna with only OPENAI_API_KEY set
The client's .envanthropic-python and @anthropic-ai/sdk read the same base URL Claude Code does. Set this in the client's environment, not Relay's.
ANTHROPIC_BASE_URL="http://127.0.0.1:8787" ANTHROPIC_API_KEY="relay"
The tool's settingsAny tool that takes an OpenAI-compatible base URL and a fixed model name. There is no GET /v1/models, so type the name rather than pick it from a list. A tool that calls its provider from its own servers rather than your machine cannot reach 127.0.0.1.
base URL http://127.0.0.1:8787/v1 API key relay model the provider's own name for it
Three jobs a gateway on your own machine does.
When the choice of model belongs to a decision somebody signed, with a fallback chain behind it, that is a lane, and lanes are the same package started with a policy: vitna-runtime.
- 01
A coding agent that reads your .env files.
An agent reads configuration and shell history into its context, and the next request would carry any production key in them to a provider, where it cannot be called back. Relay lifts each known credential format out first and puts the real value back into the answer, so the file the agent writes gets the real key.
ANTHROPIC_BASE_URL=http://127.0.0.1:8787 - 02
One ledger across three providers.
Every request, whether OpenAI, Anthropic or OpenRouter served it, is one line in one file on your disk: the tokens the provider reported, its prompt-cache reads and writes, latency and status, and nulls where it reported nothing.
~/.vitna/relay/ledger.jsonl - 03
A machine held to one provider.
Every request Relay serves names a model, and it is held to the allowlist by the route it takes. With only anthropic listed, Relay is an Anthropic-only gateway: a /v1/messages request goes as written and every chat completion is refused by name.
VITNA_ALLOW_PROVIDERS=anthropic
Plugs into the stack you already have.
Point any OpenAI or Anthropic client at 127.0.0.1:8787. Nothing else changes, and nothing chooses a model for you.
Anthropic /v1ANTHROPIC_BASE_URL, its requests sent as writtenAnthropic /v1A base URL, and nothing else changesOpenAI /v1A base URL, and nothing else changesOpenAI /v1Any that takes a base URL and a fixed model name, since there is no GET /v1/modelsDirectANTHROPIC_API_KEY, requests as writtenDirectOPENAI_API_KEY, names as OpenAI knows themSubstrateOPENROUTER_API_KEY, any model it listsNeverNot at start, and not per requestNothing picks for you.
No policy, no lanes, no fallback. A request goes to the model it names, by the route your keys reach, and a provider that fails answers with its own error rather than another model's reply.
Known credential formats are lifted before transit.
Provider keys, cloud tokens, JWTs, private keys and connection-string passwords are swapped for stand-ins of the same shape, in memory, before the request leaves.
The answer comes back with the real values.
Wherever the model wrote a stand-in, in text, in tool arguments or mid-stream, the real value goes back in, so the file your agent writes gets the real key.
One line per request, on your disk.
What the provider reported, and nulls where it reported nothing. Never an estimate, never a price, and never a credential.
What Relay takes out of a prompt.
Formats with a shape of their own, found before a request leaves, and nothing found by guessing. Each becomes a stand-in the provider sees instead.
sk-ant-api03-9f2a…[VITNA_REDACTED_1]reply references _1sk-ant-api03-9f2a…- Provider keys
sk-proj-, sk-svcacct-, sk-admin-, the older sk-, sk-ant-api03- and Anthropic's admin form, sk-or-v1-The prefix kept, the rest a stand-in of the same kinds of character: the same length, or longer under twelve letters and digits - AWS access key ids
AKIA..., ASIA...A stand-in of the same shape - GitHub tokens
ghp_ and its siblings, github_pat_A stand-in of the same shape - Slack, Stripe and Google keys
xoxb-, sk_live_, sk_test_, rk_, AIzaA stand-in of the same shape - Signed tokens
JWTs, three dot-separated partsA stand-in of the same shape - Private keys
A PEM PRIVATE KEY blockHeader to footer - Connection strings
scheme://user:password@hostThe password only, and nothing else of the URI - Secret-named assignments
STRIPE_KEY=... on an env line, a quoted api_key or tokenThe value only, and only at eight characters or more
Left alone on purpose: code that only mentions a secret, anything found by entropy alone, personal data, and images, documents, tool definitions and thinking. A credential in a format not listed leaves as written, so redaction narrows what a provider sees rather than promising nothing sensitive leaves. --no-redact turns it off.
The parts
Thirteen parts, all of them the runtime's.
- No policyPassthrough mode
The runtime started with no policy, serving every request as the model it names. A request for vitna/<lane> is refused by name, since there are no lanes.
- /v1/chat/completionsOpenAI dialect
Streams and tools as the OpenAI SDKs send them, to OpenAI directly or through OpenRouter, whichever your keys and your allowlist reach.
- /v1/messagesAnthropic, as written
A request naming a model goes to Anthropic with its anthropic-version and anthropic-beta headers, and its stream comes back byte for byte.
- CredentialsYour keys, not your client's
The runtime answers with the keys in its own environment. Whatever credential your client sends is never forwarded.
- VITNA_ALLOW_PROVIDERSThe allowlist
Read against the route a name takes: openai for OpenAI directly, openrouter for OpenRouter, anthropic for Anthropic. A route not listed is passed over, and with none left the request is refused by name.
- RedactionCredential detectors
Known formats only, each with a shape of its own. Nothing is found by entropy, and code that only mentions a secret is left alone.
- Format-preservingStand-ins
Each credential becomes a stand-in with its prefix and kinds of character, the same length or longer under twelve letters and digits, and the same one for the life of the process, so a prompt cache holds from turn to turn.
- RehydrationStream restoration
Stand-ins are put back in text, in tool arguments and mid-stream, one split across two chunks included. Thinking is left as it came, since its signature covers its text.
- Opt-inResponse cache
With --cache, a repeat of a deterministic request (temperature 0, one choice, not streamed) is answered from memory under X-Vitna-Cache: hit, and ledgered as a hit, never as a saving.
- JSONLThe ledger
One row per request in ~/.vitna/relay/ledger.jsonl: the tokens the provider reported, its cache reads and writes, latency and status, and nulls where nothing was reported.
- LoopbackThe front door
127.0.0.1:8787 by default. Any other VITNA_HOST needs VITNA_INBOUND_KEY, which every client then sends as a bearer token, or it refuses to start.
- TimeoutsBudgets
A completion, a first byte and a silence inside a stream each have a budget, and a request past one is ended and counted rather than left to hang.
- /statusStatus and drain
GET /status says what has been served, refused and lifted since start. On SIGTERM, responses under way are given time to finish.
Four properties, each held by a test.
Relay is the runtime with defaults, not a fork of it, so it keeps what the runtime keeps.
- Exactly the model namedNo policy, no lane, no fallback and no rule, so nothing can answer with a model you did not ask for.
- Nothing to vitna.aiNot at start, not per request, and not to check for a newer version.
- Loopback by defaultIt listens on 127.0.0.1:8787, and any other VITNA_HOST without VITNA_INBOUND_KEY refuses to start.
- Nothing estimatedA provider that reports no usage gets nulls on the row, never a plausible number.
- No fallback
- A provider that fails answers with its own error. Nothing sends the request to another model.
- No lanes
- A request for vitna/<lane> is a 404 that says this runtime serves no policy.
- No model list
- There is no GET /v1/models, so a tool has to be given a fixed model name.
- Known formats only
- A credential in a format redaction does not list leaves as written, and images, documents, tool definitions and thinking go as written.
- Stand-ins reset
- A restart draws new stand-ins, so a cached prompt prefix that held a credential misses once.
- Not from a web page
- Relay sends no CORS headers, and with no inbound key it refuses a /v1 request that carries an Origin header, so a page on a website cannot use it.
- Not from a hosted tool
- A tool that calls its provider from its own servers rather than your machine cannot reach 127.0.0.1.
- No image of its own
- The runtime's container image starts vitna-runtime with a policy. Relay is meant for your own machine.
- Refuses to start
- With VITNA_POLICY or VITNA_POLICY_B64 set, with any other VITNA_HOST and no VITNA_INBOUND_KEY, with VITNA_REDACT_LANES, or with a VITNA_REDACT_PASSTHROUGH that is neither 1 nor 0.
- Where it runs
- Node 22.13 or later, on the machine your client runs on. The package has no dependencies.
No published measurements. Nothing has timed what Relay adds to a request on any machine, so the trace's offsets above are illustrative and this page prints no latency of its own.
Relay costs nothing. Your providers bill your keys.
What a request costs is what the provider behind it charges the key Relay was started with. Vitna is not on the bill, and the ledger records tokens rather than prices.
- VitnaNothing
vitna-runtime is Apache-2.0 on npm. There is no Vitna account, no Vitna key and no usage limit Vitna sets, and Relay never calls vitna.ai, so there is nothing to meter.
- Your providersTheir prices, on your keys
OpenAI, Anthropic and OpenRouter bill each request to the key in Relay's environment, whatever your client is signed in as, and prompt-cache reads and writes at their own rates.
- OpenRouter's sellersThe seller OpenRouter picks
A name sent through OpenRouter is served and priced by whichever seller OpenRouter picks, as it would be without Relay. Relay picks none; the exhibit below is what they list.
- Your machineWhat it already costs
Relay runs beside your client as one Node process with no dependencies. There is no hosted part, no container and nothing to rent.
What each company selling these five models listed per million tokens when the seller mirror read OpenRouter on . List prices, not what anybody paid, and Relay routes on none of them.
| Model | Sellers listing a price | Lowest listed, in / out | Highest listed, in / out |
|---|---|---|---|
| DeepSeek V3 · deepseek/deepseek-chat | 3 | DeepInfra, fp4, $0.256 / $0.712 | DeepInfra, fp4, $0.32 / $0.89 |
| Llama 3.3 70B · meta-llama/llama-3.3-70b-instruct | 7 | DeepInfra, fp8, $0.10 / $0.32 | Amazon Bedrock, $0.72 / $0.72 |
| Qwen 2.5 72B · qwen/qwen-2.5-72b-instruct | 2 | DeepInfra, fp8, $0.288 / $0.32 | DeepInfra, fp8, $0.36 / $0.40 |
| Llama 3.1 8B · meta-llama/llama-3.1-8b-instruct | 4 | DeepInfra, fp8, $0.02 / $0.04 | CoreWeave, bf16, $0.22 / $0.22 |
| DeepSeek R1 · deepseek/deepseek-r1 | 0 | none listed | none listed |
Answers to the technical questions.
Install, redaction boundaries, local ledger storage and loopback security.
Can I install Relay today?
Yes. vitna-relay is a command in vitna-runtime, on npm since 0.2.0: install it with npm install -g vitna-runtime, set the provider keys you have, and run vitna-relay. Without a global install, npx -p vitna-runtime vitna-relay does the same. It needs Node 22.13 or later.
Does Relay pick a cheaper model or provider for me?
No. It serves exactly the model a request names, and nothing in it chooses: there is no policy, no lane, no fallback and no rule. A name sent through OpenRouter is served by whichever seller OpenRouter picks, as it would be without Relay. A decision about models or sellers is what a lane on vitna-runtime is for.
How do I point Claude Code at it?
Set ANTHROPIC_BASE_URL=http://127.0.0.1:8787 and give Claude Code any ANTHROPIC_AUTH_TOKEN, since on loopback nothing reads it. Requests go to Anthropic as written, billed to the ANTHROPIC_API_KEY Relay was started with, and thinking, prompt caching and every beta work as they do direct.
And an OpenAI SDK, or a tool built on one?
Set the base URL to http://127.0.0.1:8787/v1 and use the name the provider behind Relay uses: openai/gpt-5.6-luna through OpenRouter, gpt-5.6-luna directly. Nothing translates one into the other, and there is no GET /v1/models, so a tool that lists models before it sends has to be given the name. A tool that calls its provider from its own servers rather than from your machine cannot reach 127.0.0.1 at all.
What does redaction catch, and what does it miss?
Formats with a shape of their own: provider keys, cloud and service tokens, JWTs, private keys, the password in a connection string, and secret-named assignments. It skips images, documents, tool definitions and thinking, and finds nothing by entropy, so a credential in any other format leaves as written. --no-redact turns it off.
Does redaction break prompt caching, or code?
Not within a run. A credential keeps the same stand-in for as long as Relay runs, so a conversation's prefix is the same text every turn, and the stand-in has the credential's shape, so code that handles it still parses. A restart draws new stand-ins, and a cached prefix that held a credential misses once.
What stays on my disk?
One line per request in ~/.vitna/relay/ledger.jsonl: the model, the provider and route, the outcome and status, the latency, the tokens the provider reported, the provider's message when it refused, and how many credentials were lifted and put back. Not the prompt, not the answer and not a credential: the stand-ins live in Relay's memory and nowhere else. --no-ledger records nothing.
What does the response cache answer?
Nothing, unless you start Relay with --cache and a number of seconds. Then a repeat of a deterministic request, at temperature 0 with one choice and no stream, is answered from memory under X-Vitna-Cache: hit, and written to the ledger as a hit with no tokens and no cost. A request that says no-store is never kept.
What happens when a provider is down?
The request fails with that provider's own error. Relay has no fallback, because a fallback answers with a model you did not name. A lane on vitna-runtime fails over along a chain somebody signed.
Does it send anything to vitna.ai?
No. Not at start, not per request, and not to check for a newer version. Sending a ledger anywhere is vitna-runtime-push, a separate command, and it needs a policy Relay does not have.
Can someone else on my network use it?
Not unless you let them. It listens on 127.0.0.1:8787, and started on a network address it refuses to start without VITNA_INBOUND_KEY, which every client then sends as a bearer token.
How does Relay relate to vitna-runtime?
It is vitna-runtime. vitna-relay chooses a few defaults, a ledger in your home directory and redaction on, and starts the runtime with no policy. Everything that serves a request is the code that serves a lane.
Where do I get help?
Through the contact form on the start page, choosing Model infrastructure. Say which version GET /healthz reports and what Relay's start lines said. Relay sends nothing to vitna.ai, so nobody at Vitna can see your setup unless you describe it.
Exactly the model you named, on your own keys.
Relay is a command in vitna-runtime 0.2.0: npm install -g vitna-runtime, then vitna-relay. The docs say everything it does.
