Skip to content

Providers

boarding   Models phase (P4.5-1, P4.5-2, P4.5-7)

A provider is a URL and a dialect. That is the whole abstraction. Acpilot does not download models, manage GPU memory, or restart your inference server. LM Studio, Ollama, and llama.cpp already do that well, and duplicating it would be the wrong kind of ambition.

LM Studio is the reference provider because it answers the questions a lab needs to ask. Its native REST API reports what the model is, and what the request cost:

~/.config/acpilot/profiles/work/providers.toml
schema_version = 1
[[providers]]
id = "lmstudio"
kind = "lm_studio"
label = "LM Studio (this machine)"
base_url = "http://127.0.0.1:1234"
enabled = true
# Only for servers started with a token (lms server start --token):
# credential_ref = "keyring:work/lmstudio"
Terminal window
curl -s http://127.0.0.1:1234/api/v0/models | jq '.data[0]'
{
"id": "qwen2-vl-7b-instruct",
"object": "model",
"type": "vlm",
"publisher": "mlx-community",
"arch": "qwen2_vl",
"compatibility_type": "mlx",
"quantization": "4bit",
"state": "not-loaded",
"max_context_length": 32768
}

That response fills most of the lab’s instrument panel:

Field Becomes Why it matters
type chat / vision / embedding An embedding model is not an agent, and the picker says so
arch Display string “Why is this one weird at code?”
quantization Display string Q4_K_M explains more than temperature does
state loaded A not-loaded model costs seconds on the first run. The UI warns
max_context_length context_window (context_source: server) The lab validates the recipe against it, not against a guess

The chat endpoint returns the numbers a tuning session lives on: usage, plus stats.tokens_per_second, stats.time_to_first_token, and stats.stop_reason. model_info and runtime name the engine that actually answered:

Terminal window
curl -s http://127.0.0.1:1234/api/v0/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"qwen2-7b-instruct","messages":[{"role":"user","content":"hi"}]}' \
| jq '{usage, stats}'

Everything else: the OpenAI-compatible rail

Section titled “Everything else: the OpenAI-compatible rail”

Most local servers speak OpenAI’s chat-completions shape. One adapter covers them:

[[providers]]
id = "ollama"
kind = "open_ai_compatible"
base_url = "http://127.0.0.1:11434/v1"
enabled = true
Server Base URL Notes
Ollama http://127.0.0.1:11434/v1 Its native /api is richer. The compatible path is enough to start
llama.cpp / llama-server http://127.0.0.1:8080/v1
vLLM http://127.0.0.1:8000/v1
LM Studio (compatible mode) http://127.0.0.1:1234/v1 Fewer facts than lm_studio. The gauges go quiet
OpenRouter / hosted OpenAI-shaped https://…/v1 Set credential_ref. The key stays in the keyring

The difference between the two kinds is not marketing. open_ai_compatible reports a model list and an answer. It does not report quantization, load state, time to first token, or a trustworthy context window. The lab therefore has fewer gauges. It says which ones are missing rather than filling them with a plausible number. A 4,096-token guess is how a prompt gets truncated without anybody noticing.

Nothing contacts a provider until you declare it and enable it. There is no startup scan of 127.0.0.1, no polling, and no background retry. The daemon reports an unreachable provider as unreachable, and it stays that way until something asks again.

Terminal window
acpilot models probe lmstudio # the only thing that talks to the network

The declaration is written to providers.toml, so a restart reads the rows back. The answer travels too: providers.state.toml keeps the last probe result, so a restart says unreachable at 12:04 instead of not_probed. Change the URL, the dialect or the credential reference and the row is not_probed again, because the old server’s answer is not the new server’s. A failed probe still answers 201, with the reason in detail. A disabled provider is never contacted, even when a command names it.

If a provider is down, the daemon reports model_unavailable with a 502. The daemon is healthy and the thing behind it is not. The UI may offer “retry” without implying that Acpilot broke.

Vibecoded, on purpose. While I am a software developer, I lack the time to hand-code all my ideas, and as a result this project is vibecoded withFreebuff.