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

> ## Agent Instructions
> Tokios exposes private local models through https://api.tokios.com using an outbound-only connector tunnel.
> Use 'connector' for the local tokios-connector process.
> Use 'deployment' for the public model name in the API model field.
> Use 'upstream model id' for the model served by Ollama, llama.cpp, vLLM, LM Studio, or another local backend.
> API keys use the prefix sk-tok-. Connector tokens use the prefix ct-tok-.

# Use an LM Studio server from anywhere — safely

> Reach your LM Studio OpenAI-compatible server from other machines without enabling local-network serving — via an outbound-only connector and a real API key.

By default, LM Studio's built-in server listens on `http://127.0.0.1:1234/v1` — it isn't reachable from another machine. LM Studio does have a **serve on local network** option, but that's a LAN feature: it binds beyond loopback for devices on the same network, and authentication is off by default. Keep LM Studio on localhost and run the Tokios connector next to it instead: the connector dials out to `https://api.tokios.com`, and your tools, teammates, or agents call one authenticated endpoint from anywhere.

> [!TIP]
>
> **Beginner-friendly.** LM Studio is a point-and-click desktop app — download a model, click **Start server**, and you're serving. A great first backend if you prefer a GUI over the command line.

## LM Studio's network serving stops at your LAN

LM Studio's **serve on local network** toggle is documented as exactly that — local network. Turning it on binds the server to your machine's network interface (not just `127.0.0.1`) so other devices on the same Wi-Fi or LAN can reach it, and LM Studio shows a warning when you enable it because auth is off by default. That's a reasonable fit for reaching your own server from another device on the same network. It doesn't extend to a teammate on another network, a hosted agent, or anything you'd want to reach over the open internet with a real credential behind it.

> [!NOTE]
>
> This isn't a knock on LM Studio's local-network serving — it does what it says for devices on your LAN. Tokios solves a different problem: an authenticated endpoint reachable from anywhere, without opening LM Studio to your network at all. LM Studio is a first-class Tokios backend, alongside Ollama, llama.cpp, and vLLM.

## The outbound-only way

**1. Load a model and start LM Studio's server**

Open LM Studio, go to the **Developer** (or **Local Server**) tab, load a model, and click to start the server. Leave **serve on local network** off — Tokios doesn't need it. LM Studio keeps listening on the default `http://127.0.0.1:1234/v1`.

**2. Pair the Tokios connector**

Sign in at [tokios.com/console](https://tokios.com/console), open the **Setup** tab, and click **Start pairing**. Tokios shows a one-time **claim code** like `TKS-XXXX-XXXX`, valid for about 15 minutes.

On the machine running LM Studio, run the install one-liner for your OS:

```powershell Windows theme={"theme":{"light":"github-light","dark":"css-variables"}}
irm https://tokios.com/downloads/install/windows | iex; tokios-install -Code 'TKS-XXXX-XXXX'
```

```bash macOS theme={"theme":{"light":"github-light","dark":"css-variables"}}
curl -fsSL https://tokios.com/downloads/install/macos | sh -s -- --code TKS-XXXX-XXXX
```

```bash Linux theme={"theme":{"light":"github-light","dark":"css-variables"}}
curl -fsSL https://tokios.com/downloads/install/linux | sh -s -- --code TKS-XXXX-XXXX
```

Already have `tokios-connector` installed? Pass the code directly instead:

```bash theme={"theme":{"light":"github-light","dark":"css-variables"}}
tokios-connector TKS-XXXX-XXXX
```

Back in the console, **approve** the device on the **Setup** or **Connectors** tab. The connector's token is delivered over the tunnel once approved — you never see it on screen or paste it into a file.

**3. Point the connector at LM Studio's /v1 API**

LM Studio's built-in server already speaks the OpenAI-compatible surface Tokios expects. For the basic single-model path, the console's Setup wizard uses `http://127.0.0.1:1234/v1` as the upstream automatically. If you're serving multiple models through a `tokios-connector.json` config, set the upstream `BaseUrl` explicitly:

```json theme={"theme":{"light":"github-light","dark":"css-variables"}}
{
  "Upstream": {
    "BaseUrl": "http://127.0.0.1:1234/v1"
  }
}
```

See [Connector config](https://docs.tokios.com/reference/connector-config.md) for the full multi-model file format.

**4. Register a deployment**

In the [Models](https://tokios.com/console/models) tab, register the LM Studio model and choose a **public name** — for example, `lmstudio-tunnel`. That public name, not LM Studio's local model id, is what clients send in the `model` field.

**5. Create an API key**

In the [Keys](https://tokios.com/console/keys) tab, click **Create key**. Optionally scope it to specific deployments with model-name patterns (comma-separated globs, `*` for all). Copy the `sk-tok-…` key now — it's shown only once.

> [!TIP]
>
> Tokios works the same way regardless of the model format LM Studio loaded — GGUF or MLX — since the connector only ever talks to LM Studio's OpenAI-compatible `/v1` surface, not the model file directly.

## Use it from anywhere

Once you have a deployment name and an API key, any OpenAI- or Anthropic-compatible client can reach your LM Studio model — from another machine, a teammate's laptop, or a hosted agent.

```bash curl theme={"theme":{"light":"github-light","dark":"css-variables"}}
curl https://api.tokios.com/v1/chat/completions \
  -H "Authorization: Bearer sk-tok-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "lmstudio-tunnel",
    "stream": true,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

```python Python (OpenAI SDK) theme={"theme":{"light":"github-light","dark":"css-variables"}}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tokios.com/v1",
    api_key="sk-tok-YOUR_KEY",
)

response = client.chat.completions.create(
    model="lmstudio-tunnel",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)

for chunk in response:
    print(chunk.choices[0].delta.content or "", end="")
```

```bash Claude Code theme={"theme":{"light":"github-light","dark":"css-variables"}}
export ANTHROPIC_BASE_URL=https://api.tokios.com
export ANTHROPIC_API_KEY=sk-tok-YOUR_KEY
claude --model lmstudio-tunnel
```

> [!TIP]
>
> The `model` field is always your registered **deployment** name (`lmstudio-tunnel` above), never LM Studio's local model id. See [Use Claude Code](https://docs.tokios.com/guides/claude-code.md) for persisting the environment variables across sessions.

## FAQ

> [accordion] Does streaming work?
>
> Yes. Set `"stream": true` and Tokios returns standard server-sent events (SSE) in OpenAI or Anthropic format, depending on which API surface you called.

> [accordion] Can I expose more than one model loaded in LM Studio?
>
> Yes. Register additional deployments in the [Models](https://tokios.com/console/models) tab, or use a `tokios-connector.json` config file to define multiple upstreams and routes for a single connector. See [Connector config](https://docs.tokios.com/reference/connector-config.md).

> [accordion] Do I need to keep the LM Studio app open, or can the connector run as a service?
>
> LM Studio's server needs the app running to serve requests. The `tokios-connector` process itself can run unattended next to it — see [Connector config](https://docs.tokios.com/reference/connector-config.md) for the config-file options used when running the connector long-term, such as for multiple models or as a background service.

> [accordion] Do I still need LM Studio's serve on local network option?
>
> No. Leave it off. The connector reaches LM Studio over loopback (`127.0.0.1:1234`), so LM Studio never needs to bind beyond localhost — Tokios is what makes the model reachable from other machines, authenticated with your `sk-tok-…` key.

## Your model never leaves your machine — your endpoint works everywhere

LM Studio keeps doing exactly what it does today, on localhost, with no inbound ports and no network-serving toggle switched on. The connector only dials out. Everything past that — auth, routing, streaming — is one endpoint you can call from any machine, teammate, or agent you choose to give a key to.

> [card] [Quickstart](https://docs.tokios.com/quickstart.md)
>
> Pair a connector and register your first model end to end.

> [card] [API keys](https://docs.tokios.com/setup/api-keys.md)
>
> Create, scope, and rotate `sk-tok-…` keys for teammates and agents.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.