models.providers.<id>.localService starts a provider-owned local model server on demand. When a request selects a model from that provider, OpenClaw probes the health endpoint, starts the process if it is down, waits for readiness, then sends the request. Use it to avoid keeping expensive local servers running all day.
How it works
- A model request resolves to a configured provider.
- If that provider has
localService, OpenClaw probeshealthUrl. - On a successful probe, OpenClaw uses the already-running server.
- On a failed probe, OpenClaw spawns
commandwithargs. - OpenClaw polls the health endpoint until
readyTimeoutMsexpires. - The model request goes through the normal provider transport.
- If OpenClaw started the process and
idleStopMsis set, it stops the process after the last in-flight request has been idle that long.
healthUrl, this process reuses it without adopting it (each process only manages the child it personally started). Active streaming responses hold a lease, so idle shutdown waits until response handling completes.
Config shape
timeoutSeconds on the provider entry (not localService) so slow cold starts and long generations do not hit the default model request timeout. Set an explicit healthUrl whenever your server exposes readiness somewhere other than /models on the base URL.
Fields
| Field | Required | Description |
|---|---|---|
command | yes | Absolute executable path. No shell PATH lookup. |
args | no | Process arguments. No shell expansion, pipes, globbing, or quoting. |
cwd | no | Working directory for the process. |
env | no | Environment variables merged over the OpenClaw process environment. |
healthUrl | no | Readiness URL. Defaults to baseUrl with /models appended (http://127.0.0.1:8000/v1 becomes http://127.0.0.1:8000/v1/models). |
readyTimeoutMs | no | Startup readiness deadline. Default: 120000. |
idleStopMs | no | Idle shutdown delay for an OpenClaw-started process. 0 or omitted keeps it alive until OpenClaw exits. |
Inferrs example
Inferrs is a custom OpenAI-compatible/v1 backend, so the same localService API works with an inferrs provider entry:
command with the result of which inferrs on the machine running OpenClaw. Full inferrs setup: Inferrs.
ds4 example
Related
Local models
Local model setup, provider choices, and safety guidance.
Inferrs
Run OpenClaw through the inferrs OpenAI-compatible local server.