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
Run one OpenCode server, then point every client at that server’s reachable URL. For the simplest local setup, start opencode web --port 4096 and, in another terminal, run opencode attach http://localhost:4096. OpenCode Web and the attached terminal share sessions and state. For the documented Windows/WSL workflow, start opencode serve --hostname 0.0.0.0 --port 4096 inside WSL and connect the Desktop app to http://localhost:4096; if Windows cannot reach localhost, use the WSL IP address with port 4096 instead.
How OpenCode clients share one backend
OpenCode separates the backend server from the interfaces that use it. Running opencode starts a server and the terminal TUI; the TUI is a client of that server. You can also start a standalone backend with opencode serve, then connect the terminal, Desktop app, Web interface or another browser frontend to the same address.
The important rule is that every client must use the same reachable hostname and port. The server owns sessions and state, so changing from a browser to the terminal does not create a separate project context when both are attached to that one backend. OpenCode’s Web documentation describes the result this way: “This allows you to use both the web interface and terminal simultaneously, sharing the same sessions and state.”
For the server command and its defaults, see the OpenCode Server documentation. The Web documentation covers browser startup and shared sessions.
#1 Best Overall
- Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
- With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
- Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
- Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
- Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
Choose the connection pattern that fits your setup
| Use case | Where the server runs | Clients | Address to use | Security considerations |
|---|---|---|---|---|
| Browser and terminal on one machine | Local machine, started by Web | Web plus terminal TUI | http://localhost:4096 in the documented example |
Web normally binds to loopback, so it is local-only; no network exposure is needed. |
| Windows Desktop connected to WSL | Inside WSL | Windows Desktop, optional Windows browser, optional WSL terminal | http://localhost:4096, or http://<wsl-ip>:4096 if localhost fails |
Binding to 0.0.0.0 listens beyond loopback. Set a server password. |
| Separate browser frontend on a local network | Any machine reachable from the browser | Custom Web client and terminal or Desktop clients | The server machine’s hostname or IP plus port | Use a password and allow only required browser origins with --cors. |
| Remote backend | Remote host | Clients that can route to that host | The remote host’s reachable URL | Binding alone is not a complete public-internet deployment. Plan transport encryption, firewalling and access control separately. |
Port 4096 is the documented default for opencode serve and the example used by the connection guides. Another process, a different command-line value or Web’s automatic port selection can result in a different port, so always use the address OpenCode prints.
Set up Web and attach the terminal on one machine
This is the shortest path when the browser and terminal run on the same computer. Web starts the backend and opens a browser; the terminal then attaches to that running server.
- Start Web. Open a terminal and run
opencode web --port 4096. Web binds to127.0.0.1by default and opens the browser. The explicit port makes the address predictable for the terminal. - Leave that process running. The terminal window that launched Web is hosting the server. Closing it stops the backend and disconnects clients.
- Attach the TUI. Open a second terminal and run
opencode attach http://localhost:4096. - Use either interface. The browser and TUI now communicate with the same server, so sessions and state are shared rather than duplicated.
If you omit --port, Web chooses an available port and prints it before opening the browser. In that case, copy the printed URL or port into the attach command instead of assuming 4096. Because the default hostname is loopback, this form is intended for clients on the same machine.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhen Web chooses a different port
Run opencode web without a port when you do not need a stable address. OpenCode selects an available port, binds locally and opens the browser. To attach the terminal, read the URL shown by the command and substitute its port, for example opencode attach http://localhost:41723. The number in this example is illustrative; use the value your process reports.
Connect the Windows Desktop app to a server in WSL
The following is the documented Windows/WSL workflow. It assumes OpenCode is installed and runnable inside your WSL distribution and that the Desktop app runs on Windows.
Rank #2
- Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
- Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
- Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
- Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
- Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
- Start the server in WSL. In a WSL shell, run
opencode serve --hostname 0.0.0.0 --port 4096. The0.0.0.0bind tells the server to listen on interfaces beyond WSL loopback so Windows can reach it. - Connect Desktop. In the Desktop app’s server connection control, enter
http://localhost:4096. The Windows/WSL guide documents this localhost route. - Use the WSL IP if necessary. If localhost forwarding does not work in your particular WSL configuration, run
hostname -Iin WSL. Take the appropriate WSL address and connect Desktop tohttp://<wsl-ip>:4096, replacing the placeholder with the actual address. - Keep the WSL process alive. The Desktop app depends on the running
opencode serveprocess. Stop that process and the Desktop connection has no backend.
The WSL guide also recommends running opencode web from WSL when you want browser access on Windows. Open the URL and port printed by OpenCode in the Windows browser. Do not enter 0.0.0.0 itself as a browser URL; it is a bind address, not the client-facing destination.
These steps describe the documented Windows/WSL path. Desktop controls can differ by release and platform, so use the connection control exposed by your installed Desktop version rather than assuming a particular menu name.
Recommended Free Tools
Protect a server that listens beyond the local machine
A loopback server is reachable only from its own machine. The WSL command above deliberately listens more broadly, and a custom hostname or LAN address can make the server reachable by other devices. OpenCode warns that the Web server is unsecured when no password is configured.
- Set a password before exposure. Define
OPENCODE_SERVER_PASSWORDin the environment of the process that starts the server. For example, in a POSIX-style shell:export OPENCODE_SERVER_PASSWORD='use-a-long-unique-password'. - Start the server from that environment. Run
opencode serveoropencode webafter exporting the variable so the process inherits it. - Supply credentials when attaching. The attach command supports username and password options; when you do not provide them explicitly, it uses the server authentication environment variables documented by OpenCode.
- Use the correct username. The default HTTP Basic Authentication username is
opencode. SetOPENCODE_SERVER_USERNAMEif you need a different username.
Authentication protects the HTTP interface, but it does not replace network controls. The official documentation does not prescribe a particular tunnel, firewall policy, hosting provider or public-internet deployment. If the server is reachable outside your machine, restrict inbound access and provide encrypted transport according to your environment instead of treating --hostname 0.0.0.0 as a complete remote-security solution.
Attach a terminal to a standalone server
Use opencode serve when you want the backend lifecycle independent of Web or the terminal that will use it. Its documented form is opencode serve [--port <number>] [--hostname <string>] [--cors <origin>]. Defaults are port 4096, hostname 127.0.0.1, no extra CORS origins and mDNS disabled.
Rank #3
- 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
- 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
- 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
- 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
- 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
Start a local standalone server with:
opencode serve --port 4096
Then attach the TUI from another terminal:
opencode attach http://localhost:4096
The attach command also documents username and password flags. Use those when the server requires credentials and you are not relying on the environment-derived defaults. A standalone server is useful when Desktop, Web and terminal clients must come and go without restarting the backend.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsUse a custom browser frontend and CORS correctly
The built-in Web interface does not require you to add a CORS origin for the ordinary local workflow. CORS matters when JavaScript served from a different browser origin calls the OpenCode server. In that case, add each required origin with a repeatable --cors option:
opencode serve --hostname 127.0.0.1 --port 4096 --cors http://localhost:3000 --cors https://frontend.example
Allow only origins you control and actually need. An origin includes its scheme, host and, when applicable, port; an origin such as http://localhost:3000 is different from http://localhost:5173. CORS changes which browser pages may make cross-origin requests; it does not make the server reachable from another machine, and it does not replace password authentication.
The server documentation describes the API specification at http://<hostname>:<port>/doc. That endpoint serves an OpenAPI 3.1 specification, which is useful when building or debugging a separate frontend. Keep the server password enabled when the frontend is not strictly local.
Discover a server on the local network with mDNS
For a local-network Web setup, opencode web --mdns advertises the service as opencode.local and automatically uses 0.0.0.0 for listening. Clients that can resolve the advertised name can use the resulting hostname instead of manually finding an IP address. You can customize the advertised name with --mdns-domain.
Rank #4
- 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
- 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
- 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
- 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
- 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
mDNS is discovery, not authentication. Because the command listens beyond loopback, set OPENCODE_SERVER_PASSWORD and consider which devices can reach the machine. If name resolution fails, use the server’s actual LAN IP and port, or return to a loopback-only setup.
Put server settings in opencode.json
OpenCode documents server settings in opencode.json, including the port, hostname, CORS origins and related options. This is useful when the same binding should be used repeatedly instead of retyping flags.
Command-line values take precedence over configuration-file values. That lets you keep a safe baseline in the file and temporarily override it for a specific run. For example, a file can hold the normal port while opencode serve --port 4097 starts an alternate instance for troubleshooting. Check the current server documentation for the exact configuration keys supported by your installed release before editing the file.
Verify that clients are reaching the intended server
Check the global health endpoint
OpenCode exposes GET /global/health. With a local server on port 4096, request http://localhost:4096/global/health from a browser or an HTTP client. A successful response confirms that the address resolves to an OpenCode server rather than merely proving that a port is open.
Inspect the API description
Open http://localhost:4096/doc to retrieve the OpenAPI 3.1 server specification. Replace the hostname and port when the server is running elsewhere. If this endpoint is unavailable, verify the port, bind address, authentication and whether the server process is still running.
Best Value
- 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
- 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
- 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
- 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
- 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Confirm the exact URL in every client
- The terminal attach command must use the same scheme, hostname and port that the server exposes.
- Desktop must point to the reachable Windows-to-WSL address, not to WSL’s bind value
0.0.0.0. - A browser opened on another device must use the server machine’s LAN hostname or IP, not its own
localhost. - If Web selected a random port, copy that printed port rather than using 4096.
Troubleshoot common connection failures
“Connection refused” on localhost
First check that the terminal hosting opencode web or opencode serve is still running. Next verify the port in the command and the port in the client URL. If Web selected an available port automatically, the correct value may not be 4096. For WSL Desktop connections, try the WSL IP from hostname -I when localhost forwarding is unavailable.
The browser works, but another device cannot connect
Web’s default 127.0.0.1 binding is local-only. Start the server with an appropriate reachable hostname, such as the documented WSL value --hostname 0.0.0.0, then connect through the machine’s actual hostname or IP and port. Configure a password before doing this, and check operating-system or network firewalls separately.
Desktop reaches the port but authentication fails
Confirm that OPENCODE_SERVER_PASSWORD was set in the same shell or service environment that launched the server. Use username opencode unless OPENCODE_SERVER_USERNAME overrides it. Re-enter credentials in Desktop or pass the documented authentication options to opencode attach.
A custom frontend reports a CORS error
Add the frontend’s exact origin with --cors, including scheme and port, and restart the server. Do not add a path, and do not assume that allowing one localhost port allows every other port. CORS settings affect browser requests; they do not repair an incorrect hostname, port or firewall route.
Clients appear to show different work
Compare the URLs character by character. If one client is attached to a second server process, a different Web-selected port or a different WSL address, it will have a separate backend state. Stop unintended instances, keep one server running and reconnect each client to that single URL.
Practical operating patterns
Keep one long-lived backend
For a daily workflow, start opencode serve once, record its hostname and port, and attach clients as needed. This prevents a terminal restart from also restarting the backend used by Desktop or Web. If you prefer Web to manage the process, use opencode web --port 4096 and attach the terminal to that exact address.
Use loopback until another device is required
Loopback binding reduces the reachable surface and avoids unnecessary CORS, firewall and authentication work for a single-machine setup. Change the bind hostname only when Desktop, another computer or a LAN browser genuinely needs access.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Separate discovery from addressing
mDNS can make a local service easier to find, but clients still need a resolvable name and the correct port. If discovery is unreliable, use the explicit hostname or IP printed or identified on the server machine and keep authentication enabled.
Quick Recap
Final connection checklist
- Start exactly one intended OpenCode server and leave its process running.
- Record the actual hostname and port; treat 4096 as a documented default or example, not a guarantee for every Web run.
- Attach the terminal with
opencode attach http://<hostname>:<port>. - Point Desktop to the same reachable URL; for WSL, try localhost first and the WSL IP second.
- Open the same URL in Web or another browser frontend.
- Set
OPENCODE_SERVER_PASSWORDbefore any non-loopback exposure. - Add
--corsonly for the specific external browser origins that need API access. - Use
/global/healthand/docto verify that the clients are talking to the expected server.
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.

