-
Notifications
You must be signed in to change notification settings - Fork 4
API Compatibility
/v1/* and /api/v1/* are forwarded directly to LM Studio. Every other Ollama
endpoint is translated to its native equivalent.
| Endpoint | Behaviour |
|---|---|
GET / |
Returns "Ollama is running" |
GET /api/tags |
Translates to /api/v1/models; includes proxy-managed aliases |
GET /api/ps |
Translates to /api/v1/models; shows loaded models plus aliases; size_vram mirrors the loaded model size (LM Studio reports no GPU/CPU split); details.parent_model is ""; expires_at is a best-effort placeholder |
POST /api/show |
Fetches real LM Studio metadata; capabilities (vision/tools/thinking) come from the backend capabilities object, with an id-keyword fallback only when the backend reports none; description/display_name surfaced; verbose model_info adds loaded tuning (flash_attention/eval_batch_size/parallel/offload_kv_cache_to_gpu) while the model is loaded and multi-quant variants/selected_variant when the backend reports them; merges alias info when present. Native models omit modelfile/template/parameters/license since LM Studio exposes no Modelfile |
POST /api/chat |
Translates to /api/v0/chat/completions for real token stats (or native /api/v1/chat with --use-native-chat). A messageless request warms the model (done_reason:"load" no-op); keep_alive: 0 without messages unloads it |
POST /api/generate |
Translates to /api/v0/completions; vision requests use the v0 chat endpoint. A promptless request warms the model; keep_alive: 0 without a prompt unloads it |
POST /api/embed |
Translates to /v1/embeddings; also handles /api/embeddings. Auto-loads (JIT) an unloaded embedding model on demand instead of returning "no models loaded"; honors num_ctx; truncate defaults to true
|
GET /api/version |
Returns configurable version string (--ollama-version, default 0.30.0) in Ollama format |
GET /health |
Validates LM Studio reachability |
POST /api/create |
Creates proxy-managed virtual aliases (no custom blobs) |
POST /api/pull |
Translates to /api/v1/models/download; streams download progress; insecure is accepted and ignored (no TLS-skip surface to emulate); failed downloads surface LM Studio's error_message
|
POST /api/push |
Returns 501 (LM Studio has no model registry) |
POST /api/web_search |
Generic JSON passthrough to a configurable provider (--search-url); returns 501 when unconfigured. Request: {query, max_results?}; provider response returned verbatim |
POST /api/web_fetch |
Fetches URL, renders HTML to markdown. Request: {url}; response: {title, content, links}. SSRF guard on by default (disable with --allow-private-fetch). No LM Studio dependency |
DELETE /api/delete |
Removes proxy-managed aliases only |
POST /api/copy |
Duplicates aliases or references LM Studio models; returns an empty 200 body and upserts (overwrites an existing destination) |
HEAD/POST /api/blobs/:digest |
Stores and validates blobs for alias manifests |
Upstream LM Studio 429 (rate limited) and 502 (bad gateway) pass through
unchanged; other upstream-unreachable failures map to 503. Proxy-side validation
errors return 400, and a model missing from LM Studio returns 404.
ANY /v1/* and ANY /api/v1/* are forwarded directly to LM Studio without
modification. This includes POST /v1/messages (Anthropic-compat) and
POST /v1/responses (OpenAI Responses), which LM Studio serves natively. The
proxy remaps the model field (and the GET /v1/models/{id} path segment)
from the Ollama-style name or a /api/copy alias to the resolved LM Studio id
before forwarding. A few compatibility shims apply on top:
-
response_format: {"type": "json_object"}is rewritten to the permissivejson_schemaenvelope LM Studio accepts. -
encoding_format: "base64"on/v1/embeddingsis honored by the proxy (LM Studio always returns floats; the proxy re-encodes them). - Proxy-generated errors on
/v1/messagesuse Anthropic's{"type":"error","error":{...}}envelope, including auth rejections. - Mid-stream proxy errors (timeout, cancel, upstream failure) are framed per
protocol:
event: errorfor Anthropic,event: response.failedfor/v1/responses, a typederrorobject for OpenAI-style streams.
Anthropic clients such as Claude Code work against /v1/messages with no extra
setup. See the
Claude Code section
in the README.
-
/api/createand/api/copymanage aliases stored under$XDG_CACHE_HOME/ollama-lmstudio-proxy/virtual_models.json(fallback:$HOME/.cache/ollama-lmstudio-proxy/, then system temp). Alias metadata (system,template,parameters,license,adapters,messages,renderer,parser) is recorded on the alias.systemandparametersreach inference; the rest are stored but stay inert on the LM Studio backend. -
/api/deleteremoves only proxy-managed aliases./api/showreturns LM Studio metadata plus alias info when present. -
/api/pullstreams LM Studio catalog downloads (or blocks when"stream": false); optionalquantizationandsourcefields are forwarded.