Skip to navigation

Create Message

View as MarkdownOpen in Claude

Anthropic-compatible Messages. Send a model from GET /v1/models, a max_tokens limit, and a list of messages. Declaring Anthropic’s web_search_* server tool makes the router run You.com web searches and return server_tool_use and web_search_tool_result blocks.

Authentication

AuthorizationBearer

Your You.com API key, sent as Authorization: Bearer <key>. Get a key in the “Get your API key” section of the documentation.

Headers

x-request-idstringOptional

A client-chosen request ID for tracing. The router generates one when the header is absent or invalid, and returns it in the response.

x-session-idstringOptional<=256 characters
A conversation identifier of up to 256 characters. Requests that share a session ID are kept together where possible.
anthropic-versionstringOptional

The Anthropic API version, such as 2023-06-01. Sending this header selects the Anthropic response format.

Request

This endpoint expects an object.
modelstringRequired

A model ID from GET /v1/models.

max_tokensintegerRequired

Maximum tokens to generate. Per-model limits are published as max_tokens in GET /v1/models.

messageslist of objectsRequired
The conversation so far, in Anthropic Messages format.
systemstring or list of maps from strings to anyOptional
A system prompt, as a string or an array of text blocks.
streambooleanOptional

Stream the response as server-sent events.

temperaturedoubleOptional
Sampling temperature. When omitted, the router applies the model vendor's reference value, where one is configured.
top_pdoubleOptional
Nucleus sampling probability. When omitted, the router applies the model vendor's reference value, where one is configured.
top_kintegerOptional
Sample only from the top K tokens.
stop_sequenceslist of stringsOptional
Sequences where the model stops generating.
metadatamap from strings to anyOptional
thinkingmap from strings to anyOptional
Extended thinking configuration.
output_configmap from strings to anyOptional
Output configuration, such as effort and a JSON schema format.
tool_choicemap from strings to anyOptional
How the model uses tools.
toolslist of objectsOptional

Tools the model may call. Declare one Anthropic web_search_* server tool for router-run web search.

Response headers

x-request-idstringOptional
The request ID, echoed from the request or generated by the router.

Response

A message, or a stream of Anthropic server-sent events when stream is true.

idstringOptional
typeenumOptional
Allowed values:
roleenumOptional
Allowed values:
modelstringOptional
contentlist of maps from strings to anyOptional

Content blocks. A web search request adds server_tool_use and web_search_tool_result blocks for each search the router ran.

stop_reasonstring or nullOptional
stop_sequencestring or nullOptional
usageobjectOptional

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
429
Too Many Requests Error
503
Service Unavailable Error