59API

← Volver a las guías

Claude Code, tmux, and Remote Servers: A 2026 Guide

Claude Code · EN · 2026-10-24

Running Claude Code on a remote server puts your coding assistant beside the repository, dependencies, and compute it needs. Add tmux, and an interrupted SSH connection no longer has to interrupt your terminal session. This 2026 guide explains how to set up that workflow, reconnect reliably, and use 59API for affordable, pay-as-you-go model access.

Understand what runs where

Your laptop provides the terminal and SSH connection. The remote server runs tmux, Claude Code, your project tools, and any commands you approve. Claude Code sends model requests to the configured API provider. Files stay in the remote checkout unless you explicitly copy or synchronize them.

tmux preserves terminal sessions when SSH disconnects. It does not survive a server reboot, prevent out-of-memory termination, or automatically approve Claude Code permission prompts. A task can keep running after you disconnect, but it may pause when it needs your input.

Install tmux and Claude Code

Connect using ssh dev@your-server, replacing the account and hostname. Use a regular development account with access to your repository. On Ubuntu or Debian, run sudo apt update, followed by sudo apt install -y tmux git curl.

Install Claude Code with its native installer: curl -fsSL https://claude.ai/install.sh | bash. This downloads and executes the installer, so review it first if your organization requires that. Verify installation with claude --version. If the command is unavailable, follow the installer's PATH instructions and reopen your shell.

Keep dependencies and builds on the server. A local Node.js installation, for example, does not supply Node.js to a remote shell.

Create a persistent workspace

Run tmux new -As app. This creates a session named app or attaches to it if it already exists. Inside that session, enter your existing repository with a command such as cd ~/projects/app.

Use separate sessions for unrelated projects. tmux preserves the working directory and processes in each window, reducing the chance of running a command in the wrong checkout.

Configure 59API inside the remote session

59API offers low-cost, pay-as-you-go access compatible with Claude Code. Inside the tmux window where you will launch Claude Code, run export ANTHROPIC_BASE_URL=https://api.59api.com. This sets the provider's base URL; do not append a messages endpoint.

In Bash, enter your key without displaying it or putting its value in shell history: read -r -s -p '59API key: ' ANTHROPIC_AUTH_TOKEN. Press Enter, then run export ANTHROPIC_AUTH_TOKEN. Use the authentication method documented by 59API for your account, and remove conflicting credentials if requests authenticate against the wrong provider.

Variables set on your laptop are not automatically available on the server. An existing tmux pane also does not automatically inherit exports made in another shell. Configure the environment in the actual pane that starts Claude Code.

Launch claude. For models such as Claude Sonnet 5.5 or Claude Opus 5.5, use the exact API model identifier provided by 59API when configuring model selection. A display name is not necessarily a valid API identifier.

Disconnect, recover, and verify work

Start with a bounded request: inspect a failing test, propose a change, and run the relevant checks. Review permission requests before detaching. After reconnecting over SSH, attach to app and inspect the output.

If Claude Code exits but the server remains available, run claude --continue from the same project directory to continue the most recent conversation, or claude --resume to select one. Conversation recovery does not restore terminated processes. Check Git status, review the diff, and rerun interrupted tests.

Keep access secure and spending predictable

Use SSH keys, keep tmux under your own Unix account, and avoid sharing credentials through repositories or logs. No publicly exposed tmux port is needed. Avoid blanket permission bypasses, especially on servers containing production credentials.

59API combines competitive pricing with native, official-quality models without downgrades, plus a referral rebate. Check current rates, monitor usage, and keep tasks focused to control costs. Sign up for 59API when you are ready to try this remote coding workflow with pay-as-you-go billing.

Precios · Docs

¿Listo para empezar?

Conecta Claude y GPT en minutos a los precios más bajos, sin recortes. Regístrate para obtener tu clave API.

Registro gratis