LM-Kit OneDocs2026.8.10lm-kit.com
API Compatibility

Ollama · Chat

Generates a chat completion using the Ollama chat API shape.#

POST/api/chat

Ollama-compatible chat endpoint. Designed to be a drop-in target for clients that speak the Ollama API (Open WebUI, JetBrains AI Assistant, the official Ollama SDKs, ...). Supports text, vision (base64 images), tool calling, structured output via the format field, and both streaming (newline-delimited JSON) and non-streaming responses. Streaming is the default, matching Ollama.

An empty message list preloads the model without generating; combined with keep_alive: 0 it unloads the model. Other keep_alive values are accepted but standing residency is governed by the server's memory-pressure policy.

Reference: https://docs.ollama.com/api#generate-a-chat-completion

Request body

application/json ·

PropertyTypeDescription
modelstring

The model identifier (e.g. "gemma3:4b"). If not specified, the server's default chat model is used.

messages[]

The messages of the conversation so far. An empty list preloads the model (or unloads it when keep_alive is 0) without generating.

tools[]

Tools the model may call.

formatone of object ·
options

Runtime options (temperature, num_ctx, stop, ...).

streamboolean

Whether to stream the response as newline-delimited JSON. Defaults to true.

keep_aliveone of object ·
thinkone of object ·

Responses

StatusTypeDescription
200

OK

400

Bad Request

404

Not Found

500application/json

Internal Server Error

curl -X POST "$LMKIT_ONE_URL/api/chat" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "string",
  "messages": [
    {
      "role": "string",
      "content": "string",
      "thinking": "string",
      "images": [
        "string"
      ]
    }
  ],
  "tools": [
    {
      "type": "string",
      "function": {
        "name": "string",
        "description": "string",
        "parameters": {}
      }
    }
  ],
  "options": {
    "num_ctx": "string",
    "num_predict": "string",
    "temperature": "string",
    "top_p": "string"
  }
}'