> ## 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 Zed with your own local model — over OpenAI or Anthropic

> Configure Zed's OpenAI- or Anthropic-compatible provider to reach a local model on Ollama, LM Studio, or vLLM through Tokios — using either endpoint.

Zed can call a custom model through two separate provider slots in `settings.json`: `language_models.openai_compatible` and `language_models.anthropic_compatible`. Both accept a custom `api_url`, so Zed is the cleanest place to show off both sides of Tokios — the OpenAI-compatible endpoint at `https://api.tokios.com/v1` and the Anthropic-compatible endpoint at `https://api.tokios.com`. Pick either one, or configure both and switch per-assistant.

## Prerequisites

* A running Tokios connector paired with your local model — see [Connector install](https://docs.tokios.com/setup/connector-install.md)
* A registered model deployment name — see [Register a model](https://docs.tokios.com/setup/register-model.md)
* A Tokios API key (`sk-tok-…`) — see [API Keys](https://docs.tokios.com/setup/api-keys.md)
* Zed installed

## Option A: OpenAI-compatible provider

**1. Open Zed's settings.json**

Open the command palette and run `zed: open settings`, or edit `settings.json` directly.

**2. Add an openai\_compatible entry**

Add a `language_models.openai_compatible` block with the Tokios base URL, your deployment name, and your API key:

```json settings.json theme={"theme":{"light":"github-light","dark":"css-variables"}}
{
  "language_models": {
    "openai_compatible": {
      "Tokios": {
        "api_url": "https://api.tokios.com/v1",
        "available_models": [
          {
            "name": "gemma-tunnel",
            "display_name": "Tokios: gemma-tunnel",
            "max_tokens": 128000
          }
        ]
      }
    }
  }
}
```

Replace `gemma-tunnel` with the **public deployment name** you registered on the [Models](https://tokios.com/console/models) tab — not your Ollama/llama.cpp/vLLM/LM Studio local model id. Note that the key is deliberately absent here — see the next step.

**3. Set your API key outside settings.json**

Zed does not read the API key from `settings.json`. Supply your `sk-tok-…` key either way:

* **Through the UI** — run `agent: open settings` from the command palette, find **Tokios** under **LLM Providers**, and paste the key. Zed stores it in your system keychain.
* **Through an environment variable** — Zed derives the name from the provider id in `settings.json`, upper-snake-cased and suffixed with `_API_KEY`. The id `Tokios` above therefore reads `TOKIOS_API_KEY`.

```bash macOS / Linux theme={"theme":{"light":"github-light","dark":"css-variables"}}
export TOKIOS_API_KEY=sk-tok-YOUR_KEY
```

```powershell Windows theme={"theme":{"light":"github-light","dark":"css-variables"}}
$env:TOKIOS_API_KEY = "sk-tok-YOUR_KEY"
```

A non-empty environment variable takes precedence over the keychain value, so unset it if you later switch to the UI flow.

**4. Select the model in the assistant panel**

Open Zed's assistant panel and choose **Tokios: gemma-tunnel** (or your configured `display_name`) from the model picker.

## Option B: Anthropic-compatible provider

**1. Add an anthropic\_compatible entry**

In the same `settings.json`, add a `language_models.anthropic_compatible` block pointing at the Tokios Anthropic-compatible endpoint. Note there is **no `/v1`** on this base URL:

```json settings.json theme={"theme":{"light":"github-light","dark":"css-variables"}}
{
  "language_models": {
    "anthropic_compatible": {
      "Tokios": {
        "api_url": "https://api.tokios.com",
        "available_models": [
          {
            "name": "gemma-tunnel",
            "display_name": "Tokios (Anthropic): gemma-tunnel",
            "max_tokens": 128000
          }
        ]
      }
    }
  }
}
```

Replace `gemma-tunnel` with the **public deployment name** you registered on the [Models](https://tokios.com/console/models) tab — not your Ollama/llama.cpp/vLLM/LM Studio local model id.

**2. Set your API key outside settings.json**

Supply your `sk-tok-…` key the same way as Option A:

* **Through the UI** — run `agent: open settings` from the command palette, find **Tokios** under **LLM Providers** in the Anthropic-compatible section, and paste the key. Zed stores it in your system keychain.
* **Through an environment variable** — the same `TOKIOS_API_KEY` variable from Option A covers both provider slots, since the provider id is `Tokios` in both cases.

```bash macOS / Linux theme={"theme":{"light":"github-light","dark":"css-variables"}}
export TOKIOS_API_KEY=sk-tok-YOUR_KEY
```

```powershell Windows theme={"theme":{"light":"github-light","dark":"css-variables"}}
$env:TOKIOS_API_KEY = "sk-tok-YOUR_KEY"
```

**3. Select the model in the assistant panel**

Open Zed's assistant panel and choose **Tokios (Anthropic): gemma-tunnel** (or your configured `display_name`) from the model picker, alongside or instead of the OpenAI-compatible one.

> [!NOTE]
>
> Replace `gemma-tunnel` with the deployment name you registered, and `sk-tok-YOUR_KEY` with your own key. Never commit either into a shared or version-controlled `settings.json`.

> [!TIP]
>
> You can configure both providers at once and keep separate entries — one hitting `https://api.tokios.com/v1` (OpenAI-compatible) and one hitting `https://api.tokios.com` (Anthropic-compatible) — then switch between them from the model picker to compare behavior against the same underlying deployment.

## Why this works without a tunnel

Both Zed provider slots need a URL reachable from wherever Zed's model requests originate. Tokios's connector is outbound-only: it dials out from next to your model and never opens an inbound port, so `https://api.tokios.com` (or `/v1`) is a stable, authenticated URL you set once — no `ngrok` process to keep alive, no unauthenticated port sitting open on your LAN.

## Troubleshooting

> [accordion] 401 error
>
> The API key Zed sent is missing, malformed, or has been revoked. Confirm the full `sk-tok-…` key is set with no extra whitespace, and check its status on the [Keys](https://tokios.com/console/keys) tab.

> [accordion] 404 error
>
> The `name` value in `available_models` doesn't match a registered deployment. Confirm it exactly matches the public name on the [Models](https://tokios.com/console/models) tab.

> [accordion] 503 error
>
> The connector for that deployment is offline or at its concurrency cap. Check the [Connectors](https://tokios.com/console/connectors) tab — it needs to show as **Online**.

## Next steps

> [card] [Quickstart](https://docs.tokios.com/quickstart.md)
>
> Pair the connector and register your first deployment from scratch.

> [card] [Compatible clients](https://docs.tokios.com/guides/compatible-clients.md)
>
> See base URL and key setup for other OpenAI- and Anthropic-compatible clients.


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