LLM Requests¶
This reference covers request fields and the built-in provider mappings. For the integration flow and a construction example, read LLM-Related Protocols. For the reply, continue to Responses and Streams.
Request envelope¶
An algorithm receives Request. Its llm_request contains the conversation;
the remaining envelope data belongs to the application.
| Field and type | Meaning |
|---|---|
Request.llm_request: LlmRequest |
The conversation and settings used by the algorithm and model client. |
Request.metadata: Option<Metadata> |
Optional session, correlation, and routing metadata. |
Request.raw_request: Option<Value> |
An optional original body retained by the host. Translation codecs do not read this field. |
Codec replay uses LlmRequest.preservation, separately from the envelope's raw
body. See preservation and edits
before changing a decoded request.
Conversation fields¶
These mappings describe the built-in codecs. Supported features also depend on the destination model. Select a Rust field or type for its full crate definition.
| Protocol field and type | Meaning | Anthropic Messages | OpenAI Responses | Chat Completions |
|---|---|---|---|---|
LlmRequest.model: Option<String> |
Addressed model; the host can replace it with the selected target. | model |
model |
model |
LlmRequest.instructions: Vec<InstructionBlock> |
System and developer instructions. | Top-level system; no distinct developer authority |
instructions and system/developer messages in input |
System/developer messages in messages |
LlmRequest.messages: Vec<Message> |
Ordered turns, each with a role and content blocks. | messages[] |
Messages and tool items in input |
messages[] |
LlmRequest.tools: Vec<Tool> |
Available functions, MCP toolsets, or retained provider definitions. | tools[] |
tools[] |
tools[]; function definitions are nested in function |
LlmRequest.tool_choice: Option<ToolChoice> |
Let the model choose, require a call, forbid calls, or select a named tool. | auto, any, none, or tool |
auto, required, none, or function |
auto, required, none, or function |
LlmRequest.stream: bool |
Request incremental output. | stream |
stream |
stream |
LlmRequest.extensions: ProviderExtensions |
Provider fields without a first-class neutral field. | Source fields retained by the codec | Source fields retained by the codec | Source fields retained by the codec |
LlmRequest.preservation: PreservationMetadata |
Original JSON used for same-format replay. | Original parsed body | Original parsed body | Original parsed body |
Messages and tool content¶
Message.role is a Role; Message.content is an ordered Vec<ContentBlock>.
The content variants cover text, reasoning, media, tools, MCP activity, refusals,
and unknown provider blocks. An unknown block retains its source format and raw
JSON. Its retention does not make it usable in a different API.
| Protocol field and type | Meaning | Anthropic Messages | OpenAI Responses | Chat Completions |
|---|---|---|---|---|
ToolDefinition.parameters: Value |
JSON Schema for function arguments. | input_schema |
Function parameters |
tools[].function.parameters |
ToolCall.id: String |
Identifier that pairs a call with its result. | tool_use.id |
function_call.call_id |
tool_calls[].id |
ToolCall.name: String |
Function name. | tool_use.name |
function_call.name |
tool_calls[].function.name |
ToolCall.arguments: Value |
Parsed argument value. | JSON-valued input |
arguments, commonly a JSON-encoded string |
function.arguments, commonly a JSON-encoded string |
ToolResult.tool_call_id: String |
Identifier of the call being answered. | tool_result.tool_use_id |
function_call_output.call_id |
Tool message tool_call_id |
ToolResult.content: Vec<ContentBlock> |
Ordered tool output. | tool_result.content |
function_call_output.output |
Tool message content |
ToolResult.is_error: Option<bool> |
Whether tool execution failed, if reported. | tool_result.is_error |
No dedicated error flag | No standard error flag |
Tool definitions describe available work. A ToolCall records a model's request
to execute that work; it does not execute the tool. Keep call IDs and content
order intact when writing an adapter.
Tool::Provider retains an unsupported tool definition for its source format.
Built-in provider tools and reasoning signatures may have no valid counterpart
in another API. Consult the translation limits
instead of assuming a successful parse implies cross-provider support.
Generation settings¶
The request groups these fields in SamplingParams, OutputParams, and
ReasoningParams. Optional values remain unspecified when absent; individual
providers apply their own defaults and accepted ranges.
| Protocol field and type | Meaning | Anthropic Messages | OpenAI Responses | Chat Completions |
|---|---|---|---|---|
SamplingParams.temperature: Option<f64> |
Sampling temperature. | temperature |
temperature |
temperature |
SamplingParams.top_p: Option<f64> |
Nucleus-sampling probability mass. | top_p |
top_p |
top_p |
SamplingParams.top_k: Option<i64> |
Maximum candidate-token count. | top_k |
No standard field | No standard field |
OutputParams.max_output_tokens: Option<u64> |
Output token budget. | max_tokens |
max_output_tokens |
max_completion_tokens, or legacy max_tokens |
OutputParams.response_format: Option<Value> |
Requested structured-output shape. | output_config.format |
text.format |
response_format |
OutputParams.is_schema_enforced: Option<bool> |
Override whether the provider must enforce the schema; absence retains native behavior. | Schema-backed output configuration | Schema strictness in text.format |
Schema strictness in response_format |
ReasoningParams.effort: Option<String> |
Requested reasoning effort. | output_config.effort |
reasoning.effort |
reasoning_effort |
ReasoningParams.raw: Option<Value> |
Provider-specific reasoning configuration. | thinking controls |
reasoning object |
No standard equivalent for the whole object |
Preserved same-format bodies take precedence over edits to these settings, including schema enforcement. See encoding an edited request.
Provider contracts¶
For complete provider schemas, see Anthropic Messages, OpenAI Responses, and Chat Completions. For response fields and event ownership, continue to Responses and Streams.