langchain.js
    Preparing search index...

    Interface ChatXAIResponsesInput

    Input configuration for ChatXAIResponses constructor.

    interface ChatXAIResponsesInput {
        apiKey?: string;
        baseURL?: string;
        maxOutputTokens?: number;
        model?: string;
        reasoning?: XAIResponsesReasoning;
        searchParameters?: XAIResponsesSearchParameters;
        store?: boolean;
        streaming?: boolean;
        temperature?: number;
        tools?: XAIResponsesTool[];
        topP?: number;
        user?: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    apiKey?: string

    The xAI API key to use for requests.

    process.env.XAI_API_KEY
    
    baseURL?: string

    The base URL for the xAI API.

    "https://api.x.ai/v1"
    
    maxOutputTokens?: number

    Maximum number of tokens to generate.

    model?: string

    The name of the model to use.

    "grok-3"
    

    Default reasoning configuration.

    searchParameters?: XAIResponsesSearchParameters

    Default search parameters for xAI's search capabilities.

    store?: boolean

    Whether to store the input messages and response.

    true
    
    streaming?: boolean

    Whether to stream responses.

    false
    
    temperature?: number

    Sampling temperature between 0 and 2.

    1
    

    Default tools to make available to the model. Can be overridden per-request in call options.

    import { ChatXAIResponses, tools } from "@langchain/xai";

    const llm = new ChatXAIResponses({
    model: "grok-4-1-fast",
    tools: [tools.xaiWebSearch(), tools.xaiCodeExecution()],
    });
    topP?: number

    Nucleus sampling probability mass.

    1
    
    user?: string

    A unique identifier representing your end-user.