Local Model Service Protocol (LMSP)
- Draft 1.0
- Updated
- View as Markdown
What LMSP does
LMSP (Local Model Service Protocol) is an open protocol for software that runs language models on a user’s own device or local network, and for the clients that use that software.
A resident local service describes itself at a well-known address and lists its models. It answers generation requests with JSON or server-sent events, and runs long generations as persisted tasks that can be cancelled and followed again after a disconnect. The same service also speaks the OpenAI API, so the clients that exist today keep working.
LMSP does not replace the OpenAI API, Ollama or MCP. It combines their strengths in a protocol layer built for resident local services.
At a glance
| Topic | Summary |
|---|---|
| Default address | http://127.0.0.1:17832 |
| Service description | GET /.well-known/lmsp.json |
| Core interface | /lmsp/v1, JSON over HTTP, streaming with server-sent events |
| Compatibility interfaces | /v1 for OpenAI clients, optional /api for Ollama clients |
| Discovery | Manual address, probing of local addresses, optional mDNS and DNS-SD (_lmsp._tcp.local.) |
| Authentication | Bearer tokens obtained through local pairing |
| Persistence | Embedded SQLite, with tasks that survive a restart |
| Contract | OpenAPI 3.2 |
Try it
If an LMSP service is running on your machine, this is the whole flow. Pair first to get a token, as described in section 10.2, and keep it in LMSP_TOKEN.
# 1. Discover the service
curl http://127.0.0.1:17832/.well-known/lmsp.json
# 2. List the local models
curl http://127.0.0.1:17832/lmsp/v1/models \
-H "Authorization: Bearer $LMSP_TOKEN"
# 3. Generate a response
curl http://127.0.0.1:17832/lmsp/v1/responses \
-H "Authorization: Bearer $LMSP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3:14b-q4_k_m","input":[{"type":"message","role":"user","content":[{"type":"input_text","text":"Hello"}]}]}'
How LMSP relates to other protocols
| Protocol | What it covers | Relation to LMSP |
|---|---|---|
| OpenAI API | Hosted models. The Responses API is its newest interface. | LMSP follows the Responses structure for its core interface, and a service offers an OpenAI-compatible interface next to it. |
| Ollama | A local runtime that already serves OpenAI-compatible endpoints. | It can sit behind an LMSP service as an adapter, and LMSP defines optional Ollama-compatible endpoints. |
| MCP | Connects agents to tools and context. | LMSP connects agents to models. Both prefer stateless discovery over mandatory sessions. |
| A2A | Collaboration between agents. | LMSP borrows service cards and explicit task states for its service description and its tasks. |
Resources
- The specification, version 1.0 (draft).
- The OpenAPI contract, as JSON or YAML.
- llms.txt and llms-full.txt, for language models.
- Every page is available as Markdown. Replace the trailing slash of its address with
.md, for example/lmsp/1.0/tasks.md.
Specification 1.0
- Overview
LMSP 1.0 draft overview. What the Local Model Service Protocol is, the designs it builds on, its layered architecture, how to read the specification, and the terms used throughout.
- Transport and deployment
Default listen addresses, transport, streaming format and URL layout of an LMSP service, and how it runs as an operating-system service separate from the model processes.
- Service discovery
How LMSP clients find a local service through manual configuration, loopback probing and optional mDNS/DNS-SD, and how to read the well-known service description document.
- Endpoints
The complete table of LMSP 1.0 endpoints with method, path, requirement level and purpose, plus the conventions for paths, authentication and optional endpoints.
- Model catalog
How an LMSP service lists its local models, the model object and its capability flags, the model lifecycle states, stable model ids and catalog revisions.
- Responses and streaming
The LMSP core conversation interface, with Responses-style requests and output items, synchronous and streaming generation, server-sent event types, event ids, reconnection and tool calls.
- Asynchronous tasks
How LMSP runs long generations as persisted tasks, with task creation, the task state machine, idempotent cancellation, event streams and restart policies for unfinished tasks.
- OpenAI and Ollama compatibility
How an LMSP service stays compatible with existing OpenAI and Ollama clients through a thin data-conversion layer over one execution core, and where that compatibility ends.
- Common rules
Rules shared by every LMSP endpoint, covering version headers and extensions, idempotency keys, the problem+json error format with its error codes, and the health check.
- Local security
Security requirements for LMSP services, with loopback binding, pairing and bearer tokens, scopes, Origin and Host checks against malicious web pages, LAN mode and logging rules.
- Persistence
How an LMSP service stores its state, with an embedded SQLite database, the tables to keep, the transactional rules for tasks and events, retention and recovery at startup.
- Minimum viable scope
A suggested scope for a first LMSP implementation, with the ten pieces that form a usable closed loop and the parts of the specification that can wait for later releases.
Frequently asked questions
What is LMSP?
LMSP, the Local Model Service Protocol, is an open protocol for language-model services that run on a user's own device or local network. It defines how clients discover a service, list its models, request responses, stream output and run long tasks.
Does LMSP replace the OpenAI API, Ollama or MCP?
No. LMSP builds on them. Its core interface follows the OpenAI Responses structure, a service can offer OpenAI-compatible and Ollama-compatible endpoints, and the protocol borrows stateless discovery from MCP and task states from A2A.
Can existing OpenAI clients use an LMSP service?
Usually yes. They need a different base URL and the LMSP token as their API key. They do not find the service automatically, because discovery needs a client that supports LMSP.
How does a client find a local LMSP service?
It tries three things in order. First an address entered by hand, then the conventional local address, where it requests /.well-known/lmsp.json, and finally optional mDNS and DNS-SD browsing for _lmsp._tcp.local. on the local network.
Is a model service on localhost safe?
Not automatically, because web pages can try to reach local ports. LMSP services bind to loopback by default, require bearer tokens obtained by local pairing, check the Origin and Host headers, and require authentication in LAN mode.
What is the status of the specification?
Version 1.0 is a first public draft and can still change incompatibly. The English text is normative, and translations are provided for convenience.