Skip to content

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.

Terminal window
ons auth add-key anthropic

ons 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.

  • 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=none

    Nothing is bound, and ons inspect <minivm-id> shows AI accounts: no AI account bound (msb.ai_account=none). <minivm-id> is the id ons create printed. For a run in one command, use ons agent new --no-ai-account instead. Do not pass egress credentials for api.anthropic.com either.

  • 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-apis egress preset holds all three, and the dev-agents template, and the agents template built from it, use it. A template of your own must name the preset or list the three hosts. See Egress.

  • 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 shell crosses 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 logout in it when you are done, then kill the miniVM.
  1. Open a shell

    Terminal window
    ons shell <minivm-id>

    <minivm-id> is the id of your miniVM (ons ls lists them).

  2. Sign in

    Terminal window
    claude auth login

    No 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.

  3. Check

    Terminal window
    claude auth status

Agent runs started in this miniVM now use your subscription.

When you are done:

Terminal window
claude auth logout

Run it in the miniVM’s shell, then kill the miniVM with ons kill <minivm-id>.

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.