Use your own Claude subscription
The supported way to give a miniVM access to Claude is an API key: ons auth add-key anthropic
stores it with onshore.sh, and it is added to the miniVM’s requests on their way out. The key
itself never enters the miniVM.
ons auth add-key anthropicons reads the key at a hidden prompt, from piped stdin, or with --from-file <path>. See
Agent runs.
The managed onshore.sh service does not offer Claude.ai sign-in, and has no feature that reads, keeps or relays your Claude subscription credentials. As we read Anthropic’s terms for Claude Code, a platform may not do that for its users, but you may sign in to the unmodified Claude Code with your own subscription where a platform hosts it. That is your own use of Claude Code, under your account and your responsibility. This page explains how, and what it implies.
Before you start
Section titled “Before you start”-
No Anthropic account bound to the miniVM. When an Anthropic account is bound, onshore.sh’s egress replaces the credential of every request to
api.anthropic.com, so the bound account is used whatever you signed in with. If your organization has a default Anthropic account, create the miniVM without any AI account:Terminal window ons create --agents --template agents --metadata msb.ai_account=noneNothing is bound, and
ons inspect <minivm-id>showsAI accounts: no AI account bound (msb.ai_account=none).<minivm-id>is the idons createprinted. For a run in one command, useons agent new --no-ai-accountinstead. Do not pass egress credentials forapi.anthropic.comeither. -
The miniVM can reach Anthropic. Sign-in and model requests go straight from the miniVM to Anthropic over TLS, without onshore.sh’s credential proxy in the middle. Claude Code needs these hosts in the template’s egress allow list:
api.anthropic.com(model requests, account details)platform.claude.com(token exchange and refresh)claude.ai(sign-in)
The
llm-apisegress preset holds all three, and thedev-agentstemplate, and theagentstemplate built from it, use it. A template of your own must name the preset or list the three hosts. See Egress.
What it implies
Section titled “What it implies”- Your credential sits on the miniVM’s disk and in its memory until the miniVM is killed. Any program running in the miniVM can read it and use it against Anthropic.
- It is in the miniVM’s pause snapshots. Pausing saves the miniVM’s memory and disk. A pause is kept by onshore.sh until the miniVM is killed or its paused retention ends. No onshore.sh feature looks inside it.
- What you type and see in
ons shellcrosses onshore.sh’s edge, where TLS ends before the traffic goes to the miniVM’s host (on a Hybrid pool, TLS ends on your own runner). It is not logged or stored, but it is not end-to-end encrypted to the miniVM. That is why this page never asks you to paste a long-lived token into a shell. - Never sign in inside a miniVM that runs code you do not trust (third-party repositories, agent-generated scripts you have not read, untrusted dependencies).
- Sign in per miniVM, run
claude auth logoutin it when you are done, then kill the miniVM.
Sign in inside the miniVM
Section titled “Sign in inside the miniVM”Open a shell
Terminal window ons shell <minivm-id><minivm-id>is the id of your miniVM (ons lslists them).Sign in
Terminal window claude auth loginNo browser opens in a miniVM: copy the sign-in URL, open it on your computer, and paste the code it shows back where Claude Code asks for it. That one-time code crosses the edge; the tokens it is exchanged for go from Anthropic straight to the miniVM and never cross the edge.
Check
Terminal window claude auth status
Agent runs started in this miniVM now use your subscription.
When you are done:
claude auth logoutRun it in the miniVM’s shell, then kill the miniVM with ons kill <minivm-id>.
What we cannot do
Section titled “What we cannot do”We cannot obtain, refresh, revoke or troubleshoot your Claude sign-in. If it expires, sign in again inside the miniVM.
On the managed service, ons auth add claude (and ons auth add chatgpt) answers 403 SUBSCRIPTIONS_DISABLED, and ons auth add claude points to this page.
Anthropic may change its terms at any time. API keys are the supported path.