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

Anthropic · Messages

Generates a message completion using the Anthropic Messages API shape.#

POST/v1/messages

Anthropic-compatible Messages endpoint. Designed to be a drop-in target for clients that use the Anthropic SDK (including Claude Code via ANTHROPIC_BASE_URL). Supports text, vision (image content blocks), tool use, streaming (SSE) and non-streaming responses.

Reference: https://docs.anthropic.com/en/api/messages

Request body

application/json ·

PropertyTypeDescription
modelstring

The model that will complete the prompt. When omitted or empty, the server falls back to its configured default chat model.

messages[]

Input messages. Roles alternate "user" and "assistant". Each may have string or content-block content.

max_tokensobject (int32)

Maximum number of tokens to generate before stopping.

systemobject

System prompt, supplied as a string or an array of system text blocks.

metadataobject

Free-form request metadata. user_id is the canonical field. Stored, not interpreted.

stop_sequencesstring[]

Custom stop sequences. Generation stops when any of these appears in the output.

streamboolean

When true, the response is sent as a server-sent event stream.

temperatureobject (double)

Sampling temperature in [0, 1]. Higher = more random.

top_pobject (double)

Nucleus sampling cutoff. Only sample tokens within the top_p probability mass.

top_kobject (int32)

Only sample from the top K tokens. Currently not honored by the LM-Kit backend (use temperature/top_p).

tools[]

Tools the model may call.

tool_choiceobject

How the model should choose tools. Accepts { "type": "auto" | "any" | "none" | "tool", "name": "..." }.

service_tierstring

Service tier hint. Accepted and stored; not interpreted.

thinking

Extended-thinking configuration: { "type": "enabled", "budget_tokens": N } or { "type": "disabled" }. Disabled turns reasoning off for the request; enabled keeps the model's own reasoning level (the budget rides within max_tokens).

Responses

StatusTypeDescription
200

OK

400

Bad Request

404

Not Found

500application/json

Internal Server Error

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