Bring your own keys: how a BYOK coding agent actually routes models
Every tool says bring your own key. Almost none of them tell you which harness runs the key, and that decides what the agent can do with your subscription.
"Bring your own key" usually means one thing: a base URL and a bearer token pointing at a chat completions endpoint. That is the least interesting version of the feature. The interesting question is which harness the model runs inside, because the harness decides the tools, the context handling and what you are billed for.
Four routing paths, not one
| Path | What runs | Billing |
|---|---|---|
| Subscription harness | Claude through the Claude Agent SDK, the same loop Claude Code uses | Your Claude subscription |
| Vendor app server | Codex through its app server | Your OpenAI plan or API key |
| Raw API | Anthropic Messages or any OpenAI compatible endpoint, driven by the app's own loop | Per token, to whoever owns the key |
| Local runtime | Ollama or LM Studio on your machine | Electricity |
A tool that only supports the third row will work with almost any key, and will feel different from the first row on the same model, because the tools and the prompting are not the same.
Why the harness matters more than the model name
The model is one input. The rest is the loop around it: which tools are offered, how file edits are applied, how context is compacted, and how approvals are gated. Two products running the same model can behave like different models because their loops differ.
That is why "we support Claude" is not a useful claim. The useful claim is "we run Claude inside Claude Code's harness with your subscription, and we run everything else on our own loop".
Where the key lives
A key is a secret, and secrets leak through logs, crash reports, database rows and the renderer. The minimum bar:
- Store it in the operating system credential store, not in SQLite and not in a config file in the repository.
- Never send it to the renderer process, even in a settings response.
- Redact it from logs before writing, including adapter stderr.
- Keep it out of event payloads, because events are persisted and replayed.
Tuffcode keeps provider keys in the Windows credential store and redacts them before anything is written to disk.
Cost control that a key alone does not give you
The moment you have several roles, the model per role matters more than the model overall.
- Explorer and reviewer read code and answer questions. A fast, cheap model is enough.
- Planner decomposes the goal. This is where a stronger model pays off.
- Worker writes code. Use the model that is best at your stack, not the one with the best benchmark headline.
- Notetaker extracts facts. Cheap and frequent.
Tuffcode lets you set a model per subagent type, so an explorer does not burn the same model as a worker. Council uses the configured planner, worker and reviewer models and shows the provider's error text when one of them fails.
Current models worth knowing
Model names move fast. As of November 2026 the flagships are Claude Opus 5.5 for long running agentic coding, Claude Fable 5.2 for the hardest reasoning, and GPT-6.2 Astra for complex projects. All three advertise a context window around one million tokens, which changes how much you need compaction but does not remove the need for it.
Do not pick from a preset list that ships with a tool. The presets in most apps are a snapshot from the day the app was built. Point the app at a live catalog or type the id yourself.
A checklist for evaluating BYOK
- Can it use a Claude subscription without an API key?
- Can it drive more than one vendor harness, or does everything go through one loop?
- Where is the key stored, and can you prove it never reaches the UI?
- Can you set a different model per role?
- Can it run fully offline with a local model?
- What happens to your key when you uninstall?
Related: install Tuffcode on Windows and the FAQ.