import { B as BaseLLMAdapter, C as Capabilities, X as XAIProviderConfig, b as LLMCompletionRequest, c as LLMCompletionResponse } from '../base-adapter-BQZiL4zs.cjs'; /** * xAI (Grok) Provider Adapter * * Implements the unified ILLMProvider interface for xAI's API. * xAI provides an OpenAI-compatible chat completions API at * https://api.x.ai/v1. * * Models: grok-4.3, grok-4.5, grok-build-0.1, grok-4.20-0309-reasoning, * grok-4.20-0309-non-reasoning, grok-4.20-multi-agent-0309. * Default model for HoloScript generation: grok-4.3. * (grok-4.5 launched 2026-07-08 and is the vendor-recommended default * including code; HoloScript KEEPS grok-4.3 as default — the independent * eval ran 2026-07-10 (task 9c9h) and found PARITY (12/12 both models on a * bounded objective suite), so the 1M→500K context drop and 2.4× output * price are not justified by any measured capability gain. grok-4.5 stays * available for explicit opt-in. Receipt: * research/2026-07-10_grok-4.5-vs-4.3-eval-9c9h.md.) * * Model metadata last verified 2026-07-10 via credentialed * /v1/language-models discovery. * Sources: docs.x.ai/developers/models, * docs.x.ai/developers/rest-api-reference/inference/models * * @version 1.2.0 */ declare const XAI_MODELS: readonly ["grok-4.3", "grok-4.5", "grok-build-0.1", "grok-4.20-0309-reasoning", "grok-4.20-0309-non-reasoning", "grok-4.20-multi-agent-0309"]; type XAIModel = (typeof XAI_MODELS)[number]; interface XAIModelCapability { contextWindow: number; /** * xAI does not publish a separate max-output token cap for most models. * 0 means "not published" — treat the context window as the upper bound. */ maxOutput: number; /** Long-context price threshold from /v1/language-models; 0 = none published. */ longContextThreshold: number; costPerMillion: { input: number; /** Input price above longContextThreshold; 0 means same rate / not applicable. */ inputLongContext: number; cachedInput: number; output: number; }; status: 'active'; lastVerified: string; } declare const XAI_MODEL_CAPABILITIES: { readonly 'grok-4.3': { readonly contextWindow: 1000000; readonly maxOutput: 0; readonly longContextThreshold: 200000; readonly costPerMillion: { readonly input: 1.25; readonly inputLongContext: 2.5; readonly cachedInput: 0.2; readonly output: 2.5; }; readonly status: "active"; readonly lastVerified: "2026-07-10"; }; readonly 'grok-4.5': { readonly contextWindow: 500000; readonly maxOutput: 0; readonly longContextThreshold: 200000; readonly costPerMillion: { readonly input: 2; readonly inputLongContext: 4; readonly cachedInput: 0.5; readonly output: 6; }; readonly status: "active"; readonly lastVerified: "2026-07-10"; }; readonly 'grok-build-0.1': { readonly contextWindow: 256000; readonly maxOutput: 0; readonly longContextThreshold: 200000; readonly costPerMillion: { readonly input: 1; readonly inputLongContext: 2; readonly cachedInput: 0.2; readonly output: 2; }; readonly status: "active"; readonly lastVerified: "2026-07-10"; }; readonly 'grok-4.20-0309-reasoning': { readonly contextWindow: 1000000; readonly maxOutput: 0; readonly longContextThreshold: 200000; readonly costPerMillion: { readonly input: 1.25; readonly inputLongContext: 2.5; readonly cachedInput: 0.2; readonly output: 2.5; }; readonly status: "active"; readonly lastVerified: "2026-07-10"; }; readonly 'grok-4.20-0309-non-reasoning': { readonly contextWindow: 1000000; readonly maxOutput: 0; readonly longContextThreshold: 200000; readonly costPerMillion: { readonly input: 1.25; readonly inputLongContext: 2.5; readonly cachedInput: 0.2; readonly output: 2.5; }; readonly status: "active"; readonly lastVerified: "2026-07-10"; }; readonly 'grok-4.20-multi-agent-0309': { readonly contextWindow: 1000000; readonly maxOutput: 0; readonly longContextThreshold: 200000; readonly costPerMillion: { readonly input: 1.25; readonly inputLongContext: 2.5; readonly cachedInput: 0.2; readonly output: 2.5; }; readonly status: "active"; readonly lastVerified: "2026-07-10"; }; }; /** * xAI (Grok) provider adapter for HoloScript. * * @example * ```typescript * const xai = new XAIAdapter({ * apiKey: process.env.XAI_API_KEY!, * }); * * const scene = await xai.generateHoloScript({ * prompt: "a floating island with glowing crystals", * }); * console.log(scene.code); * ``` */ /** * Capability manifest sourced from `docs/LLM_CAPABILITIES.md` * xAI (Grok). Live Search (real-time web + X-platform) is Grok's unique * differentiator vs Anthropic/OpenAI/Gemini for social and news signal. * * Model metadata verified against official xAI docs and credentialed * /v1/language-models discovery on 2026-07-10 (A-020): * - grok-4.3: current HoloScript default chat model, 1M context, * $1.25/$2.50 per MTok. * - grok-4.5: launched 2026-07-08, vendor-recommended default incl. code, * 500K context, $2/$6 per MTok, $0.50/M cached input, reasoning_effort * (low/medium/high, default high), built-in web/X-search/code-execution * tools. NOT the HoloScript default until an independent eval gates it. * - grok-build-0.1: coding model, 256K context, $1.00/$2.00 per MTok. * - grok-4.20-* family: API-visible language models, routed only when * explicitly selected until public context-window docs stop conflicting. * - grok-4-0709 and grok-4-fast-* are absent from credentialed discovery. * xAI's API is OpenAI-compatible at the wire level, so streaming + tools are * confirmed. All Grok 4 variants support text/image input, function calling, * structured outputs, cached-token pricing, and reasoning. * * XAI_CAPABILITIES reflects grok-4.3 (the current default model) per A-020. * Media fields describe the separate Grok Imagine API axis, not complete(). * Exported as a constant so the capability-aware router can read it * without instantiating the adapter: single source of truth per W.GOLD.006. */ declare const XAI_CAPABILITIES: Capabilities; declare class XAIAdapter extends BaseLLMAdapter { readonly name: "xai"; readonly models: readonly ["grok-4.3", "grok-4.5", "grok-build-0.1", "grok-4.20-0309-reasoning", "grok-4.20-0309-non-reasoning", "grok-4.20-multi-agent-0309"]; readonly defaultHoloScriptModel: string; readonly capabilities: Capabilities; constructor(config: XAIProviderConfig); protected getDefaultModel(): string; complete(request: LLMCompletionRequest, model?: string): Promise; private mapFinishReason; private mapXAIError; } export { XAIAdapter, type XAIModel, type XAIModelCapability, XAI_CAPABILITIES, XAI_MODELS, XAI_MODEL_CAPABILITIES };