Anthropic · Messages
Generates a message completion using the Anthropic Messages API shape.#
/v1/messagesAnthropic-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 ·
| Property | Type | Description |
|---|---|---|
model | string | 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_tokens | object (int32) | Maximum number of tokens to generate before stopping. |
system | object | System prompt, supplied as a string or an array of system text blocks. |
metadata | object | Free-form request metadata. user_id is the canonical field. Stored, not interpreted. |
stop_sequences | string[] | Custom stop sequences. Generation stops when any of these appears in the output. |
stream | boolean | When true, the response is sent as a server-sent event stream. |
temperature | object (double) | Sampling temperature in [0, 1]. Higher = more random. |
top_p | object (double) | Nucleus sampling cutoff. Only sample tokens within the top_p probability mass. |
top_k | object (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_choice | object | How the model should choose tools. Accepts { "type": "auto" | "any" | "none" | "tool", "name": "..." }. |
service_tier | string | 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
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 400 | Bad Request | |
| 404 | Not Found | |
| 500 | application/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": {}
}'