import type { ChatCompletionMessageParam } from "openai/resources/chat"; export type LLMMessage = ChatCompletionMessageParam; export interface LLMTool { type: "function"; function: { name: string; description: string; parameters: { type: "object"; properties: Record; required: string[]; }; }; } export interface LLMToolCall { id: string; type: "function"; function: { name: string; arguments: string; }; } /** * @deprecated Use WebSearchTool with the Agent Tools API instead. * The search_parameters field is deprecated as of December 15, 2025. */ export interface SearchParameters { mode?: "auto" | "on" | "off"; } export interface WebSearchTool { type: "web_search"; allowed_domains?: string[]; excluded_domains?: string[]; enable_image_understanding?: boolean; user_location?: { type: "approximate"; country?: string; city?: string; region?: string; timezone?: string; }; } export interface SearchOptions { /** @deprecated Use enable_web_search and web_search_filters instead */ search_parameters?: SearchParameters; enable_web_search?: boolean; web_search_filters?: { allowed_domains?: string[]; excluded_domains?: string[]; enable_image_understanding?: boolean; user_location?: { type: "approximate"; country?: string; city?: string; region?: string; timezone?: string; }; }; } export interface LLMResponse { choices: Array<{ message: { role: string; content: string | null; tool_calls?: LLMToolCall[]; }; finish_reason: string; }>; } export declare class LLMClient { private client; private currentModel; private defaultMaxTokens; private backendName; private supportsTools; private supportsVision; private disableReasoningOverride; constructor(apiKey: string, model?: string, baseURL?: string, displayName?: string); setModel(model: string): Promise; private parseModelSuffix; private enableTools; private enableVision; getCurrentModel(): string; getBaseURL(): string; getBackendName(): string; getSupportsTools(): boolean; getSupportsVision(): boolean; setSupportsVision(value: boolean): void; chat(messages: LLMMessage[], tools?: LLMTool[], model?: string, searchOptions?: SearchOptions, temperature?: number, signal?: AbortSignal, maxTokens?: number): Promise; chatStream(messages: LLMMessage[], tools?: LLMTool[], model?: string, searchOptions?: SearchOptions, temperature?: number, signal?: AbortSignal, maxTokens?: number): AsyncGenerator; /** * @deprecated This method uses the deprecated search_parameters API. * * Migrate to using chat() with enable_web_search instead: * * ```typescript * const searchOptions: SearchOptions = { * enable_web_search: true, * web_search_filters: { * allowed_domains: ['example.com'], // optional * excluded_domains: ['spam.com'], // optional * enable_image_understanding: true // optional * } * }; * * await client.chat([{role: "user", content: query}], [], undefined, searchOptions); * ``` * * The search_parameters field was deprecated by Grok API on December 15, 2025. * See: https://docs.x.ai/docs/guides/tools/search-tools */ search(query: string, searchParameters?: SearchParameters): Promise; /** * Returns true if the host part of baseURL matches one of the allowedHosts or a subdomain thereof. */ private isAllowedHost; }