Interface: XAIResponsesParams
@providerprotocol/ai / xai / XAIResponsesParams
Interface: XAIResponsesParams
Section titled “Interface: XAIResponsesParams”Defined in: src/providers/xai/types.ts:99
xAI Responses API parameters (OpenAI Responses-compatible).
These parameters are passed through to the xAI /v1/responses endpoint.
The Responses API provides stateful conversation support with features like
previous_response_id for continuing conversations across requests.
Example
Section titled “Example”const params: XAIResponsesParams = { max_output_tokens: 1000, temperature: 0.7, store: true, // Enable stateful storage previous_response_id: 'resp_123...', // Continue previous conversation};- XAICompletionsParams for Chat Completions API parameters
- XAIMessagesParams for Messages API parameters
Properties
Section titled “Properties”include?
Section titled “include?”
optionalinclude:string[]
Defined in: src/providers/xai/types.ts:123
Fields to include in output
max_output_tokens?
Section titled “max_output_tokens?”
optionalmax_output_tokens:number
Defined in: src/providers/xai/types.ts:101
Maximum output tokens
max_turns?
Section titled “max_turns?”
optionalmax_turns:number
Defined in: src/providers/xai/types.ts:171
Maximum agent reasoning turns. Limits the number of assistant turns, not individual tool calls.
metadata?
Section titled “metadata?”
optionalmetadata:Record<string,string>
Defined in: src/providers/xai/types.ts:135
Metadata key-value pairs
parallel_tool_calls?
Section titled “parallel_tool_calls?”
optionalparallel_tool_calls:boolean
Defined in: src/providers/xai/types.ts:110
Whether to enable parallel tool calls
previous_response_id?
Section titled “previous_response_id?”
optionalprevious_response_id:string
Defined in: src/providers/xai/types.ts:126
Continue from a previous response
reasoning?
Section titled “reasoning?”
optionalreasoning:object
Defined in: src/providers/xai/types.ts:113
Reasoning configuration
effort?
Section titled “effort?”
optionaleffort:"low"|"high"
encrypted_content?
Section titled “encrypted_content?”
optionalencrypted_content:boolean
Include encrypted reasoning content for continuation
store?
Section titled “store?”
optionalstore:boolean
Defined in: src/providers/xai/types.ts:129
Store response for continuation
store_messages?
Section titled “store_messages?”
optionalstore_messages:boolean
Defined in: src/providers/xai/types.ts:132
Store messages on xAI servers (default: true)
temperature?
Section titled “temperature?”
optionaltemperature:number
Defined in: src/providers/xai/types.ts:104
Temperature for randomness (0.0 - 2.0)
tools?
Section titled “tools?”
optionaltools:XAIBuiltInTool[]
Defined in: src/providers/xai/types.ts:165
Built-in agentic tools for server-side execution.
Use the tool helper constructors from the tools namespace:
tools.webSearch()- Web search capabilitytools.xSearch()- X (Twitter) search capabilitytools.codeExecution()- Python code executiontools.fileSearch()- Document/collections searchtools.mcp()- Remote MCP server connection
Note: Only available via the Responses API (api: 'responses').
Example
Section titled “Example”import { xai, tools } from 'provider-protocol/xai';
const model = llm({ model: xai('grok-4-1-fast', { api: 'responses' }), params: { tools: [ tools.webSearch(), tools.xSearch({ from_date: '2025-01-01' }), tools.codeExecution(), ], },});top_p?
Section titled “top_p?”
optionaltop_p:number
Defined in: src/providers/xai/types.ts:107
Top-p (nucleus) sampling (0.0 - 1.0)
truncation?
Section titled “truncation?”
optionaltruncation:"auto"|"disabled"
Defined in: src/providers/xai/types.ts:120
Truncation strategy