# Connect your app

Saylek speaks the OpenAI API, so anything that already talks to an OpenAI-compatible
endpoint (an SDK, LangChain, a coding assistant) can point at your daemon instead of a
hosted API, with no code change beyond the base URL.

> **Loopback does not mean local-only.** The endpoint below listens on `127.0.0.1`, but when
> your machine cannot serve a request the daemon sends it to a Host in your Circle by
> default, and your prompt is handled by that person's machine. Turn on local-only mode if
> you need requests to stay put, bearing in mind that it governs Saylek's routing and does
> not override a proxy upstream you configured yourself. See [Privacy and
> egress](/docs/privacy-and-egress).

## The endpoint

The daemon serves its OpenAI-compatible HTTP surface on loopback, by default at:

```
http://127.0.0.1:8443/v1
```

Override the address with the `SAYLEK_LISTEN` / `SAYLEK_PORT` env vars, or
`[daemon].listen` in `config.toml`. See `saylek --help`.

**Keep it on loopback.** The local API is **not authenticated**: it reads an
`Authorization` header and does not check it, because the only thing that can reach
`127.0.0.1` is you. Bind it to `0.0.0.0` or a LAN address and anyone who can route to that
port can use your machine's GPU, and can originate requests into your Circle under your
identity, with no credential at all. Saylek warns when you bind wide and drops your own
priority, but it does **not** add authentication. If you need it reachable from another
machine, put it behind something that authenticates, such as an SSH tunnel or a reverse
proxy you control, rather than opening the port.

## Point your client at it

Most OpenAI SDKs take a base URL and an API key. Locally, the daemon doesn't check the
key, so pass any non-empty string if your client insists on one:

```python
from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:8443/v1", api_key="local")

resp = client.chat.completions.create(
    model="qwen3-4b-instruct-2507-q4_k_m",
    messages=[{"role": "user", "content": "hello"}],
)
print(resp.choices[0].message.content)
```

## Before it can answer

A fresh install has the daemon running but nothing of its own to run yet.

What happens next depends on whether you are in a Circle. **If you are**, a model your
machine cannot serve is routed to a Circle-mate who can, so a call can succeed on a machine
with no model files at all. That is the default, and [Privacy and
egress](/docs/privacy-and-egress) is the page to read before you rely on it. **If you are
not in a Circle**, or no Host online can serve the model you asked for, the call returns
`model_not_found` until a `.gguf` lands under `~/.saylek/models/`.

To give your own machine something to serve: `saylek gpu wizard` (launched automatically
after install) walks you through picking a model; run `saylek model rescan` after dropping
in your own, and `saylek model ls` to confirm it was discovered.

## Confirm it's working

```bash
saylek call "hello"
```

If your app can reach `saylek call`'s built-in smoke test, it can reach the endpoint
above too.

## Next steps

- [Use your Circle from anywhere](/docs/connect-openai): the hosted endpoint, with a key.
- [Troubleshooting](/docs/troubleshooting): `model_not_found` and other first-call stops.
- [Concepts](/docs/concepts): how a request that runs on someone else's GPU stays honest.
