Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Yes. A single OpenCode server is designed to serve multiple clients, including a terminal, web browser and SDK application. The web and attached terminal are documented to share sessions and state. That does not guarantee conflict-free simultaneous prompts or file edits, because OpenCode’s documentation does not specify locking or race-resolution behavior.

What “multiple clients” means in OpenCode

OpenCode separates the user interface from the process that owns the server-side state. The terminal interface (TUI) acts as a client that talks to a server. A standalone opencode serve process exposes an HTTP API and an OpenAPI specification, allowing more than one client to connect to the same backend.

In practical terms, you can run a browser interface, attach a terminal, or write a program that connects to the same server URL. Each client is a separate front end, but the sessions and other resources belong to the server they reach. OpenCode’s server documentation describes this architecture as supporting multiple clients and programmatic interaction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The important boundary is between shared state and collaborative editing guarantees. The documentation confirms that clients can use the same server-side sessions. It does not promise file locking, merge handling, prompt serialization, or safe outcomes when two clients change the same project at once.

#1 Best Overall
Sale
UGREEN NAS DH2300 2-Bay for Beginners & Personal Users, Phone Backup | AI Album, Private Cloud/Remote Access, File Sharing, Multi-Device Backup, Home Entertainment, 4GB RAM on Board (Diskless)
  • Entry-level NAS Personal Storage:UGREEN NAS DH2300 is your first and best NAS made easy. It is designed for beginners who want a simple, private way to store videos, photos and personal files, which is intuitive for users moving from cloud storage or external drives and move away from scattered date across devices. This entry-level NAS 2-bay perfect for personal entertainment, photo storage, and easy data backup (doesn't support Docker or virtual machines).
  • Set Your Devices Free, Expand Your Digital World: This unified storage hub supports massive capacity up to 64TB.*Storage drives not included. Stop Deleting, Start Storing. You can store 22 million 3MB images, or 2 million 30MB songs, or 43K 1.5GB movies or 67 million 1MB documents! UGREEN NAS is a better way to free up storage across all your devices such as phones, computers, tablets and also does automatic backups across devices regardless of the operating system—Window, iOS, Android or macOS.
  • The Smarter Long-term Way to Store: Unlike cloud storage with recurring monthly fees, a UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $459.98 for a NAS, while for cloud storage, you need to pay $719.88 per year, $2,159.64 for 3 years, $3,599.40 for 5 years. You will save $6,738.82 over 10 years with UGREEN NAS! *NAS cost based on DH2300 + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
  • Blazing Speed, Minimal Power: Equipped with a high-performance processor, 1GbE port, and 4GB RAM on Board, this NAS handles multiple tasks with ease. File transfers reach up to 125MB/s—a 1GB file takes only 8 seconds. Don't let slow clouds hold you back; they often need over 100 seconds for the same task. The difference is clear.
  • Let AI Better Organize Your Memories: UGREEN NAS uses AI to tag faces, locations, texts, and objects—so you can effortlessly find any photo by searching for who or what's in it in seconds. It also automatically finds and deletes similar or duplicate photo, backs up live photos and allows you to share them with your friends or family with just one tap. Everything stays effortlessly organized, powered by intelligent tagging and recognition.

What is actually shared?

When clients connect to one server, they can work with that server’s session resources rather than creating an isolated copy in each interface. The documented API includes operations to list and create sessions, retrieve session details, fork sessions, delete sessions and send messages.

  • Sessions: Clients can access the sessions managed by the server, subject to the permissions and authentication configured for that server.
  • Session state: The web documentation explicitly says that a web interface and an attached terminal can be used simultaneously while sharing sessions and state.
  • Server operations: API clients can perform documented session operations through the running backend.
  • Project files: A shared session does not by itself establish a file-locking or merge system. Two clients can still issue actions that affect the same working tree.

There is no indication in these documents that separate OpenCode servers automatically synchronize sessions. If one client connects to server A and another connects to an unrelated server B, treat them as separate state stores unless your own deployment provides a synchronization layer.

Connection methods by client type

Client Typical connection What the documentation establishes Important qualification
Terminal attached to a server opencode attach <url> The CLI can attach a terminal to a running backend. Use the command and authentication flags supported by your installed release.
Web interface Start a web server, then connect a browser The web interface and attached terminal can run at the same time and share sessions and state. Browser access requires the server to be reachable and correctly configured for authentication and CORS.
SDK or custom program createOpencodeClient({ baseUrl: "http://localhost:4096" }) An SDK client can point to an already-running server URL; types can be generated from the OpenAPI specification. Your program must use the API behavior exposed by the server version you run.
Current v2 connection surface opencode --server <url> or a pairing flow The v2 web documentation describes server URLs, opencode pair, shared service operation and SSH forwarding. The v2 API page labels its selected HTTP API surface experimental; verify commands against your installed build.

Use a terminal and browser at the same time

The standard web documentation provides the clearest supported scenario for simultaneous clients. Start a web server, then attach a terminal to that same address.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Start the web server. The documented example is opencode web --port 4096.
  2. Open the web interface. Use the address displayed by the command, normally the local server on port 4096.
  3. Attach the terminal. Run opencode attach http://localhost:4096.
  4. Check the session list. Select or create a session in one interface, then confirm that the other interface sees the same server-side session.
  5. Keep actions coordinated. Shared visibility is documented; simultaneous prompts or edits are not described as conflict-safe.

This flow is different from starting two independent local instances. Both interfaces must point to the same running backend if you expect them to see the same sessions.

Run a standalone server and attach clients

The server documentation describes opencode serve as a standalone HTTP server. Its documented default is port 4096 on hostname 127.0.0.1. You can set an explicit hostname and port so every client uses predictable connection details.

  1. Start the backend: run opencode serve, or supply the documented --hostname and --port options when you need a specific bind address.
  2. Record the URL: for a default local setup, this is typically http://127.0.0.1:4096.
  3. Attach a terminal: use opencode attach <url> with the server URL.
  4. Connect other clients: point the web interface or SDK baseUrl at that same URL.
  5. Authenticate when required: provide the username and password options or environment variables supported by your release.

Do not assume that running opencode serve from a terminal that already has a TUI automatically attaches to that existing process. The older server guide describes serve as starting a new server.

Rank #2
Sale
UGREEN NAS DXP2800 2-Bay for Advanced Home Users, Remote Workers & Creators | Home Media & Data Center, Docker & VM, Plex, Fast File Transfer, Intel N100, 8GB DDR5, 2.5GbE, 2x M.2 NVMe, 4K HDMI(Diskless)
  • 【Advanced Home Data & Media Hub】For advanced home users who need phone backup, file storage, and centralized data management. Centralize family photos, 4K videos, movies, computer backups, and personal files in one place while running multiple apps for home entertainment and everyday data management. Suitable for households with growing digital libraries and multiple NAS use cases.
  • 【Built for Creators, Media Servers & Advanced Apps】Powered by the Intel N100 Quad-Core CPU, 8GB DDR5 RAM, 2.5GbE networking, and dual M.2 NVMe slots, DXP2800 handles large files and heavier workloads with ease. Run Docker, virtual machines, and media server applications compatible with Plex—ideal for content creators, tech enthusiasts, and advanced home users managing 4K videos, RAW photos, personal media libraries, and multiple NAS apps.
  • 【Up to 80TB for Growing Digital Libraries】 Supports up to 80TB of storage using two HDD bays and two M.2 NVMe SSD slots for family photos, movies, RAW photos, 4K videos, work files, and device backups. AI photo management supports recognition of people, objects, scenes, and locations, album organization, and duplicate photo detection. HDDs and SSDs are not included.
  • 【AI-powered Home Surveillance】Turn DXP2800 into a centralized home surveillance hub by connecting compatible network cameras and storing recordings locally on your NAS. AI-powered features include Face Recognition, People Detection, and Pet Detection, helping advanced home users review important events more efficiently while managing home surveillance and personal data in one place.
  • 【One data Center Across Your Devices】Keep files from desktops, laptops, phones, tablets, and other devices together instead of scattered across cloud accounts and external drives. Access, back up, organize, and share data across Windows, macOS, Android, iOS, web browsers, and compatible smart TVs—ideal for creators and advanced home users working across multiple devices.

Connect an SDK or automation client

The SDK guide shows a client created with a server URL:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { createOpencodeClient } from "opencode-sdk"

const client = createOpencodeClient({
  baseUrl: "http://localhost:4096"
})

The exact package import and generated types depend on the SDK setup documented for your release, but the key design is stable: the SDK connects to an existing server instead of launching a second state store. OpenCode also documents generating SDK types from the server’s OpenAPI specification. This is useful when a script needs to list sessions, create a session, read details, fork or delete one, or send a message through the API.

For production automation, keep the SDK pointed at a controlled server URL, handle authentication explicitly, and account for failures such as an unavailable server, an expired credential or a session being deleted by another client.

Version differences: standard commands versus v2 flows

OpenCode’s published documentation currently describes more than one command and access surface. The standard server, web and CLI pages use serve, web and attach. A separate v2 web page describes connecting with opencode --server <url>, a shared service flow and opencode pair.

These are not interchangeable names you should mix casually. Before copying a command, check the help output and documentation that match the binary installed on your machine. The v2 API documentation also calls its selected HTTP API surface experimental, so scripts built against it may require adjustment as the release changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Documentation surface Connection vocabulary Use it when
Standard server/web/CLI pages opencode serve, opencode web, opencode attach Your installed release exposes those commands and environment variables.
v2 web page opencode --server, opencode pair, shared service, SSH forwarding Your release documents the v2 flow and its pairing/session behavior.

Protect a server before sharing it

A server bound only to 127.0.0.1 is local to the host unless you use forwarding. Once you bind it to a network interface, treat it as a service that needs authentication and careful exposure.

Rank #3
Sale
UGREEN NAS DH4300 Plus 4-Bay for Beginners, Home Users & Remote Workers | Photo & Video Backup, AI Photo Album, File Hub, Private Cloud & Secure Home Surveillance, 8GB LPDDR4X, 4K HDMI (Diskless)
  • Entry-level NAS Home Storage: The UGREEN NAS DH4300 Plus is an entry-level 4-bay NAS that's ideal for home media and vast private storage you can access from anywhere and also supports Docker but not virtual machines. You can record, store, share happy moment with your families and friends, which is intuitive for users moving from cloud storage, or external drives to create your own private cloud, access files from any device.
  • Smart Photo Backup & AI Album: Automatically back up photos and videos from your phone in real time and keep growing family memories organized with AI-powered photo albums. Semantic search, custom learning, and recognition of people, objects, pets, and similar photos help you quickly find the moments you want. Duplicate photo removal also helps keep your library organized—ideal for families and users with large photo collections.
  • User-Friendly App & Easy Setup: Connect quickly via NFC, set up simply and share files fast on Windows, macOS, Android, iOS, web browsers, and smart TVs. You can access data remotely from any of your mixed devices. What's more, UGREEN NAS enclosure comes with beginner-friendly user manual and video instructions to ensure you can easily take full advantage of its features.
  • More Cost-effective Storage Solution: Unlike cloud storage with recurring monthly fees, A UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $629.99 for a NAS, while for cloud storage, you need to pay $719.88 per year, $1,439.76 for 2 years, $2,159.64 for 3 years, $7,198.80 for 10 years. You will save $6,568.81 over 10 years with UGREEN NAS! *NAS cost based on DH4300 Plus + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
  • Your Data, You Control:No third-party clouds, no hidden access, UGREEN NAS provides a more secure and private data storage solution. It stores data locally on your private hard drives and does automatic backups. Thus, you can keep full control over it. The advanced encryption is TRUSTe certified in the United States and is awarded the first (and only) ETSI EN 303 645 certification mark for NAS products by TÜV SÜD Group.

Standard server and web authentication

The standard documentation uses HTTP Basic authentication. Set OPENCODE_SERVER_PASSWORD before starting the server. The default username is opencode; set OPENCODE_SERVER_USERNAME if you need a different one. The CLI documentation also lists username and password flags for attaching.

Binding and CORS

The web documentation says the default bind is 127.0.0.1. To make the service reachable from other machines, configure the server to bind to an appropriate network address, commonly 0.0.0.0 when the deployment requires all interfaces, and configure allowed browser origins for CORS.

  • CORS controls which browser origins may make requests.
  • Authentication controls who may use the service.
  • A permitted CORS origin is not a substitute for a password.
  • Do not expose a network-accessible server without the authentication mechanism documented for your release.

v2 pairing and browser sessions

The v2 web documentation describes pairing links that work once and expire after five minutes. It describes browser or app sessions lasting 30 days and says changing the server password invalidates those sessions. Treat those durations as v2-specific behavior and verify them against the version you operate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remote access with SSH forwarding

If the server listens only on localhost on a remote machine, SSH local port forwarding lets your local client reach it without binding the OpenCode process to a public interface. The general pattern is to forward a local port to the remote host’s loopback port, then connect your browser, terminal or SDK to the local endpoint.

Use the exact SSH syntax and host details appropriate to your environment, and keep authentication enabled on the OpenCode server. The v2 web documentation also describes a remote-access option and a confirmation prompt associated with exposing the service to the internet. Never treat that confirmation as a reason to skip a password, firewall rule or encrypted transport.

What happens when two clients use one session?

The documented answer stops at shared sessions and state. OpenCode does not specify how it resolves two prompts submitted at nearly the same time, how it orders conflicting API requests, or whether file changes are locked, queued or merged.

Rank #4
Synology 2-Bay DiskStation DS223j (Diskless)
  • Secure private cloud - Enjoy 100% data ownership and multi-platform access from anywhere
  • Easy sharing and syncing - Safely access and share files and media from anywhere, and keep clients, colleagues and collaborators on the same page
  • Automated Backup Protection - Set-and-forget backups for Macs, PCs and mobile devices to multiple destinations including cloud and external drives
  • Home Security System - Record and monitor your property 24/7 with support for multiple IP cameras and remote viewing
  • 2-Year Warranty - Reliable hardware backed by Synology's expert customer support team and ongoing software updates

Use a conservative operating policy:

  • Assign one client as the active prompt writer for a session when making substantial changes.
  • Use another client for observation, status checks or short, independent requests.
  • Fork a session before pursuing a divergent line of work; the API documents session forking.
  • Review the working tree after every automated or remote action.
  • Commit or otherwise checkpoint important changes so an unwanted edit can be reverted.
  • Do not describe the setup as real-time collaborative editing unless a future release documents those semantics.

If you need deterministic automation, serialize requests in your own client and record the session identifier, request outcome and resulting file changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common connection problems

The second client cannot see sessions

  • Confirm both clients use the identical scheme, hostname and port.
  • Check that one client did not start a separate server process.
  • Verify that the session was created on the server you are querying.
  • Check credentials and any browser CORS setting.

The browser connects but API calls fail

Check the configured CORS origin and authentication separately. A browser origin can be allowed while unauthenticated requests are still rejected, or authentication can be correct while the origin is not permitted.

attach or --server is unknown

You may be following instructions for a different documentation surface. Run the installed binary’s help command and use the standard or v2 instructions that match that output.

A remote client times out

Confirm the server bind address, firewall rules and port forwarding. A service bound to remote 127.0.0.1 is not directly reachable from another machine; use SSH forwarding or the documented remote-access method.

A session changes unexpectedly

Look for another attached client, automation job or browser tab using the same session. Because concurrency behavior is unspecified, isolate competing actions and use a fork for independent work.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

FAQ

Can I use OpenCode in the terminal and browser at the same time?

Yes, when both connect to the same running server. The web documentation explicitly describes simultaneous web and terminal use with shared sessions and state.

Best Value
UGREEN NAS DXP4800 Pro 4-Bay for IT Professionals, Developers & Power Users | Small-Team File Server, VMs&Self-Hosted App, i3-1315U, 8GB DDR5, Built-in 128GB SSD, 10GbE+2.5GbE, 2x M.2NVMe Slots, Diskless
  • Pro-Performance NAS Engineered for Demanding Workflows: This NAS is built for offices, businesses, and power users who need serious performance. Powered by a pro-performance Intel processor, it serves as a versatile private workstation that delivers smooth performance for running virtual machines and Docker containers. It functions as an IT hub for video editors, developers, virtualization tasks, and growing teams with advanced workflows
  • Pro-Grade Core Hardware Performance: Features the Intel Core i3-1315U Processor (6 Cores, 8 Threads, up to 4.5GHz Turbo), offering a significant performance lead. It's paired with 8GB of high-speed DDR5 RAM (expandable to 96GB) and 13th Gen Intel UHD Graphics for smooth multitasking. Dual high-speed network ports (10GbE + 2.5GbE) enable blazing-fast transfers, reaching up to 1.25GB/s
  • Ultimate Flexibility with Docker, VMs & Smart AI: It offers comprehensive support for Docker and Virtual Machines, unlocking endless possibilities to run personal websites, smart home hubs, or private development environments. The local AI-powered Photo Album automatically recognizes faces, scenes, and content. All AI processing happens on-device, ensuring your privacy while managing massive photo libraries effortlessly
  • Massive Storage & Intuitive All-in-One System: It supports a colossal 144TB capacity (4x HDD + 2x M.2 SSD), enough for approximately 4.2 million 35MB RAW photos, 3.6K 40GB 4K movies, 5 million 30MB lossless music, or 150 million 1MB files. Dual M.2 PCIe 4.0 SSD slots can be used as a high-speed cache or storage pool to eliminate HDD bottlenecks. The intuitive UGOS Pro operating system integrates a media center, photo management, cloud sync, downloads, and more for a one-stop experience
  • Enterprise-Grade Data Security & Privacy: Provides multiple RAID configuration options (0, 1, 5, 10) for flexibility between capacity, speed, and protection. Features granular user permission controls (supporting up to 2048 accounts). The Data Vault offers an extra layer of security by hiding and encrypting sensitive files. Certified for strong privacy and data protection by TV SD (ETSI EN 303 645) and TRUSTe

Do independent OpenCode servers share sessions?

Not according to the documented behavior. Shared sessions apply to clients connected to one server; separate servers should be treated as separate state stores.

Can an SDK connect after the server has started?

Yes. The documented SDK constructor accepts the URL of an already-running server through its baseUrl option.

Is a network-accessible server safe without a password?

No. The web documentation warns that a server without a password is unsecured. Configure the authentication method supported by your installed release before allowing network access.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does shared state mean simultaneous edits are conflict-free?

No guarantee is documented. OpenCode’s reviewed server and web materials do not define locking, merge or race-resolution behavior, so coordinate writes and use session forks for divergent work.

Practical deployment checklist

  1. Identify the OpenCode version and use its matching documentation surface.
  2. Choose one server process as the source of truth for the clients that must share sessions.
  3. Set an explicit hostname and port when clients run on different machines or in automation.
  4. Enable the documented username and password mechanism before network exposure.
  5. Configure CORS only for the browser origins you actually need.
  6. Use SSH forwarding when a remote server can remain bound to localhost.
  7. Test session visibility from each client before sending real prompts.
  8. Coordinate writes because shared state is not documented as conflict-free.
  9. Fork sessions for experiments or parallel lines of work.
  10. Recheck command names and authentication behavior after upgrades.

The Bottom Line

One OpenCode server can serve multiple terminal, web and SDK clients, and the documented web-plus-terminal flow shares sessions and state. For safe operation, connect every client to the same backend, authenticate any network-accessible service, match commands to your release, and assume concurrent edits require coordination until OpenCode documents stronger conflict semantics.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.