DocsReference
Local server API
The OpenAI and Anthropic compatible endpoints on your Mac, the model catalog, and the decision endpoints.
What the local server is
ModelDeck serves the models you load to other apps on your Mac. The server speaks the OpenAI API and the Anthropic Messages API, so most tools that let you set a base URL can use a local model through it. It starts when ModelDeck starts.
The server listens only on your Mac's loopback interface. Other computers on your network cannot reach it, and it sends no CORS headers, so web pages in a browser cannot call it either.
Find the address
Open Server in the sidebar (⌘5). The header shows Running at and the address, and Copy URL copies the base URL your apps need. Unless you changed the port, it is http://127.0.0.1:8099/v1.
The examples on this page keep that address in a shell variable:
export MODELDECK_URL="http://127.0.0.1:8099/v1" # or the address from Copy URL, if you changed the port
curl "$MODELDECK_URL/models"
You can also start and stop the server from the Server screen (Start server, Stop server), from the menu bar icon, or from the command palette. Stopping it cuts off every app that uses it. It does not unload your models.
Port and API key
Change these in Settings > Local server. The Server screen shows the current values on one line under its header, with a Server settings button.
| Setting | Default | What it does |
|---|---|---|
| Port | 8099 | Any port from 1024 to 65535. Ports 8000 and 8001 are reserved for other services and 8101 to 8199 for engines ModelDeck launches. Changing the port restarts the server. |
| API key (optional) | Empty | When set, every request must send it. Empty means no key is needed. |
| Unload after idle (minutes) | 10 | Frees memory when a model has had no requests. 0 keeps models loaded. |
| Load models on first request | On | A request for a model on this Mac loads it. Off: only loaded models answer. |
| Browser access (CORS) | Off | Fixed. No CORS headers are sent. |
| Setting | Default | What it does |
|---|---|---|
| One on-request model at a time | Off | A request for another model waits for the current on-request model to finish its requests, unloads it, then loads the new one. Models you load yourself stay loaded. Needs Load models on first request. |
Send the key either as Authorization: Bearer <key> or as x-api-key: <key>. The snippets in the app read it from the MODELDECK_API_KEY environment variable and never show it.
export MODELDECK_API_KEY="the key from Settings > Local server"
curl "$MODELDECK_URL/models" -H "Authorization: Bearer $MODELDECK_API_KEY"
GET /health answers without a key, so you can check that the server is up.
Endpoints
| Method and path | What it does |
|---|---|
GET /v1/models | Lists the models you can call: loaded ones, plus every downloaded model that loads on first request. |
POST /v1/chat/completions | OpenAI chat completions, streaming or not. |
Other POST /v1/... | Forwarded to the engine that serves the model, for example /v1/completions or /v1/embeddings. Whether it works depends on the engine. |
POST /v1/messages | Anthropic Messages API. See Anthropic Messages. |
POST /v1/messages/count_tokens | A rough token estimate for a Messages request. |
POST /v1/decide, POST /v1/score | Typed answers from a decision model. See Decision endpoints. |
GET /api/model-catalog.json | The model catalog. See Model catalog. |
POST /mcp | The MCP endpoint, also served here while the server runs. See MCP server. |
GET /health | {"status":"ok","name":"ModelDeck"}. No key needed. |
Requests can be up to 64 MiB.
Choose a model
Put the model's id in the model field. The Overview tab on the Server screen shows it as Model id for apps, and GET /v1/models lists every id:
{"object":"list","data":[{"id":"qwen3-8b","object":"model","owned_by":"modeldeck","meta":{"engine":"gguf","loaded":false,"jit":true,"port":null}}]}
- For a GGUF model the id is its name, or the
--aliasyou set when loading it. - Every MLX model is served as
default_model, so only one MLX model at a time is in the list. - A Splash model's id is its Splash package name.
meta.loadedsays a model is running.meta.jitsays it will load on its first request.
If you leave out model and exactly one model is running, ModelDeck uses that one.
Loading on first request
With Load models on first request on, a request for a downloaded model that is not running loads it with its last-used settings, waits until it is ready, then answers. The response carries the header x-modeldeck-jit: loaded. Requests that arrive during the load share it. A model loaded this way unloads after the idle time in Settings.
Every load is checked for memory first. See the memory check.
Chat completions
curl "$MODELDECK_URL/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MODELDECK_API_KEY" \
-d '{"model":"qwen3-8b","messages":[{"role":"user","content":"Hello"}],"stream":true}'
With "stream": true the engine's server-sent events pass straight through. If your client disconnects, ModelDeck stops the engine's request too.
The API tab on the Server screen has the same call ready to copy as curl, OpenAI Python and OpenAI JS, filled in with the selected model's id. In Python, for example:
import os
from openai import OpenAI
client = OpenAI(base_url=os.environ["MODELDECK_URL"], api_key=os.environ.get("MODELDECK_API_KEY", "none"))
reply = client.chat.completions.create(model="qwen3-8b", messages=[{"role": "user", "content": "Hello"}])
print(reply.choices[0].message.content)
Response settings
The Response settings tab on the Server screen sets defaults per model for System prompt, Temperature, Top P, Max response tokens and Reasoning effort. They apply to chat completions from every app, only for fields the request leaves out. The system prompt is added only when the request has no system message. Leave a field empty to use the engine's default.
Anthropic Messages
POST /v1/messages accepts an Anthropic Messages request and answers in the Anthropic format, streaming or not. ModelDeck translates it to a chat completion for the engine. Both x-api-key and Authorization: Bearer work for the key.
Supported:
systemas a string or text blocks.- Message content as a string or as
text,image,tool_useandtool_resultblocks. max_tokens,temperature,top_p,stop_sequencesandstream.toolsandtool_choice(auto,any,tool,none).
Ignored: thinking blocks, prompt caching (cache_control is accepted and ignored), top_k, metadata and server tools. count_tokens is an estimate of about four characters per token.
Errors use the Anthropic error format. To point Claude Code at this endpoint, see Configure agents.
Decision endpoints
A decision model gives typed answers with probabilities instead of free text: yes or no, one of several labels, or scores. Load one the same way as a chat model; its card on the Server screen shows a Decision badge.
POST /v1/decide takes:
model, and eitherinput(a string) orinputs(up to 2,000 strings).question.type:noulfor a yes or no answer, otherwise a choice amonglabels(up to 26).- Optional:
threshold(0 to 1; below it the answer abstains),temperature(default 0),seed,batch_size(1 to 16, default 4),samples(1 to 32, default 1) andmethod(auto,rerank,logprobsorsampled).
curl "$MODELDECK_URL/decide" -H "Content-Type: application/json" \
-d '{"model":"my-decision-model","type":"noul","question":"Is this a refund request?","input":"I want my money back for order 123."}'
The answer lists one result per input with label, probabilities, confidence and coverage, plus latency_ms, and a usage block with items per second.
POST /v1/score takes model, input or inputs, a question, and dimensions (up to 12; each is a name, or an object with name and optional weight, min and max; scores run 1 to 5 by default). Each result has scores per dimension and a weighted composite.
Probabilities from these endpoints are not calibrated. Every response says "calibrated": false and names its probability_source. The rerank method can choose but cannot score.
Coming in the next release
API models and modeldeck/auto
Two switches in Settings > Routing let apps reach more than local models through this server. Both are off by default.
List API provider models on the local server adds the chat models of your API providers, named api:<provider>/<model>. They appear in GET /v1/models and answer on /v1/chat/completions and /v1/messages, streamed or not. ModelDeck adds the provider's saved key, and your provider account pays for the requests.
Serve modeldeck/auto adds one model, modeldeck/auto, that picks a route for each request: a model and a reasoning effort. How requests are routed:
| Mode | How it picks |
|---|---|
| LLM router | A chat model you choose as Router model reads your routes and names one. |
| Decision model | A decision model on this Mac picks the route. Below Least confidence, the fallback route answers. |
| External router | ModelDeck posts the request and your routes to a Router address you run or subscribe to, and uses the route it names. |
| Rules only | No model: keywords first, then an estimate of how complex the request is (length, code, math, tools). |
Routes are listed lightest first, each with a Model (on this Mac or from a provider), a Reasoning effort, When to use it (the router reads it) and optional Keywords. A request that mentions a keyword always goes to that route. ModelDeck sends the effort in each provider's own form.
- If the router fails or takes longer than Router time limit (ms) (8,000 by default), the rules answer when Use the rules when the router fails is on, otherwise the fallback route does.
- Let the router choose the effort and Keep the effort a client asks for decide where the effort comes from. A request that sets
reasoning_effortitself keeps it while the second is on. - Try a prompt shows which route a prompt gets, and Copy curl example copies a request for another app.
- With Keep a log of routing decisions on (the default), each request adds one line with tokens, time and cost to
~/.modeldeck/routing-decisions.jsonl, and Routing decisions sums them by route.
API models and modeldeck/auto answer only programs on this Mac. A request from a web page, or one addressed to a host name that is not this Mac, gets a 403 error. An external router receives a provider's key only when you choose it in Send this provider’s key and its address is that provider's own.
Model catalog
The Model catalog section on the Server screen lists every model id the server answers to, with its engine, kind and status (Loaded, Starting, Unloading or Loads on first request). A note under it lists downloaded models that are not in the catalog and why, for example a download that is not finished.
The same list is at GET /api/model-catalog.json, in the Hermes model-catalog format (version 1). It needs the API key when one is set. Export JSON saves a copy as a file, which needs no key.
With One on-request model at a time on, the catalog marks the model that holds the on-request slot.
Request log
Live requests on the Server screen lists recent requests with the client, model, engine, status, tokens in, cached and out, cache hit, time to first token, prefill and generation speed, and duration. Requests in progress show at the top with their phase. Click a row for the full request detail, or export the table as CSV.
ModelDeck keeps the last 5,000 requests in memory and writes daily log files under ~/.modeldeck/logs, with secrets redacted.
Errors
Errors use the OpenAI error format, {"error":{"message","type","code"}}, or the Anthropic one on /v1/messages.
| Status | Meaning |
|---|---|
| 400 | The body is not JSON, or model is missing while more than one model runs. |
| 401 | Invalid or missing API key. |
| 404 | Model "…" is not loaded and not in the library, or no such route. |
| 413 | The body is larger than 64 MiB. |
| 502 | Engine request failed: the engine stopped or could not be reached. |
| 503 | The model is not loaded and loading on first request is off, or the memory check refused the load (code: insufficient_memory, with the models in the way and the memory needed). On /v1/messages a memory refusal is an overloaded_error. |
More fixes are in Troubleshooting.
Coming in the next release
A 403 API models and modeldeck/auto only answer programs on this computer means a web page or a non-local address asked for an API model or modeldeck/auto.
Coming in the next release
Headless mode
modeldeck serve runs this server, the engines and the MCP server with no window, on macOS, Windows and Linux. See Headless mode and the CLI.