> ## Documentation Index
> Fetch the complete documentation index at: https://docs-apexspriteai.reliatrack.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure networking between Claude Code and LM Studio

> Configure your network so Claude Code CLI can reach your LM Studio backend. Covers Tailscale VPN setup, port settings, and connectivity verification.

ApexSpriteAI supports two deployment modes depending on where your GPU server lives. In local-only mode, everything runs on a single machine and no special networking is required. In remote GPU mode, Claude Code on your Mac communicates with an LM Studio server running on a separate machine over Tailscale, a secure peer-to-peer VPN. This page walks you through both modes and shows you how to verify that each layer of the network is working correctly before you run your first query.

## Deployment modes

### Local-only mode

When LM Studio and Claude Code run on the same machine, all traffic stays on localhost. No VPN or firewall changes are needed.

Claude Code sends requests to:

```
http://localhost:1234/v1/messages
```

Set `ANTHROPIC_BASE_URL` to this address in your `~/.claude/config.json` and you are done. See [Environment setup](/configuration/environment) for the full config file example.

### Remote GPU over Tailscale

When your LM Studio backend runs on a separate machine — such as a dedicated GPU server — you route API traffic through Tailscale so that the server is never exposed to the public internet.

Tailscale assigns each device a stable private IP in the `100.x.x.x` range. Your Mac connects to the Spark server using that address — for example, `100.82.56.40` — as if both machines were on the same LAN.

Claude Code sends requests to:

```
http://100.82.56.40:1234/v1/messages
```

<Note>
  Replace `100.82.56.40` with your own Tailscale IP. Run `tailscale ip -4` on your GPU server to find it.
</Note>

## Tailscale setup

<Steps>
  <Step title="Install Tailscale on both machines">
    Download and install the Tailscale client on your Mac and on the GPU server. Sign in with the same Tailscale account on both devices so they join the same tailnet.
  </Step>

  <Step title="Confirm both devices appear in the admin console">
    Open [https://login.tailscale.com/admin/machines](https://login.tailscale.com/admin/machines) and verify that both your Mac and the GPU server show a green connected status.
  </Step>

  <Step title="Note your GPU server's Tailscale IP">
    On the GPU server, run:

    ```bash theme={null}
    tailscale ip -4
    ```

    The output is the IP address you use in `ANTHROPIC_BASE_URL`.
  </Step>

  <Step title="Bind LM Studio to all interfaces">
    In LM Studio on the GPU server, open **Local Server** settings and set the bind address to `0.0.0.0`. This tells LM Studio to accept connections on every network interface, including the Tailscale interface. If LM Studio binds only to `127.0.0.1`, remote requests are silently dropped even when Tailscale is working correctly.
  </Step>
</Steps>

## Verifying connectivity

Once Tailscale is running and LM Studio is bound to `0.0.0.0`, confirm the port is reachable before configuring Claude Code.

### Test port reachability with netcat

Run this from your Mac, substituting your Tailscale IP:

```bash theme={null}
nc -vz 100.82.56.40 1234
```

A successful result looks like:

```
Connection to 100.82.56.40 port 1234 [tcp/*] succeeded!
```

If the connection is refused, work through the checks below.

### Check active routes

```bash theme={null}
netstat -rn
```

Verify that traffic to the `100.x.x.x` range is routed through the Tailscale interface (`utun` on macOS).

### Inspect firewall rules

Check that no packet filter rules are blocking port 1234:

```bash theme={null}
sudo pfctl -sa
```

To show only NAT rules:

```bash theme={null}
sudo pfctl -sn
```

<Tip>
  If you recently changed firewall rules or `/etc/pf.conf`, test the new syntax before applying it:

  ```bash theme={null}
  sudo pfctl -nf /etc/pf.conf
  ```
</Tip>

## DNS troubleshooting

If you use a hostname instead of a raw IP address to reach the Spark server, stale DNS entries can cause connection failures after a network change. Flush the macOS DNS cache with:

```bash theme={null}
sudo killall -HUP mDNSResponder
```

Then retry your `nc` connectivity test.

<Warning>
  DNS flushing affects all active connections on the machine. Close any applications that are sensitive to brief network interruptions before running this command.
</Warning>

## LM Studio bind address

LM Studio defaults to binding on `127.0.0.1`, which means it only accepts connections from the same machine. For any remote access — whether over Tailscale or a local LAN — you must change this to `0.0.0.0`.

| Bind address | Accepts local traffic | Accepts remote traffic |
| ------------ | --------------------- | ---------------------- |
| `127.0.0.1`  | Yes                   | No                     |
| `0.0.0.0`    | Yes                   | Yes                    |

To change it, open LM Studio, navigate to **Local Server**, and update the **Bind Address** field before starting the server.
