How to Run Claude Code on a VPS With Your Existing Subscription
You can run Claude Code on a remote Linux machine and use your existing eligible Claude subscription. The machine runs the CLI and holds your project files; you approve account sign-in in your own browser.
This walkthrough uses a Layerbase Workspace named agent-dev. You will install the tool, complete sign-in, start a small task, and reconnect to the terminal. Workspaces is in beta under the early adopter terms; use a development project and keep important files backed up.
What you need
- A Layerbase Workspace and access to its dashboard.
- A Claude account whose plan includes Claude Code.
- A browser for approving account sign-in.
Claude Pro and Max include Claude Code access, subject to the plan's usage limits. The workspace is a separate purchase. A remote machine does not increase your subscription allowance, and optional extra usage may incur additional charges. Check the current subscription guidance for your account.
1. Prepare the workspace
Create agent-dev in the Workspaces dashboard, choose a size, and complete checkout. Wait for the workspace to become ready before opening its terminal.
Select Claude Code for installation if it is offered during creation. Otherwise, use its installation control on the workspace's agents panel. Wait for that installation to finish; the machine becoming ready and an optional tool finishing installation are separate events.
Open the Terminal tab and check that the executable is available:
claude --versionThe command should print a version. If the shell cannot find it, check installation status and reopen the terminal after installation completes. Avoid starting a second installer while the first is still running.
2. Sign in with your Claude account
In the agents panel, find Claude Code and choose Sign in with Claude account. The workspace starts the login process and displays an authorization link.
Open that link on your own computer. Confirm the account you intend to use and approve the request. If the authorization page provides a code, return to the workspace dashboard and paste it into the sign-in field. Wait for the dashboard to report the result.
Use the dedicated sign-in field for this code. It does not belong in a project file, a shell command, or a support message. If the flow expires, start a fresh sign-in attempt rather than reusing an old code.
Once authenticated, run claude in the terminal. Follow any first-run prompts and confirm that the account shown is the one you intended to use.
3. Check for an API-key override
An existing API key can change how usage is billed. The official subscription guidance calls out ANTHROPIC_API_KEY specifically: using that key can result in API charges instead of subscription usage.
In the terminal, check whether it is set without printing its value:
if [ -n "${ANTHROPIC_API_KEY:-}" ]; then
printf '%s\n' 'An API key is set in this shell.'
else
printf '%s\n' 'No API key is set in this shell.'
fiIf you intend to use account-based subscription access, exit Claude Code and remove the variable from the current shell before launching it again:
unset ANTHROPIC_API_KEY
claudeThis only changes the current shell. If a shell startup file or project configuration sets the key again, update that configuration too. Other custom authentication or gateway settings also deserve checking if the account or billing mode looks wrong. Do not paste your environment into a ticket to diagnose it.
4. Try a small task
For a first run, use a new directory with no project credentials:
mkdir -p ~/projects/agent-demo
cd ~/projects/agent-demo
claudeGive it a bounded request:
Create a small static HTML page with a heading, a paragraph, and a button
that toggles between light and dark colors. Keep everything in index.html.
Do not install dependencies or start a server. Explain the changes when done.Review the proposed file operations and approve the ones you want. After it finishes, inspect index.html. This checks the whole path: the tool launches, your account works, and the process can write files in your workspace.
For a real project, clone your repository into ~/projects, enter its directory, and launch the same command. Use repository-scoped credentials where possible and follow that project's setup instructions. The files are on the remote machine, so a local laptop path will not automatically exist there.
5. Disconnect and return
The Layerbase browser terminal uses tmux to keep its session on the workspace. Close the terminal tab, then reopen it from the dashboard. While the machine and session remain running, you can return to the same shell instead of starting over.
A task may still be waiting for permission or another instruction. Closing the browser does not answer those prompts. Stopping or rebooting the VM also ends running processes, so persistence across a browser disconnect is not a guarantee of uninterrupted execution.
For connection behavior and file uploads, see the web terminal documentation.
Before you leave it running
Review the task's scope and credentials, save useful output, and push changes you want to keep. The machine remains billable when you close the browser, and stopping it does not cancel monthly renewal.
For the broader product overview, read Introducing Layerbase Workspaces.
Keep reading
- Introducing Layerbase Workspaces: Your Own Cloud Development MachineA private Linux machine for your repositories, tools, and coding agents. Open a browser terminal, bring your existing agent account, and pick up your work from another computer.
- GitHub Codespaces Alternatives for Persistent Development EnvironmentsCompare Layerbase Workspaces, Coder, Ona, and a DIY VPS by what persists, who operates the environment, and how you pay. Codespaces may still be the right choice.
- Fly.io is raising Machine memory prices 20% on October 1Fly emailed customers that Fly Machines memory prices rise 20% on October 1, 2026. CPU stays the same, and Sprites get cheaper. Here is what that does to a Postgres cluster, and how to move the database without moving the app.
- Managed Postgres, Redis and more in São Paulo: dedicated servers for BrazilLayerbase dedicated servers can now be placed in South America (São Paulo). Three flat-price sizes, every Layerbase Cloud engine on one single-tenant machine, and an honest account of what running in Brasil does and does not give you.