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

Ollama · Generate

Generates a completion for a single prompt using the Ollama generate API shape.#

POST/api/generate

Ollama-compatible generate endpoint: one prompt in, one completion out, with optional system message, base64 images, structured output via the format field, and streaming (newline-delimited JSON) or non-streaming responses. Streaming is the default, matching Ollama.

An empty prompt preloads the model without generating; combined with keep_alive: 0 it unloads the model. The raw, suffix, template and context fields are not supported and are rejected with a clear error; use /api/chat for multi-turn conversations.

Reference: https://docs.ollama.com/api#generate-a-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.

promptstring

The prompt to complete. An empty prompt preloads the model (or unloads it when keep_alive is 0) without generating.

suffixstring

Text after the insertion point (fill-in-the-middle). Not supported by this server.

systemstring

System message applied to the request.

templatestring

Custom prompt template override. Not supported by this server.

contextobject (int64)[]

Deprecated per-conversation state from a previous generate response. Not supported by this server; use /api/chat for multi-turn conversations.

imagesstring[]

Base64-encoded images attached to the prompt (multimodal models).

formatone of object ·
options

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

streamboolean

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

rawboolean

Bypass prompt templating. Not supported by this server.

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/generate" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "string",
  "prompt": "string",
  "suffix": "string",
  "system": "string"
}'