Chat
Generates a chat completion with the native LM-Kit contract: streaming events or one JSON result.#
/lmkit/v1/chatThe 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 ·
| Property | Type | Description |
|---|---|---|
model | string | Catalog model ID; blank uses the server's default chat model. |
system | string | Optional system prompt prepended to the conversation. |
messages | [] | The conversation so far, ending with the user message to answer. Roles: system, user, assistant. |
temperature | object (float) | Sampling temperature. 0 selects greedy decoding. |
top_p | object (float) | Nucleus sampling cutoff: only tokens within this cumulative probability mass are considered. 1 disables the cutoff. |
top_k | object (int32) | Top-K sampling cutoff: only the K most likely tokens are considered. Absent keeps the sampler's default. |
min_p | object (float) | Minimum probability cutoff relative to the most likely token. Absent keeps the sampler's default. |
seed | object (uint32) | Sampling seed for reproducible generation. Absent samples freely. |
max_tokens | object (int32) | Upper bound on the completion length, in tokens. |
n | object (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'. |
logprobs | boolean | true returns the log probability of every generated token (thinking and tool channels included, in generation order) on the terminal summary. |
top_logprobs | object (int32) | 0 to 20: how many of the most likely alternatives to report at each position. A positive value implies logprobs. |
logit_bias | object | 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. |
stop | string[] | Sequences that end the completion when generated. The matched sequence is not included in the answer. |
frequency_penalty | object (float) | Penalizes tokens by how often they already appeared, reducing repetition. 0 disables. |
presence_penalty | object (float) | Penalizes tokens that appeared at all, encouraging new topics. 0 disables. |
repeat_penalty | object (float) | Multiplicative repetition penalty over recent tokens. Absent keeps the sampler's default. |
reasoning | string | 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_tools | string[] | 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_choice | one of object · | |
stream | boolean | true streams server-sent events (status, delta, skill, done, error); false returns one JSON result. |
request_id | string | Optional caller-generated identifier for this exchange, used to address it from side channels (e.g. skip-thinking). |
skill | string | Optional name of a server skill pinned for this exchange: its instructions ride the system turn. |
skills | string[] | 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_inputs | object | Answers to the pinned skill's activation questions, keyed by each question's slug. Unanswered questions fall back to their declared defaults. |
memory | string | Optional agent-memory id: facts extracted from this exchange persist under this id, and facts stored earlier under it are recalled as hidden context. The id is private to the API key's owner (and to the end user named by 'user'): another owner using the same id has a memory of its own. Requires the server's Memory feature; when it is off the exchange proceeds without memory. Letters, digits, dash, and underscore. |
user | string | Optional id of the end user this request is made for, as the calling application knows them (the same field as OpenAI's 'user'). Agent memory is then kept per end user within the API key's owner. The server trusts the authenticated key to state it. |
memory_store | string | 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. |
agent | string | 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. |
agent_revision | object | LM-Kit extension. The revision of the agent this request runs: a published revision number, pinned so later publications do not change its behavior, or "draft" to preview the agent's draft (operators only). Absent runs the live revision. The response names the revision it ran. |
simulate_tools | boolean | LM-Kit extension. true previews the exchange without side effects: server tools that only read run for real, every tool that writes, sends or cannot be undone is answered with a simulated result and never executed, and agent memory is recalled but never taught. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | application/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.#
/lmkit/v1/chat/skip-thinkingAddresses 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. Answers 404 when no exchange with that request_id is streaming on this node for this caller: the exchange ended, it was started under another API key, or on a fleet it streams on the node that started it, so route the skip to that node.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
request_id | string | The request_id the exchange was started with. |
Responses
| Status | Type | Description |
|---|---|---|
| 202 | application/json | Accepted |
| 400 | Bad Request | |
| 401 | Unauthorized | |
| 404 | Not Found |
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"
}'