The provider thatforgets every diff.

Private coding models forOpenCode.

STEP 01

Create an API key

Sign up or sign in, open API keys, and create a key with OpenAI-compatible access ticked. OpenCode sends the same key with every request, and that box is what lets it through. Give it a credit limit too: an agent can make a lot of requests on its own. The key starts with ar_ and is shown once.

Create a key
API keysNew key
Search by name or prefix...
11 active
NameUsageLimit
opencode$8.42$20.00
production$2.73No limit
ci-pipeline$1.06$3.00
staging$0.55$5.00
local-dev$0.087$1.00
side-project$0$2.00
Create API key

STEP 02

Choose your models

Tick as many as you like. Each one goes into OpenCode's model list, and /models switches between them. Every model here can call tools, which is how OpenCode edits files and runs commands.

0 models

Recommended for coding

1 selected

Models
Explore hundreds more models

Where a card names a provider, its label and price are that default route; otherwise the label is the least private route a message could take. The router tries the most private route first, and a minimum privacy level in your privacy settings stops it falling back below that. Private routes keep nothing after the request; on Anonymous routes the provider sees the prompt but not who sent it.

STEP 03

Copy your config

One file declares AnonRouter as a provider with the models you picked. It holds no key, so it is safe to commit; the key goes into OpenCode itself in the next step.

opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anonrouter": {
"npm": "@ai-sdk/openai-compatible",
"name": "AnonRouter",
"options": {
"baseURL": "https://api.anonrouter.ai/v1"
},
"models": {}
}
}
}

STEP 04

Connect in OpenCode

The rest happens in your terminal. /connect stores the key in OpenCode's own credential file, outside your project, so it never ends up in a commit.

  1. Install OpenCode: curl -fsSL https://opencode.ai/install | bashOr npm i -g opencode-ai, or brew install anomalyco/tap/opencode. Skip this if you have it.
  2. Save the config as opencode.json in your projectOr in ~/.config/opencode/ to use AnonRouter in every project.
  3. Run opencode, then /connect
  4. Choose Other, enter anonrouter, and paste your keyThe id has to match the provider in the config.
  5. Run /models to switch between the models you choseThe first one in the config is already the default.

Or hand the whole thing to your agent

One prompt carries the entire setup. Give it to your agent, review what it configures, and you are done.

ClaudeopencodeCursorOpenAICodex

OR WITH AN ENVIRONMENT VARIABLE

Running headless, or in CI?

Point the config at an environment variable instead of using /connect, not alongside it: if the variable is unset, OpenCode sends an empty key that overrides the one /connect saved.

In opencode.json, under options"apiKey": "{env:ANONROUTER_API_KEY}"
In your shell, before running opencodeexport ANONROUTER_API_KEY=ar_REPLACE_WITH_YOUR_API_KEY
Compatibility mode

OpenCode sends the same key with every message, so these requests use the compatibility broker: the key is checked, a single-use ticket is minted in memory, and the request is forwarded with metadata-only logging. AnonRouter still logs none of your messages, but this flow is not unlinkable the way the ticket flow is. Read the docs

Why AnonRouter

OpenCode sends your code with every request. We keep none of it.

A coding agent ships files, diffs, and shell output with every request. AnonRouter forwards it all in memory and settles billing from usage metadata alone.

No code logs

Prompts, diffs, files, and responses pass through in memory and are never written to disk. There is no request history on our side to leak, sell, or train on.

Labeled privacy

Every route is labeled with the guarantee it actually provides, so you can keep a private repository on Private routes.

A cap per key

Prepaid credits and a credit limit on each key, so an agent stuck in a loop stops at the cap instead of draining your balance.

Troubleshooting

If a message fails

Most provider errors come with a status code. Match it below, or read the full OpenCode guide in the docs.

401

Key not accepted

The key is missing, mistyped, or revoked. Run /connect again, choose Other, enter anonrouter, and paste the whole key, starting with ar_.

403

Compatibility is off

This key does not have OpenAI-compatible access. Turn it on for the key in API keys, or create a new key with it ticked.

Not listed

AnonRouter missing from /models

The provider id in /connect and the key under provider in opencode.json both have to be anonrouter. Restart OpenCode after editing the config.

404

Wrong URL or model

baseURL has to be https://api.anonrouter.ai/v1; OpenCode adds /chat/completions itself. Model keys have to be exact ids from this page.

Empty key

Works in one shell, not another

If the config uses {env:ANONROUTER_API_KEY} and the variable is unset, OpenCode sends an empty key that overrides /connect. Set it, or remove apiKey.

402

Out of credits

Your balance is empty, or the key hit its credit limit. Top up from the dashboard, raise the key's limit, or switch to a cheaper model.

Still stuck? Ask us on DiscordTell us the status code and the model you picked. Never post your API key there.Join our Discord

OpenCode questions

There is no setup fee and no subscription is required. Requests are paid from prepaid AnonRouter credits at the listed price of the model you pick, and a credit limit on the key caps what one agent can spend.
Yes. OpenCode's file edits, shell commands, and searches travel in the standard tools field, which the router forwards unchanged, and responses stream normally. Every model on this page supports tool calling.
Usage metadata only: model, token counts, status, latency, and cost. Prompts, diffs, files, and responses pass through in memory and are never written to disk. The model's provider handles each request according to the privacy label on the model you picked.
/connect saves it in OpenCode's credential file, ~/.local/share/opencode/auth.json, outside your project. The opencode.json from this page holds no key, so it is safe to commit.
Private: Prompt and response content is not persistently retained after the request. Anonymous: Your identity is hidden, but the inference provider can see the prompt.
Yes. Search for Auto in step 2 and add it to the config, then select it with /models. The router picks a capable model for each request inside your privacy settings.
No. AnonRouter is an independent service and is not affiliated with OpenCode. OpenCode works with any OpenAI-compatible provider, and AnonRouter is one.

Your code is not our business.

Get an API key

AnonRouter is an independent service and is not affiliated with OpenCode.