Quickstart
Send your first request to the models on this Mac — with cURL, the OpenAI SDKs or the `midium` command — and find where to go next.
For developers
Midium serves an OpenAI-compatible API (and an Anthropic-compatible one) from this Mac. Anything that can talk to OpenAI can talk to Midium: change the base URL, use your Midium key, and name a Midium model.
Before you start#
You need three things. The examples on this page fill them in for you from this Mac.
| What | Value here | Where to find it |
|---|---|---|
| Base URL | http://127.0.0.1:9100/v1 | Settings → API, or the connection pill at the top of the window |
| API key | YOUR_API_KEY | Settings → API (Your local key), the connection pill, or midium key --reveal |
| Model | YOUR_MODEL | Any chat model on Settings → Models. Use its name as shown. |
The engine listens on 127.0.0.1 only, so requests must come from this Mac. See Remote access to reach it from elsewhere.
Send a chat request#
curl http://127.0.0.1:9100/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL",
"messages": [{"role": "user", "content": "Say hello in five words."}]
}'
If the model isn't in memory yet, the first request loads it, so it can take a while. Later requests answer right away.
The reply is a standard chat completion. A reasoning model's thinking comes back separately, in message.reasoning_content, not in content. See Chat completions.
Or ask from the terminal#
The midium command can do the same without any code:
midium ask "Say hello in five words."
midium ask gemma "Say hello in five words." # pick a model; a partial name works
cat notes.txt | midium ask "Summarize this" # a piped prompt works too
With no model named, midium ask uses the Sub-agent model from Settings → Agent, else one already in memory. See CLI reference.
Stream the reply#
Add "stream": true to get the reply as it's written, as server-sent events:
curl -N http://127.0.0.1:9100/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "YOUR_MODEL", "stream": true,
"messages": [{"role": "user", "content": "Count to ten."}]}'
List your models#
curl http://127.0.0.1:9100/v1/models -H "Authorization: Bearer YOUR_API_KEY"
Each entry's id is the name to send as model. Entries also say what the model is for (type: chat, embedding, rerank, transcription, …) and whether it takes images (capabilities.vision).
Where to go next#
- Authentication — the key, the headers each route accepts.
- Chat completions — every request field, streaming, reasoning.
- Anthropic Messages — run Claude Code or the Anthropic SDKs on local models.
- Images & vision, Tool calling, Structured output.
- Embeddings & rerank, Audio transcription.
- MCP servers — give Cursor, Claude Code or Codex Midium's sub-agents and your vaults.
- Errors & limits — status codes and the limits that apply.
Something here wrong or out of date? Tell us.
