# Local Relay — Serve Models From Your Own Machine

> Serve a model from your own computer (Apple Foundation Models, Ollama, LM Studio) through your AnyRouter key, and optionally donate idle capacity to the shared pool.


# Local Relay

Local relay turns a computer you own into an AnyRouter backend. The `anyr` CLI opens an outbound connection to AnyRouter, and matching chat-completion requests are forwarded to a local OpenAI-compatible server (Apple `fm serve`, Ollama, LM Studio, llama.cpp, vLLM). Requests served by your own device are never billed against your credits.

## Quickstart

1. Start the relay. The first run signs you in (or reuses your key) and pairs the device.

   ```bash
   anyr relay start
   ```

2. Call the model with your normal `sk-ar-...` key:

   ```bash
   curl https://anyrouter.dev/api/v1/chat/completions \
     -H "Authorization: Bearer $ANYROUTER_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"model": "apple/foundation-model", "messages": [{"role": "user", "content": "hi"}]}'
   ```

The relay starts on-device servers for you: Apple Foundation Models (`fm serve` on `127.0.0.1:1976`) and the PPLX Decider app (`127.0.0.1:8080`). The status screen marks them `(managed)`; a server you started yourself shows `(external)` and is left running on quit. Add `--no-launch` to use only servers already running. Ollama (`http://localhost:11434`) and LM Studio (`http://localhost:1234`) are detected, but you start them yourself. Nothing needs to be exposed: the device only dials out, so no port forwarding or public IP.

## PPLX Decider on your Mac

`perplexity/pplx-decider-flash-v1.2` is Perplexity's on-device decision model. It answers the [Decisions API](/api-reference/systemone), not chat completions. Only your own Mac serves your own requests: it is never offered to the shared pool, even with `--pool`.

Install the app from Perplexity's [Decider for Mac](https://docs.perplexity.ai/docs/decisions/decider-for-mac) page into `/Applications` (AnyRouter hosts no download; the first launch downloads about 5.8 GB). Then run `anyr relay start` and send a decision request with the model id above. If the app is still downloading, the relay keeps watching and serves it once it answers.

Run `anyr relay doctor` to check the "Decider app" status:

| Result | Fix |
|---|---|
| Answering on `127.0.0.1:8080` | Nothing to do |
| Installed, not running | `anyr relay start` launches it, or open the app |
| Not installed | Install it from the link above |
| Needs a Mac | Decider runs only on macOS; serve Ollama or LM Studio, or pass `--target <url>` |

## Donate to the shared pool

```bash
anyr relay start --pool
```

Other users' matching requests can then route to your device when it is idle. Serving earns no credits, but on Go or a higher plan you get free Pool access, as with [donating a BYOK key](/features/shared-pool): Pool-served requests cost you $0, even at a $0 balance. This lasts while the device is paired, sharing is on, it was online in the last 7 days, and it offers at least one model the pool can use (Apple's on-device models do not count). Toggle sharing per device, see advertised models and requests served in [Dashboard > Devices](https://anyrouter.dev/dashboard/devices). Live aggregate availability is on the [relay page](https://anyrouter.dev/relay).

## Limits and security

- Apple's on-device model has a hard 4096-token context, shared by instructions, tool schemas and transcript.
- If your device is asleep or offline, AnyRouter detects it within seconds and fails over to your other upstreams for that model. If a pool donor's device serves you instead, normal model pricing applies.
- Pairing mints a one-time-shown token; only its hash is stored. Revoke it in Dashboard > Devices and the device loses access immediately.
- The relay forwards only one fixed chat-completion path. It has no access to your files or shell.
- Only you can route to your device unless you pass `--pool`; pool routing is anonymous on both sides.


## Related

- [Bring Your Own Key (BYOK)](/docs/features/byok.md)
- [Share a Key to the Shared Pool](/docs/features/shared-pool.md)
