Set Up Qwen Code Daemon with Localtonet
Install and verify Qwen Code, start its experimental HTTP and SSE daemon, then configure secure remote HTTP access with Localtonet.
In this article 15 sections
Run qwen serve on your own machine and reach it from anywhere through a protected HTTPS tunnel
Qwen Code can run as a daemon with qwen serve, which exposes a shared agent session over HTTP and Server-Sent Events so several clients can work with one agent. This guide installs Qwen Code v0.22.3, validates the agent and daemon locally, and then publishes the daemon through a Localtonet HTTP tunnel. You will configure the tunnel with the current dashboard workflow, add tunnel-level access controls in front of the daemon's own authentication, and tune timeouts, headers and logs for long-running agent streams. The goal is remote access to a coding agent without opening router ports and without weakening its security model.
📋 What's in this guide
What Qwen Code daemon mode is in v0.22.3
Qwen Code is an open-source coding agent that normally runs in a terminal. Alongside the interactive CLI, the project ships IDE integrations, SDKs, messaging channels, a Web Shell and daemon mode. The daemon entry point is qwen serve, which the Qwen Code repository describes as an experimental shared agent session over HTTP and SSE using ACP, with multiple clients connected to one agent.
In practice that means the agent process, its tools, its permissions and its sessions live in one long-running server on your machine. Clients such as the TypeScript SDK daemon client, the VS Code daemon adapter, the Web Shell or channel adapters connect to that server, send requests over HTTP and receive a typed stream of events over SSE. Because the daemon owns the session, a client can disconnect and another can resume the same work later.
This guide targets Qwen Code v0.22.3. Daemon mode is still experimental, so pinning a release gives every command and configuration value in your notes a clear version boundary. The v0.22.3 release notes include several daemon-related changes:
- A standalone daemon session API supporting create, list, resume, archive and delete operations for top-level sessions (#10179).
- Matching standalone session APIs in the SDK (#10294).
- Daemon Extension installs now accept absolute local paths and reject relative paths and unsupported options such as
ref(#10131).
The release notes state that v0.22.3 has no known breaking changes. If you already run an earlier daemon build, the upgrade should not require configuration changes, but you should still revalidate the daemon locally before reopening remote access, as described in the operations section.
Qwen Code documents the daemon's listener flags, default port, endpoint paths, protocol versioning, credential type, origin policy and client setup on dedicated pages of its documentation, listed in the daemon section below. This guide does not reproduce those specific values. Instead it shows where each value lives and which Localtonet field or check it feeds, so you record them once from the v0.22.3 pages and your own startup output and then reuse them throughout the setup.
How the Qwen Code and Localtonet layers fit together

There are four independent parts in this workflow: the Qwen Code process and its model-provider connection, the daemon protocol, the Localtonet client, and the Localtonet HTTP tunnel. Keeping them separate in your head makes setup and troubleshooting much easier, because each layer can be tested on its own.
/auth.
Why an HTTP tunnel fits
The daemon is an HTTP application with an SSE event stream, so the HTTP tunnel family is the natural match. An HTTP tunnel gives the daemon a normal HTTPS URL without a port number, terminates TLS at the Localtonet server, lets you add authentication and IP rules per tunnel, and records requests in a Request Log. WebSocket connections also pass through HTTP tunnels, which matters if a client or adapter you use relies on WebSockets in addition to SSE.
SSE is an ordinary HTTP response that stays open while the server keeps writing events. That works through an HTTP proxy path in principle, but long agent turns stress timeouts and buffering. Treat end-to-end SSE delivery as something you verify with a real client, not something you assume. The tunnel settings section explains the HTTP Timeout value that is most relevant here.
Two separate lifecycles
The daemon and the tunnel start and stop independently. Starting qwen serve does not create a tunnel, and creating a tunnel does not launch Qwen Code. Remote access works only while all of the following are true:
- The intended Qwen daemon process is running in the intended project directory.
- The daemon listens on the local IP address and port entered in the tunnel.
- The Localtonet app for the selected device token is connected.
- The tunnel has been started from the Actions column.
- The remote client uses the documented endpoint paths and protocol version under the public base URL.
- The client presents a valid daemon credential and satisfies the daemon's origin and permission rules.
Prerequisites and deployment decisions
Prepare a machine with Node.js 22 or later and npm on PATH. Qwen Code also offers standalone installers and a Homebrew package, but those channels install whatever release is current, so this guide uses the version-pinned npm package. You also need a model-provider account supported by Qwen Code, a project directory the agent is allowed to work in, a Localtonet account, and a second trusted device for the remote test.
| Requirement | Why it is needed | How to confirm it |
|---|---|---|
| Node.js 22 or later | Required by Qwen Code for npm installation. | Check your Node.js version in the shell you will use. |
| npm on PATH | The pinned installation uses the global npm package. | Run npm in the same user context that will run the daemon. |
| Dedicated project directory | The agent operates in the directory it starts from. | Review it for secrets and unrelated repositories first. |
| Model-provider access | Qwen Code needs a provider to complete any agent turn. | Complete a harmless interactive request before daemon testing. |
| Localtonet client connected with an AuthToken | The client carries tunnel traffic over an outbound connection. | The device appears connected in the dashboard. See the Localtonet quick start if not. |
| Known daemon port | The HTTP tunnel needs a local IP address and port. | Recorded from the daemon startup output and v0.22.3 configuration reference. |
| Account balance (optional) | Needed for a Custom subdomain, and for a Custom domain together with a domain in DNS Manager. | Only required if you choose those URL types. |
Choose a narrow workspace and account
Start Qwen Code from the repository it should use, never from a home directory, a drive root or a folder that contains credentials. Qwen Code documents trusted folders, ignored files, approval mode, sandboxing and permission mediation; review those pages before granting remote access, because a remote client inherits whatever the daemon is allowed to do.
Run the daemon under a dedicated, non-administrative operating-system account where practical. That account should be able to read and write the project and run the tools you need, and nothing more. Do not run it as root or Administrator to avoid a permission error; fix the permission instead.
Keep the Localtonet AuthToken private
Your Localtonet AuthToken identifies the device that carries the tunnel. It is not a Qwen Code credential and must never be given to a daemon client, pasted into scripts in the repository, or shown in screenshots and issue reports. Choose the server region in the dashboard rather than copying a region from old notes, because available regions come from the current product.
Install the version-pinned Qwen Code package
Install v0.22.3 explicitly instead of the moving latest tag:
npm install -g @qwen-code/qwen-code@0.22.3
Confirm which global package version npm installed:
npm list -g @qwen-code/qwen-code --depth=0
The output should list @qwen-code/qwen-code@0.22.3. If a different version appears, find out which installation method or global npm prefix is taking precedence before you continue.
Installing Qwen Code through npm, Homebrew and a standalone installer on the same host can leave several qwen executables in different locations. The shell may then run an older one even though npm reports v0.22.3. Use one installation method for this setup and note which one it is.
Other documented installation channels
Qwen Code documents a standalone installer for Linux and macOS:
curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash
For Windows PowerShell:
irm https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1 | iex
And Homebrew on macOS and Linux:
brew install qwen-code
These install the current release at the time you run them, which may be newer than v0.22.3. If you use one, check the installed version and read the matching daemon documentation. Restart the terminal if qwen is not found immediately after installation.
Authenticate and verify the interactive agent
Validate the ordinary terminal workflow before touching daemon mode. This separates package, provider and project problems from daemon and network problems, so a later failure points clearly at one layer.
Open the intended repository
Change to the project the agent may work in. Check it for private keys, environment files, unrelated repositories and production configuration.
Launch Qwen Code
Run qwen from that directory as a normal user.
Configure a provider
Follow the first-launch workflow or enter /auth. Qwen Code supports Alibaba ModelStudio, built-in third-party providers and a custom-provider path; the required fields depend on the provider.
Send a harmless request
Ask the agent to describe the project before approving any file change or shell command.
cd your-project
qwen
Inside the session, configure the provider and then ask a read-only question:
/auth
what does this project do?
If this request fails, stop here. A tunnel cannot fix a missing executable, an invalid provider key, an unavailable model or the wrong working directory.
Start qwen serve and record its contract
Return to the project directory and start the daemon:
cd your-project
qwen serve
Keep the terminal in the foreground for the first runs so you can read the startup output and stop the process quickly. Do not turn it into an unattended service until local and remote verification both pass.
Where each daemon value is documented
Qwen Code splits daemon documentation into a user guide page, two protocol references and a numbered developer deep dive. Open them from the Qwen Code documentation index and record the v0.22.3 values in a short deployment sheet. The table shows what each page is for and where the value is used later in this guide.
| Qwen Code docs page | Record from it | Used for |
|---|---|---|
| Daemon Mode / Local Deployment, 20 · Quickstart & Operations | How to start, run and stop the daemon locally; routine operations. | Startup, shutdown and the controlled start order. |
| 02 · Serve Runtime, 17 · Configuration Reference | Listener and bind flags, default bind address, default port, base URL, other settings. | Local IP address and Local port in the tunnel form. |
| qwen serve HTTP protocol, Daemon REST API Reference | HTTP and SSE endpoint paths, request and event formats. | Local verification request and remote client paths. |
| 11 · Capabilities & Protocol Versioning, 09 · Typed Event Schema v1 | Protocol version negotiation and event types. | Client compatibility checks and version mismatch errors. |
| 12 · Auth & Security Model | Credential type, how it is generated, how it is passed, origin and CORS rules. | Client configuration and the security checklist. |
| 04 · Permission Mediation, 08 · Session Lifecycle & Identity | How tool approvals reach clients; how sessions are created, resumed, archived and deleted. | Safe remote operation and session hygiene. |
| 13 · TypeScript SDK Daemon Client, Examples: API-only DaemonClient quickstart | SDK install command, connect example, credential and base URL options. | Local and remote end-to-end tests. |
| 10 · SSE Event Bus & Backpressure | Stream behavior, reconnection and slow-consumer handling. | Diagnosing dropped or stalled streams. |
| 18 · Error Taxonomy & Remediation, 19 · Observability & Debugging | Error categories and fixes; log locations and debug options. | Troubleshooting and log review. |
The SDK documentation is organized around the @qwen-code/sdk/daemon entry point, and there is a separate migration guide for its v2 interface. Make sure the SDK version you install matches the guidance for daemon v0.22.3 rather than an older example found elsewhere.
Bind address: keep it on loopback
A bind address decides which network interfaces accept connections. A loopback listener such as 127.0.0.1 accepts connections only from the same machine. A wildcard or LAN address accepts connections from every device that can reach that interface. For this setup the safest topology is a loopback listener with the Localtonet app running on the same host, so the only path in from outside is the tunnel you control.
If the daemon's configuration reference offers a bind flag, leave it on a loopback address unless you have a specific reason to change it. Do not broaden it just because a Localtonet client on a different machine cannot reach the daemon; move the Localtonet client to the daemon host instead.
The deployment sheet
Before opening the Localtonet dashboard, your sheet should contain the following non-secret entries: Qwen Code version and installation method, project directory, operating-system account, bind address, port, base URL, endpoint paths you will use for verification, protocol version, SDK package and version, credential type (not the credential itself), origin settings, and the documented shutdown method. Store the daemon credential in a password manager or secret store, not in the sheet.
Verify the daemon locally
Local verification proves that the daemon, its credential and its event stream work before any network path is involved. Do it on the daemon host, against the loopback base URL from your sheet.
A first HTTP request
Send one request to a read-only endpoint listed in the qwen serve HTTP protocol page or the Daemon REST API Reference, using the credential exactly as the Auth & Security Model page describes. The template below uses placeholders that you replace from your sheet; it does not represent real Qwen paths or header names.
# Replace every <PLACEHOLDER> with the value documented for v0.22.3
curl -i "http://127.0.0.1:<DAEMON_PORT><READ_ONLY_PATH>" \
-H "<DOCUMENTED_AUTH_HEADER>: <DAEMON_CREDENTIAL>"
Then repeat the same request without the credential. A correctly configured daemon should reject it. Seeing both outcomes, success with the credential and rejection without it, is the most important local result in the whole tutorial, because it proves that access control exists at the application layer before you add anything at the tunnel.
Commands containing a credential end up in shell history. Prefer reading it from an environment variable or the method your client supports, and clear history entries after testing. Avoid passing long-lived credentials in query strings, because URLs are retained in logs, browser history and screenshots.
An end-to-end client test
A single HTTP response does not prove that sessions and the SSE stream work. Use the API-only DaemonClient quickstart from the Qwen Code examples, configured with the loopback base URL and the daemon credential, and run a harmless interaction: create a session, ask the agent to describe the project, and watch the typed events arrive over the stream until the turn completes. Then list sessions and archive or delete the test session using the v0.22.3 session API.
While the turn runs, trigger something that needs approval, such as a request to create a scratch file, and confirm that the approval request reaches the client according to the Permission Mediation documentation. Decline it. You now know three things: the credential works, the stream delivers events for a full turn, and tool actions still pass through the approval model.
Note how long the longest turn took before the next event arrived. That number helps you choose the tunnel's HTTP Timeout later.
Create the Localtonet HTTP tunnel
With the daemon verified locally and its port recorded, create the tunnel. This follows the current Localtonet HTTP tunnel documentation. Before you start, the Localtonet client must be installed on the daemon host and connected with an AuthToken, and the daemon must be running on its known port.
Open the HTTP page
Open My Tunnels › HTTP and select Create HTTP Tunnel to open the form.
Choose the URL type
Random subdomain gives a generated name on the selected domain, such as https://<RANDOM_NAME>.localto.net, and needs nothing extra. Custom subdomain uses a name you type (letters, digits and hyphens) and needs account balance. Custom domain uses a domain of your own and needs balance plus a domain added in DNS Manager.
Choose the device and the region
In Device token, select the token used by the Localtonet app on the daemon host. In Server region, choose a region close to that device for lower latency.
Enter the local address
Pick the Domain (localto.net or one of your own), and the Subdomain if you chose Custom subdomain. Set Local IP address to 127.0.0.1 when the daemon runs on the same device; the form accepts IPv4, IPv6 or localhost. Set Local port to the daemon port from your sheet (1 to 65535). Select Create tunnel. It appears under Your tunnels as Tunnel # followed by its ID.
Start the tunnel
Select the start button in the Actions column. When the tunnel runs, its address in the URL column becomes a link, and requests to it reach the daemon. If the Localtonet app for that token is offline, a dialog says so: start the app, or select Start anyway and the tunnel goes live when the app connects.
Creating the tunnel is safe; starting it makes the daemon reachable from the internet. Press start only after local verification proves that the daemon rejects requests without a credential, and ideally after you have applied the access controls in the next section. Because Start anyway brings the tunnel live as soon as the app connects, do not use it while the daemon is still unverified.
Your public address
The public address is https:// followed by the host name in the URL column. It has no port number. Remote clients use it as the base URL in place of http://127.0.0.1:<DAEMON_PORT>, keeping every documented path, header and option exactly as in the local test.
An HTTP tunnel keeps its subdomain until you delete the tunnel. Stopping and starting it does not change the address, so remote client configurations stay valid across restarts. Deleting and recreating the tunnel with a Random subdomain gives you a new address, which is one way to invalidate a URL that has been shared too widely. A changed URL is not a replacement for rotating the daemon credential, though.
Add tunnel access controls in front of the daemon
A coding agent is an administrative surface. Depending on its approvals it can read files, change a repository and run shell commands. The daemon's own credential is the primary control. Localtonet adds per-tunnel controls that sit in front of it and reject unwanted traffic before it reaches your machine, which is classic defense in depth: an attacker would have to get past both layers.
http:// requests. Turn it on, since daemon traffic carries credentials and code.
Open these from the settings button in the Actions column, which shows the Tunnel settings panel. The SSO button at the top of the tunnels page manages the identity providers themselves. Details for each control are in our access control, single sign-on and web application firewall documentation linked from the HTTP tunnel page.
Choosing controls for a daemon client
Most daemon clients are programs, not people in a browser. That affects which tunnel control fits:
- SDK or IDE clients from fixed networks: IP Restriction is usually the cleanest choice, because it needs no change to the client and blocks everything else outright.
- Browser clients such as a web front end: SSO Providers add an interactive sign-in that suits people using a browser.
- Basic Authentication: uses the HTTP
Authorizationheader. If the daemon's Auth & Security Model also expects its credential inAuthorization, the two will collide. In that case prefer IP Restriction or SSO, or confirm that your client can satisfy both before relying on Basic Authentication.
Keep the daemon's own credential enabled and required even when IP Restriction, SSO or Basic Authentication is active. Tunnel-level controls protect the public entry point; the daemon credential protects the agent if a tunnel setting is changed, the URL is reused, or the listener is reached another way. An unpredictable subdomain is never a substitute for either.
Origin and CORS
If a browser-based client is served from a different origin than the daemon, the daemon's origin and CORS settings decide whether the browser is allowed to call it. Those rules are defined in Qwen's Auth & Security Model and Configuration Reference. Add your tunnel's HTTPS address (or custom domain) only to the allowed origins the daemon expects, and only if a browser client actually needs it. Do not use a wildcard origin to make an error go away.
Timeouts, TLS, headers and logs for daemon traffic
Several HTTP tunnel settings directly affect a long-lived agent stream. All of them are in the Tunnel settings panel opened from the Actions column.
TLS ends at Localtonet
Remote clients reach the tunnel over HTTPS with a certificate we provide and renew. TLS ends at the Localtonet server; the request then travels through the tunnel to your device, and the Localtonet app passes it to the daemon. That is why the daemon can stay on plain HTTP on loopback. If you configured the daemon itself to serve HTTPS, turn on Is SslStream? so the app connects to it with TLS; it accepts the local certificate as it is, so a self-signed one works. If the daemon must present its own certificate all the way to the client, use a TLS tunnel instead of an HTTP tunnel.
Changing Is SslStream? or Legacy Connect? on a running tunnel restarts it, so the Localtonet app must be connected. Is HTTP/3 Active? is on for new tunnels; turn it off only if a particular client has trouble with HTTP/3.
HTTP Timeout for SSE and slow turns
HTTP Timeout sets how long the server waits for a response from your local application, from 1 to 600 seconds. Agent turns can pause for a long time between events while the model thinks or a tool runs. If streams drop during quiet periods, raise HTTP Timeout above the longest gap you observed in the local test. The daemon's SSE Event Bus documentation may also describe keep-alive or heartbeat behavior that keeps a stream active; check it alongside this setting. After any change, repeat an end-to-end turn through the tunnel, because only a real stream confirms the combined behavior.
WebSocket connections
WebSocket connections pass through an HTTP tunnel, so adapters or front ends that use WebSockets alongside the daemon's HTTP and SSE interface do not need a separate tunnel type.
Host header and Headers
The daemon receives the host name the client used, which is the tunnel address. Some servers check the Host header, and security-conscious daemons may compare Host or Origin against an allowlist. If the daemon rejects tunneled requests that work locally, open Headers in the tunnel settings and add a request header named Host with the value the daemon expects, for example the loopback host it accepts. Only do this when the daemon's documentation shows it validates Host; for Origin, prefer configuring the daemon's allowed origins rather than rewriting the header, so the check keeps its meaning. Rewrite Path? exists too, but you normally do not need it, since remote clients should use the documented paths unchanged.
Request Log, Activity Log and Tunnel Health
Request Log lets you inspect requests that reached the tunnel, which is the quickest way to see whether a remote client is hitting the right path and what status the daemon returned. Activity Log records starts, stops and setting changes, which helps when a tunnel stopped unexpectedly or someone changed a control. Tunnel Health shows the health checks. Treat request logs as sensitive, since daemon requests can contain prompts and code, and never share them without redaction.
Expiration Date and Bandwidth Limit
Limit exposure in time and volume. Expiration Date stops the tunnel on a date you choose, useful for a remote pairing session or a trip. Bandwidth Limit caps the data the tunnel can carry, and Speed Limits cap throughput; Bandwidth Usage and Bandwidth Traffic let you reset the counter and see traffic over time. An unexpected traffic spike on an agent tunnel is a signal to stop it and investigate.
The warning page on the Free plan
Our HTTP tunnel documentation describes a warning page shown on the Free plan. A browser user can click through such a page, but an SDK, IDE adapter or SSE client that expects JSON or an event stream may instead receive an HTML page and fail with a parse or protocol error. The exact conditions and any way to bypass it are described in the warning page section of the HTTP tunnel documentation; read that section and test with your real client before deciding which plan the deployment needs.
Verify the daemon through the tunnel
Run the remote test from the second trusted device, not from the daemon host, so the request truly travels through the tunnel.
- Confirm the daemon is still running and the tunnel shows as running with a linked address in the URL column.
- Repeat the first HTTP request from the local test, replacing the loopback base URL with the tunnel's HTTPS address and keeping the path and credential header the same. Expect success.
- Repeat it without the daemon credential. Expect rejection by the daemon.
- If you enabled IP Restriction, repeat it from a network outside the allowed list. Expect rejection at the tunnel before the daemon sees it; the Request Log helps confirm where it stopped.
- Run the API-only DaemonClient quickstart with the tunnel address as its base URL. Create a session, run a harmless turn, and watch events arrive until the turn completes.
- Trigger an approval request and decline it, confirming permission mediation works remotely.
- Archive or delete the test session, and check the Request Log for the sequence of calls.
# Remote version of the local request; replace each <PLACEHOLDER>
curl -i "https://<YOUR_TUNNEL_HOST><READ_ONLY_PATH>" \
-H "<DOCUMENTED_AUTH_HEADER>: <DAEMON_CREDENTIAL>"
Loading the public address in a browser and seeing a page or an error is not a protocol test. The remote verification is complete only when the documented client finishes a full turn with streaming events through the tunnel.
Security checklist before regular use
- The daemon runs as a non-elevated account in a narrow project directory.
- The daemon listens on loopback and Localtonet runs on the same host.
- Requests without the daemon credential are rejected, locally and through the tunnel.
- At least one tunnel control (IP Restriction, SSO or Basic Authentication) is active, and Is Only Https? is on.
- Allowed origins include only the clients that need them; no wildcard origin.
- Approvals for file and shell actions reach the remote client as intended, and approval mode is not set more permissively than local use requires.
- Session creation, resumption, archiving and deletion behave as documented for v0.22.3.
- Expiration Date or a routine of stopping the tunnel limits how long it is exposed.
- Provider keys, the daemon credential and the Localtonet AuthToken appear in no URL, screenshot, repository or shared log.
- The shutdown procedure has been tested.
If any of the application-level items fails, stop the tunnel and fix the daemon configuration first. Tunnel controls reduce risk, but they are not a reason to accept a daemon that lacks its own authentication.
Routine operation, shutdown, upgrades and logs
Start in a controlled order
Start the daemon first and confirm it answers locally. Then confirm the Localtonet app is connected. Start the tunnel last. This order prevents a running tunnel from pointing at a port that is free or held by some other process.
Stop in reverse order
Stop the tunnel first so no new remote requests arrive, then shut the daemon down with the method documented in Quickstart & Operations; in a foreground terminal that is typically interrupting the process. Stopping a tunnel keeps its configuration and address. Delete it when you no longer need the configuration, which also retires the subdomain.
Upgrades
Treat every Qwen Code upgrade as a security-relevant change, because daemon mode is experimental. Stop the tunnel, record your working configuration, install the new release, and rerun the local verification. Recheck listener settings, endpoints, protocol version, credential handling, origins, approvals, sessions and SSE behavior against the new release's documentation before starting the tunnel again. v0.22.3 reports no known breaking changes, but later releases may differ. If you manage Extensions through the daemon, remember that from v0.22.3 installs require absolute local paths; scripts that pass relative paths will be rejected.
npm list -g @qwen-code/qwen-code --depth=0
Logs
Use the log locations and debug options from Qwen's Observability & Debugging page together with our Request Log and Activity Log. Correlate by time: a request that appears in the Request Log but not in the daemon log points at the tunnel-to-daemon hop, while one that appears in both with an error status points at the daemon. Redact provider keys, daemon credentials, authorization headers, session identifiers, proprietary code and the Localtonet AuthToken before sharing any log.
Troubleshooting by layer
Qwen's Error Taxonomy & Remediation page lists the daemon's error categories and their fixes. Map the error your client reports to that page first; the entries below group common symptoms by layer and show which side to check.
The qwen command or qwen serve is not found
Restart the terminal, confirm Node.js 22 or later, and check the npm listing for v0.22.3. If another installation method was used before, find which executable the shell resolves and remove the duplicate.
The interactive agent cannot complete a request
Run /auth and check the provider credential, endpoint, account state and model. The tunnel plays no part in local provider requests, so do not change Localtonet settings for this.
Authentication errors
If the daemon rejects a request that should be valid, compare the credential format and header with the Auth & Security Model page. Through the tunnel, also check whether Basic Authentication on the tunnel is consuming the same Authorization header; if so, switch to IP Restriction or SSO. If the tunnel itself rejects the request, the Request Log and your IP Restriction list will show it.
Origin or Host rejections
Requests that work on loopback but fail through the tunnel with an origin or host error mean the daemon is validating those headers. Add the required origin to the daemon's allowed origins for browser clients, or set a Host request header in the tunnel's Headers setting if the daemon checks Host.
Protocol version or capability mismatch
An SDK built for a different daemon protocol version can connect but fail on negotiation. Check Capabilities & Protocol Versioning, and install the SDK version that matches v0.22.3, following the v2 migration guide if your code predates it.
Session not found or wrong session
List sessions with the session API to see what exists. Archived or deleted sessions cannot be resumed as active ones. If a client reaches the wrong workspace or session, stop the tunnel immediately, confirm the daemon's working directory and the process on the target port, and only resume once ownership is unambiguous.
The tunnel exists but the address does not respond
Check that the tunnel was started and that the Localtonet app for the selected token is connected; if you used Start anyway, the tunnel waits for the app. Confirm the Local IP address and Local port match the daemon. A daemon bound to loopback cannot be reached by a Localtonet client on another machine.
The client receives HTML instead of JSON or events
This usually means something other than the daemon answered: the Free plan warning page, an SSO sign-in page reached by a non-browser client, or the wrong path. Inspect the response in the Request Log and see the warning page section of our HTTP tunnel documentation.
Streams drop during long turns
Raise HTTP Timeout above the longest silent gap in a turn (up to 600 seconds), review the SSE Event Bus & Backpressure page for keep-alive and reconnect behavior, and check Tunnel Health and Activity Log for restarts. If Is HTTP/3 Active? is on and a client struggles, try turning it off. Retest with a full turn after each change, changing one setting at a time.
The tunnel cannot connect at all
On networks with strict outbound firewalls, try Legacy Connect? or fixed Outbound Port settings, both documented on the HTTP tunnel page. Remember that changing Legacy Connect? restarts a running tunnel.
Frequently asked questions
What command starts Qwen Code daemon mode?
Run qwen serve from the project directory the agent should use. It provides an experimental shared agent session over HTTP and SSE using ACP, with multiple clients connected to one agent.
What changed for the daemon in Qwen Code v0.22.3?
v0.22.3 added a standalone daemon session API for creating, listing, resuming, archiving and deleting top-level sessions (#10179), matching SDK session APIs (#10294), and daemon Extension installs that accept absolute local paths while rejecting relative ones (#10131). The release notes report no known breaking changes.
Which port do I enter in the Localtonet tunnel?
Enter the port the daemon actually listens on, taken from its startup output and the v0.22.3 Serve Runtime and Configuration Reference pages, with 127.0.0.1 as the Local IP address when Localtonet runs on the same machine. The public address itself has no port number.
Does the daemon need its own HTTPS certificate?
No. TLS ends at the Localtonet server with a certificate we provide and renew, so the daemon can stay on plain HTTP locally. If the daemon does serve HTTPS, turn on Is SslStream?. Use a TLS tunnel if the daemon must present its own certificate end to end.
Can Localtonet protect the daemon on its own?
Localtonet adds per-tunnel Basic Authentication, IP Restriction, SSO Providers, a Web Application Firewall and HTTPS-only mode in front of the daemon. Use them as an extra layer, but keep Qwen's own daemon credential required, since it protects the agent independently of the tunnel.
Why does my SSE stream disconnect through the tunnel?
The most common cause is a quiet period longer than the tunnel's HTTP Timeout, which you can set from 1 to 600 seconds. Raise it, review Qwen's SSE Event Bus documentation for keep-alive behavior, and retest a full agent turn end to end.
Does the tunnel address change when I restart it?
No. An HTTP tunnel keeps its subdomain across stop and start until you delete the tunnel, so remote client configurations remain valid.
Will the Free plan warning page affect my daemon client?
It can. A non-browser SDK or SSE client may receive an HTML warning page instead of the response it expects. Check the warning page section of our HTTP tunnel documentation for the exact behavior and test with your real client.
Reach your Qwen Code daemon from anywhere
Validate qwen serve locally, then publish it through a Localtonet HTTP tunnel with HTTPS, IP Restriction or SSO in front of the daemon's own authentication, and an HTTP Timeout tuned for long agent turns.
Corrections & updates
Substantive changes approved by the Localtonet editorial team are listed transparently below.
Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.