Anthropic-compatible

Messages

Use the Privatemode messages API to generate text from a prompt via a large language model. The API is compatible with the Anthropic Messages API, so you can use the official Anthropic SDKs by pointing them at your proxy. To generate text, send your requests to the Privatemode proxy. Message requests and responses are encrypted, both in transit and during processing.

POST/v1/messages

Request body

modelstringrequired

The name of a currently available model. Note that models are updated regularly, and support for older models is discontinued over time. Use the models API to list available models.

max_tokensintegerrequired

The maximum number of tokens to generate.

messageslistrequired

The conversation messages for which a response is generated.

Show properties

rolestringrequired

The role of the message author. One of user or assistant.

contentstring or listrequired

The contents of the message.

streambooleandefault: false

Whether to stream the response as a stream of server-sent events, following the Anthropic Messages API streaming format.

systemstring

A system prompt to guide the model's behavior.

Additional parameters mirror the Anthropic API and are supported based on the model server's capabilities.

Returns

The response is a message object.

idstring

Unique identifier for the message.

typestring

Object type, always "message".

rolestring

The role of the generated message, always "assistant".

contentarray

The content blocks generated by the model.

Show properties

typestring

The content block type, e.g. "text".

textstring

The generated text.

modelstring

The model that generated the response.

stop_reasonstring

The reason the model stopped generating, e.g. "end_turn".

usageobject

Token usage statistics.

The messages API doesn't report cache_creation_input_tokens separately. Those tokens are included in input_tokens.

Show properties

input_tokensinteger

The number of input tokens.

output_tokensinteger

The number of generated tokens.