v1

latestOpenAPI 3.0.02026-07-1741634.0 KB
Inference

Create a message

Generates a response based on input messages. Streaming mode is supported. This endpoint follows the Anthropic Messages API specification and is compatible with Claude models.

post/messages

Request body

modelstring required

The unique identifier of the Claude model to use (e.g., claude-3-5-sonnet-20241022, claude-3-opus-20240229).

max_tokensinteger

The maximum number of tokens to generate in the completion.

systemstring

Optional system instructions that guide the model's behavior.

temperaturenumber

Adjusts randomness of the output (0.0 - 1.0).

top_pnumber

Nucleus sampling cutoff (0.0 - 1.0).

top_kinteger

Restricts sampling to the K most probable tokens.

stop_sequencesstring[]

Stop sequences – generation stops before emitting any of these strings.

streamboolean

If true, the server streams tokens as they are generated.

anthropic_versionstring

The version of the Anthropic API to use.

Response

Message creation result

idstring required

A unique identifier for the message.

type'message' required

The type of the response.

role'assistant' required

The role of the assistant.

stop_reasonstring required

The reason the generation stopped.

stop_sequencestring

The specific stop sequence that was encountered.

modelstring required

The model used for generation.

cache_controlobject

Optional cache control information.

billingobject

Optional billing information.