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

Chat

Generates a chat completion with the native LM-Kit contract: streaming events or one JSON result.#

POST/lmkit/v1/chat

The caller carries the transcript and the server answers the trailing user message. Server skills ride as first-class fields: 'skill' pins one skill's instructions onto the system turn (its activation questions answered through 'skill_inputs'), and 'skills' offers a set to the model through function calling. 'server_tools' names built-in tools the SERVER executes mid-exchange (web search, calculation, date/time, unit conversion), governed by the server's Tools policy. 'n' generates several alternatives in one exchange, 'logprobs'/'top_logprobs' report per-token probabilities, and 'logit_bias' steers individual tokens by id or by text chunk.

Response modes:

stream: false (default): one JSON object {result, thinking?, skill_events?} where result is the terminal summary below.

stream: true: a text/event-stream of named SSE events:

Event Payload Meaning
status {phase: downloading\|loading\|session\|prompt, pct?, done?, total?} Model preparation, narrated honestly (download progress, cold load, pool attach, prompt read)
delta {t: thinking\|text\|tool, d, i?} Decode fragments by channel: reasoning, the visible answer, tool traffic; i names the alternative when n > 1
skill {name, status: active\|missing\|activated\|resource, context?, resource?} Skill use as it happens
tool_call {id, name, arguments} The model called a client-dispatched tool
tool_use {name, status: running\|done\|error\|denied, args?, secs?, result?, sources?} A server-executed tool's lifecycle; web search reports its hits as sources
done {text, model, tokens, rate, prompt_tokens, prompt_secs, gen_secs, reason, ctx, ctx_max, tool_calls?, logprobs?, choices?} The terminal summary
error {error} The exchange failed

Authentication follows the server's API surface (API key, or open when anonymous access is enabled); the admin session and a public playground also pass, which is how the playground itself rides this route.

Request body

application/json ·

PropertyTypeDescription
modelstring

Catalog model ID; blank uses the server's default chat model.

systemstring

Optional system prompt prepended to the conversation.

messages[]

The conversation so far, ending with the user message to answer. Roles: system, user, assistant.

temperatureobject (float)

Sampling temperature. 0 selects greedy decoding.

top_pobject (float)

Nucleus sampling cutoff: only tokens within this cumulative probability mass are considered. 1 disables the cutoff.

top_kobject (int32)

Top-K sampling cutoff: only the K most likely tokens are considered. Absent keeps the sampler's default.

min_pobject (float)

Minimum probability cutoff relative to the most likely token. Absent keeps the sampler's default.

seedobject (uint32)

Sampling seed for reproducible generation. Absent samples freely.

max_tokensobject (int32)

Upper bound on the completion length, in tokens.

nobject (int32)

How many alternative completions to generate: 1 (default) to 8. Alternatives decode sequentially over one prompt read; with a seed, alternative i samples from seed + i (replay is best-effort, as for any seeded pooled decode). Not combinable with tools or model-driven skills. Streaming deltas carry the alternative's index as 'i', and the terminal summary lists every alternative under 'choices'.

logprobsboolean

true returns the log probability of every generated token (thinking and tool channels included, in generation order) on the terminal summary.

top_logprobsobject (int32)

0 to 20: how many of the most likely alternatives to report at each position. A positive value implies logprobs.

logit_biasobject

Per-token sampling bias, -100 (never) to 100 (always): keys are token ids ("8264") or plain text chunks ("Paris"), which the server maps onto the model's own vocabulary. The bias adds to the token's raw logit at every position.

stopstring[]

Sequences that end the completion when generated. The matched sequence is not included in the answer.

frequency_penaltyobject (float)

Penalizes tokens by how often they already appeared, reducing repetition. 0 disables.

presence_penaltyobject (float)

Penalizes tokens that appeared at all, encouraging new topics. 0 disables.

repeat_penaltyobject (float)

Multiplicative repetition penalty over recent tokens. Absent keeps the sampler's default.

reasoningstring

Reasoning effort for models with a thinking channel: none, low, medium, or high. 'none' disables thinking; absent keeps the model's default.

response_format

Constrains the answer's shape: {type: 'text' | 'json_object'} or {type: 'json_schema', json_schema: {schema: }}. JSON modes are grammar-enforced during decoding, so a non-conforming answer cannot be produced.

tools[]

Client-dispatched tools the model may call: name, description, and a JSON Schema for the arguments. A call ends the exchange with reason 'tool_calls'; send each result back as a 'tool' role message to continue.

server_toolsstring[]

Server-executed built-in tools the model may use, by name (e.g. web_search, calc_arithmetic): the server runs the tool and the exchange continues with its result. Only tools the server's Tools policy enables actually run; anything else is narrated as denied. Tool use streams as tool_use events and is summarized on the result as tool_events.

tool_choiceone of object ·
streamboolean

true streams server-sent events (status, delta, skill, done, error); false returns one JSON result.

request_idstring

Optional caller-generated identifier for this exchange, used to address it from side channels (e.g. skip-thinking).

skillstring

Optional name of a server skill pinned for this exchange: its instructions ride the system turn.

skillsstring[]

Server skill names the model may discover and activate on its own through function calling. Empty or absent disables model-driven skills for this exchange.

skill_inputsobject

Answers to the pinned skill's activation questions, keyed by each question's slug. Unanswered questions fall back to their declared defaults.

memorystring

Optional agent-memory id: facts extracted from this exchange persist on the server under this id, and facts stored earlier under it are recalled as hidden context. Requires the server's Memory feature; when it is off the exchange proceeds without memory. Letters, digits, dash, and underscore.

memory_storestring

Optional name of the memory STORE the memory id lives under: a server-defined policy bundle (recall depth, capacity, eviction, decay, extraction behavior). Absent uses the agent's store when an agent rides the request, else the default store.

agentstring

Optional name of a server-defined agent: a reusable bundle (system prompt, skill, tools, memory intent) this exchange adopts. The bundle supplies defaults; any field the request states explicitly wins. A memory-intent bundle defaults 'memory' to the agent's own shared store, so the agent remembers across conversations unless the request scopes recall itself. An unknown name is a named refusal.

Responses

StatusTypeDescription
200application/json

OK

400

Bad Request

401

Unauthorized

404

Not Found

curl -X POST "$LMKIT_ONE_URL/lmkit/v1/chat" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "string",
  "system": "string",
  "messages": [
    {
      "role": "string",
      "content": "string",
      "images": [
        "string"
      ],
      "files": [
        {}
      ]
    }
  ],
  "temperature": "string"
}'

Ends the thinking phase of a running chat exchange; the answer continues.#

POST/lmkit/v1/chat/skip-thinking

Addresses the exchange by the request_id it was started with. The model closes its reasoning and begins the user-visible answer immediately; generation itself is not interrupted. No effect once the visible answer has started.

Request body

application/json ·

PropertyTypeDescription
request_idstring

The request_id the exchange was started with.

Responses

StatusTypeDescription
202application/json

Accepted

400

Bad Request

401

Unauthorized

curl -X POST "$LMKIT_ONE_URL/lmkit/v1/chat/skip-thinking" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": "string"
}'