LM-Kit OneDocs2026.8.10lm-kit.com
Integration

API Compatibility

Existing SDKs, agents, and tools talk to this server without modification. Three dialects are served side by side (OpenAI, Anthropic, Ollama) and all hit the same engine, the same models, and the same key model: point the client's base URL here, authenticate with an API key, done.


1Pointing a client here#

# OpenAI SDK
from openai import OpenAI
client = OpenAI(base_url="http://your-server:PORT/v1", api_key="lmk_...")

# Anthropic SDK: pass the key as auth_token, which sends the Bearer header
from anthropic import Anthropic
claude = Anthropic(base_url="http://your-server:PORT", auth_token="lmk_...")

Ollama clients point at the server root and speak their own dialect unchanged. Claude Code runs against this server by setting ANTHROPIC_BASE_URL to it and ANTHROPIC_AUTH_TOKEN to a key. On a loopback-only server with anonymous access enabled, the key can be omitted. The Claude Desktop app connects through its own gateway dialog rather than a base URL variable, and this server can also lend an assistant its document tools while the model runs anywhere, which is The MCP Server.

Authentication is the Bearer header on every dialect. Anthropic's default x-api-key header is read for attribution but is deliberately not an authentication channel, so configure Anthropic clients with their auth-token option rather than the api-key option.

2The OpenAI-compatible surface#

Endpoint Purpose
POST /v1/chat/completions Chat, with streaming and structured outputs (JSON schema response format)
POST /v1/completions Plain text completion
POST /v1/embeddings Text embeddings (Embeddings and Reranking)
GET /v1/models The models this server offers, as clients expect to discover them
POST /v1/responses The Responses API: stateful turns, chaining by previous response id, input-item listing (Responses and Vector Stores)
/v1/files Upload and manage files
/v1/vector_stores Create stores and attach files; the file_search tool grounds answers in them (guide)

3The Anthropic-compatible surface#

POST /v1/messages serves the Anthropic Messages API shape: system prompts, multi-turn messages, image content blocks (vision), tool use with tool_choice, and both streaming (SSE) and non-streaming responses. The anthropic-version header is accepted, so unmodified SDKs connect as they are. A model the request names must exist here; the error shapes follow the dialect, so client-side error handling keeps working.

4The Ollama dialect#

/api/chat, /api/generate, /api/embed and /api/embeddings, /api/tags, /api/show, /api/ps, /api/version, /api/pull, /api/create, /api/copy, /api/delete, and blob uploads all answer as an Ollama client expects, including catalog pulls over /api/pull. /api/push is deliberately not supported: this server is not a model registry, and the endpoint says so rather than pretending.

5What to know before relying on it#

  • Compatibility is behavioral, not cosmetic: the surfaces are exercised against real unmodified clients, not just against the published schemas.
  • Requests that name no model use the server's default for the capability (see Choosing and Operating Models); requests that do name one get exactly that model.
  • The engine is local: token streams start when the model starts producing, and throughput follows your hardware, not a remote quota.
  • Per-key isolation applies everywhere: files, vector stores, and response chains belong to the key that created them, on every dialect.
  • The native API remains the richer surface (/lmkit/v1/...): document workflows, Search, and the operator plane have no dialect equivalent, so use the native routes (documented in the API reference) where a dialect has no vocabulary.
  • The deep dives: migrating a fleet of clients, structured outputs, function calling, and images in chat each have their own guide; per-stack connection recipes are Frameworks and SDKs, Local Coding Assistants, and Coming from Ollama.

6Stated plainly#

  • One server, four surfaces (native, OpenAI, Anthropic, Ollama), one model pool, one key model.
  • Bearer authentication everywhere; posture and key rules from Going Live and Keys and Authentication apply unchanged.
  • Anything a dialect cannot express is absent, not approximated: unsupported operations answer honestly instead of half-working.