Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Request field map

Rust and the proxy express the same request semantics through different envelopes. Rust uses an OpenAI-shaped serde_json::Value; the proxy groups its portable subset under config and everything else under provider_config.

Availability: Rust: flexible top-level JSON · Proxy/clients: typed compact envelope

Rust engine request

These are the stable, adapter-recognized fields. A field marked “mapped” is renamed or reshaped for the selected provider; unsupported controls are omitted.

FieldTypeClassBehavior
modelstringRoutingRequired; explicit provider/model or a recognized bare prefix
messagesarrayPortableRequired conversation history; translated to native message/content forms
streambooleanPortableSet to true by llmshim::stream; selects native streaming
max_tokensintegerPortable, mappedNative output limit; max_completion_tokens is accepted as an alias
temperaturenumberConditionalSent to Anthropic and Gemini; not copied by the OpenAI/xAI Responses adapters
top_pnumberConditionalSent to Anthropic and Gemini
top_kintegerConditionalSent to Anthropic and Gemini
stoparray of stringsConditional, mappedPassed as stop to Anthropic or mapped to Gemini stopSequences; omitted by OpenAI/xAI
reasoning_effortstringPortable, mapped/clampedUnified effort from none through max
reasoning_modestringPortable, mapped/clampedstandard or pro
toolsarrayPortable, mappedOpenAI Chat Completions function schema translated to native tools
tool_choicestring or objectPortable, mappedTranslated where the provider supports tool choice
x-openaiobjectNative passthroughFields copied to an OpenAI Responses request
x-anthropicobjectNative passthrough/controlAnthropic body fields plus extra_betas and disable_1m_context controls
x-geminiobjectNative passthroughGemini body fields; thinkingConfig goes under generationConfig

There is no x-xai namespace. OpenAI additionally recognizes store, prompt_cache_key, prompt_cache_retention, safety_identifier, and speed. Anthropic recognizes cache_control, thinking, output_config, and speed. Those fields are provider-specific even when they are not wrapped in an x-* namespace.

The request is a Value, so Rust does not reject unknown keys up front. Adapters deliberately select only fields they understand. Do not assume an arbitrary top-level key reaches the provider; use a documented native namespace.

Reasoning values and family-specific clamps are canonicalized in Reasoning controls. Native namespaces and precedence are covered in Native provider controls.

Message fields

FieldTypePurpose
rolestringsystem, developer, user, assistant, or tool semantics
contentstring, array, or nullText and multimodal content blocks
tool_callsarrayAssistant tool requests returned on a previous turn
tool_call_idstringConnects a role: "tool" result to its request
reasoning_contentstringProvider-returned reasoning carried into a later turn

Content blocks may use OpenAI image_url, Anthropic image, or Gemini inline_data input forms. See Images and vision.

Proxy request

FieldTypeClassEngine destination
modelstringRoutingtop-level model
messagesarrayPortabletop-level messages
streambooleanTransportselects SSE only on /v1/chat
configobjectPortablerecognized children become top-level engine controls
provider_configobjectPassthrough containereach child is merged into the engine request
fallbackarray of stringsProxy orchestrationordered non-streaming backup routes; not sent to a provider

The exact config children are:

ChildTypeEngine field
max_tokensunsigned integermax_tokens
temperaturenumbertemperature
top_pnumbertop_p
top_kunsigned integertop_k
stoparray of stringsstop
reasoning_effortstringreasoning_effort
reasoning_modestringreasoning_mode

For example, this proxy fragment:

{
  "config": {"reasoning_effort": "high"},
  "provider_config": {
    "tools": [],
    "x-anthropic": {"disable_1m_context": true}
  }
}

becomes engine fields named reasoning_effort, tools, and x-anthropic. Because provider_config is merged after config, a same-named child there overrides the portable value. Prefer the x-* namespace for an intentional native override; it makes that loss of portability visible.