# OpenCode on Android

> OpenCode cannot run on Android itself. In EnvHaven it runs on an always-on Linux workspace you open in Chrome, signed in once from the Launch menu: the setup, signing in from the Android, and the keys you need.

_Updated November 23, 2026 · Checked against OpenCode 1.18.32 in EnvHaven v1.9.0_

Android can run a Linux userland through Termux, but packages differ from a normal distribution, native modules often fail to build, and Android stops background work to save battery. EnvHaven runs OpenCode on an always-on Linux workspace instead, and the Android becomes the window onto it: nothing to install on the Android, and nothing stops when you lock it.

## The setup

1. Open your EnvHaven workspace in Chrome on the Android.
2. Tap **Launch**, choose OpenCode and tap **Sign in**: it runs `opencode providers login` for you in the terminal. For an API key, choose **Set key** instead and paste `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` or `GOOGLE_API_KEY`; the workspace keeps it write-only.
3. Start it with one tap: signed in, OpenCode gets a green dot in the Launch menu and an icon in the workspace's top bar. Support is built in (1.18.32), so there is nothing to install or update.
4. Give it a task. The image sets `OPENCODE_PERMISSION={"*":"allow"}`, so OpenCode never asks.
5. Lock the Android or switch apps. OpenCode keeps working on the workspace, and opening the tab again shows the same session.

## Signing in to OpenCode from an Android phone or tablet

You sign in once, from the Launch menu, on the Android itself (step 2 above). A sign-in page opens in a new Chrome tab on the same Android, and a device code can be approved there too, so no second device is needed. The sign-in is saved on the workspace rather than the Android, so every device you open the workspace from is signed in as well.

**From the terminal instead.** OpenCode's own commands work in the workspace too:

- In the app, `/connect` picks a provider; from the shell, `opencode providers login` (alias `opencode auth login`) stores its credentials.
- Provider keys are also read from the environment, such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` and `XAI_API_KEY`. With no provider at all, OpenCode 1.18 answers with its free default model.

## Keys OpenCode needs

The terminal's key bar supplies esc, ctrl, alt, tab and the arrows above the touch keyboard, and a Bluetooth keyboard works as usual.

| Key | What it does in OpenCode |
| --- | --- |
| `Esc` | Interrupts the running session |
| `Tab` | Cycles agents, such as Build and Plan |
| `Ctrl+J` | New line (also Shift+Enter) |
| `Ctrl+X` | Leader key for most shortcuts |

## Seeing what it builds

The agent keeps working when the screen turns off, because nothing runs on the phone. If OpenCode starts a web server, ask it to bind to `0.0.0.0:3000`; that is the port the preview address serves.

## Other ways in

**An SSH app, same session.** Termius, or `ssh` inside Termux can connect to the workspace over SSH and land in the same tmux session the browser shows, so you can switch between them in the middle of a task. First add your public key, or import it from GitHub, under Remote Access in the workspace's EnvHaven sidebar; [Coding agents over SSH](https://envhaven.com/guides/coding-agents-over-ssh) walks through the rest.

**From Anomaly.** Its own options, which run on its servers or on a computer of yours:

- `opencode web` serves a browser interface from the machine it runs on, and `opencode serve` with `opencode attach <url>` connects a terminal to it from elsewhere.
- An OpenCode mobile app (iPhone through TestFlight, Android on Google Play) starts and steers sessions.

**On the Android alone.** Termux on the device itself, installing the agent and its runtime by hand; it stops when Android suspends Termux in the background.

## Keep reading

- [OpenCode](https://envhaven.com/agents/opencode)
- [OpenCode in the browser](https://envhaven.com/agents/opencode/browser)
- [OpenCode on iPhone](https://envhaven.com/agents/opencode/iphone)
- [OpenCode on iPad](https://envhaven.com/agents/opencode/ipad)
- [OpenCode on a Chromebook](https://envhaven.com/agents/opencode/chromebook)
- [OpenCode on Windows](https://envhaven.com/agents/opencode/windows)
- [OpenCode on a VPS](https://envhaven.com/agents/opencode/vps)
- [OpenCode in Docker](https://envhaven.com/agents/opencode/docker)
- [OpenCode on a Raspberry Pi](https://envhaven.com/agents/opencode/raspberry-pi)
- [OpenCode 24/7](https://envhaven.com/agents/opencode/24-7)
- [Coding on Android](https://envhaven.com/guides/coding-on-android)

Source: https://envhaven.com/agents/opencode/android
