Skip to content

Interface: XAIResponsesParams

@providerprotocol/ai


@providerprotocol/ai / xai / 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.

const params: XAIResponsesParams = {
max_output_tokens: 1000,
temperature: 0.7,
store: true, // Enable stateful storage
previous_response_id: 'resp_123...', // Continue previous conversation
};

optional include: string[]

Defined in: src/providers/xai/types.ts:123

Fields to include in output


optional max_output_tokens: number

Defined in: src/providers/xai/types.ts:101

Maximum output tokens


optional max_turns: number

Defined in: src/providers/xai/types.ts:171

Maximum agent reasoning turns. Limits the number of assistant turns, not individual tool calls.


optional metadata: Record<string, string>

Defined in: src/providers/xai/types.ts:135

Metadata key-value pairs


optional parallel_tool_calls: boolean

Defined in: src/providers/xai/types.ts:110

Whether to enable parallel tool calls


optional previous_response_id: string

Defined in: src/providers/xai/types.ts:126

Continue from a previous response


optional reasoning: object

Defined in: src/providers/xai/types.ts:113

Reasoning configuration

optional effort: "low" | "high"

optional encrypted_content: boolean

Include encrypted reasoning content for continuation


optional store: boolean

Defined in: src/providers/xai/types.ts:129

Store response for continuation


optional store_messages: boolean

Defined in: src/providers/xai/types.ts:132

Store messages on xAI servers (default: true)


optional temperature: number

Defined in: src/providers/xai/types.ts:104

Temperature for randomness (0.0 - 2.0)


optional tools: 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 capability
  • tools.xSearch() - X (Twitter) search capability
  • tools.codeExecution() - Python code execution
  • tools.fileSearch() - Document/collections search
  • tools.mcp() - Remote MCP server connection

Note: Only available via the Responses API (api: 'responses').

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(),
],
},
});

optional top_p: number

Defined in: src/providers/xai/types.ts:107

Top-p (nucleus) sampling (0.0 - 1.0)


optional truncation: "auto" | "disabled"

Defined in: src/providers/xai/types.ts:120

Truncation strategy