Skip to content

Interface: XAIMessagesParams

@providerprotocol/ai


@providerprotocol/ai / xai / XAIMessagesParams

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

xAI Messages API parameters (Anthropic-compatible).

These parameters are passed through to the xAI /v1/messages endpoint. The API is compatible with Anthropic’s Messages API, allowing developers migrating from Anthropic to use familiar patterns.

const params: XAIMessagesParams = {
max_tokens: 1000,
temperature: 0.7,
thinking: { type: 'enabled', budget_tokens: 500 }, // Extended thinking
};

optional max_tokens: number

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

Maximum number of tokens to generate


optional metadata: object

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

Metadata for the request

optional user_id: string


optional stop_sequences: string[]

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

Custom stop sequences


optional temperature: number

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

Temperature for randomness (0.0 - 1.0)


optional thinking: object

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

Extended thinking configuration

budget_tokens: number

type: "enabled"


optional tool_choice: object

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

Tool selection strategy.

  • auto: Model decides when to use tools
  • any: Model must use at least one tool
  • tool: Model must use the specific tool named in name

optional name: string

type: "auto" | "tool" | "any"


optional top_k: number

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

Top-k sampling


optional top_p: number

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

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