@gullabs/xai 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/dist/index.cjs +464 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +293 -7
- package/dist/index.d.ts +293 -7
- package/dist/index.js +465 -41
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -12,9 +12,29 @@ import { z } from 'zod';
|
|
|
12
12
|
*
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
|
+
type XaiWebSearchTool = {
|
|
16
|
+
type: 'web_search';
|
|
17
|
+
allowedDomains?: string[];
|
|
18
|
+
excludedDomains?: string[];
|
|
19
|
+
enableImageUnderstanding?: boolean;
|
|
20
|
+
enableImageSearch?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type XaiXSearchTool = {
|
|
23
|
+
type: 'x_search';
|
|
24
|
+
allowedXHandles?: string[];
|
|
25
|
+
excludedXHandles?: string[];
|
|
26
|
+
fromDate?: string;
|
|
27
|
+
toDate?: string;
|
|
28
|
+
enableImageUnderstanding?: boolean;
|
|
29
|
+
enableVideoUnderstanding?: boolean;
|
|
30
|
+
};
|
|
15
31
|
type XaiProviderOptions = {
|
|
16
32
|
/** xAI conversation-routing cache key — maps to Responses API `prompt_cache_key`. */
|
|
17
33
|
promptCacheKey?: string;
|
|
34
|
+
/** Server-side Live Search tools (`web_search`, `x_search`). */
|
|
35
|
+
tools?: Array<XaiWebSearchTool | XaiXSearchTool>;
|
|
36
|
+
/** xAI-only; Gemini has no parallel-tool knob. */
|
|
37
|
+
parallelToolCalls?: boolean;
|
|
18
38
|
};
|
|
19
39
|
declare module '@gullabs/core' {
|
|
20
40
|
interface ProviderOptionsMap {
|
|
@@ -73,6 +93,20 @@ interface XaiInputItem {
|
|
|
73
93
|
role: 'user' | 'assistant' | 'system' | 'developer';
|
|
74
94
|
content: XaiInputContentPart[];
|
|
75
95
|
}
|
|
96
|
+
/** Live-verified store:false replay item. */
|
|
97
|
+
interface XaiFunctionCallInputItem {
|
|
98
|
+
type: 'function_call';
|
|
99
|
+
call_id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
arguments: string;
|
|
102
|
+
}
|
|
103
|
+
/** Live-verified store:false replay item. */
|
|
104
|
+
interface XaiFunctionCallOutputInputItem {
|
|
105
|
+
type: 'function_call_output';
|
|
106
|
+
call_id: string;
|
|
107
|
+
output: string;
|
|
108
|
+
}
|
|
109
|
+
type XaiRequestInputItem = XaiInputItem | XaiFunctionCallInputItem | XaiFunctionCallOutputInputItem;
|
|
76
110
|
/**
|
|
77
111
|
* Structured-output text-format request shape.
|
|
78
112
|
* Real xAI field: `text.format`, NOT `response_format`.
|
|
@@ -96,7 +130,7 @@ type XaiTextFormat = {
|
|
|
96
130
|
*/
|
|
97
131
|
interface XaiResponseCreateParams {
|
|
98
132
|
model: string;
|
|
99
|
-
input:
|
|
133
|
+
input: XaiRequestInputItem[];
|
|
100
134
|
instructions?: string;
|
|
101
135
|
reasoning?: {
|
|
102
136
|
effort: 'low' | 'medium' | 'high' | 'xhigh';
|
|
@@ -115,6 +149,17 @@ interface XaiResponseCreateParams {
|
|
|
115
149
|
service_tier?: 'priority';
|
|
116
150
|
/** Always `false` — this library never relies on xAI-side conversation storage. */
|
|
117
151
|
store: false;
|
|
152
|
+
/**
|
|
153
|
+
* Server-side and/or function tools. Wire names are snake_case.
|
|
154
|
+
* Shape is pinned from live 2026-08-24 fixtures.
|
|
155
|
+
*/
|
|
156
|
+
tools?: Array<Record<string, unknown>>;
|
|
157
|
+
/** `'auto' | 'required' | 'none'` or live-verified `{ type: 'function', name }`. */
|
|
158
|
+
tool_choice?: string | {
|
|
159
|
+
type: 'function';
|
|
160
|
+
name: string;
|
|
161
|
+
};
|
|
162
|
+
parallel_tool_calls?: boolean;
|
|
118
163
|
}
|
|
119
164
|
/** A single summary-text segment of a `type: 'reasoning'` output item. */
|
|
120
165
|
interface XaiReasoningSummaryPart {
|
|
@@ -143,8 +188,13 @@ interface XaiMessageOutputItem {
|
|
|
143
188
|
status?: string;
|
|
144
189
|
content: XaiOutputTextPart[];
|
|
145
190
|
}
|
|
191
|
+
/** Server-tool or function-call output items we do not collapse as messages. */
|
|
192
|
+
interface XaiOtherOutputItem {
|
|
193
|
+
type: string;
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
146
196
|
/** Union of output-item shapes the Responses API may return. */
|
|
147
|
-
type XaiOutputItem = XaiReasoningOutputItem | XaiMessageOutputItem;
|
|
197
|
+
type XaiOutputItem = XaiReasoningOutputItem | XaiMessageOutputItem | XaiOtherOutputItem;
|
|
148
198
|
/**
|
|
149
199
|
* Token usage metadata returned alongside an xAI response.
|
|
150
200
|
*
|
|
@@ -200,6 +250,12 @@ interface XaiResponseShape {
|
|
|
200
250
|
metadata?: {
|
|
201
251
|
[key: string]: unknown;
|
|
202
252
|
} | null;
|
|
253
|
+
/**
|
|
254
|
+
* Top-level citations array. Live 2026-08-24 search-tools probes returned
|
|
255
|
+
* `null`; citations arrived as `output_text.annotations` of type
|
|
256
|
+
* `url_citation` instead.
|
|
257
|
+
*/
|
|
258
|
+
citations?: unknown;
|
|
203
259
|
}
|
|
204
260
|
/**
|
|
205
261
|
* Structural interface for the `openai` SDK's `client.responses` surface
|
|
@@ -275,6 +331,12 @@ interface XaiAdapterOptions {
|
|
|
275
331
|
* Never set this in production code. Mirrors `GeminiAdapterOptions._clientFactory`.
|
|
276
332
|
*/
|
|
277
333
|
_clientFactory?: (auth: AuthMaterial) => XaiClientLike | Promise<XaiClientLike>;
|
|
334
|
+
/**
|
|
335
|
+
* @internal Testing-only.
|
|
336
|
+
*
|
|
337
|
+
* Override `fetch` for `POST /v1/tokenize-text` (not on the openai SDK).
|
|
338
|
+
*/
|
|
339
|
+
_fetch?: typeof fetch;
|
|
278
340
|
}
|
|
279
341
|
/**
|
|
280
342
|
* Create an xAI Grok provider adapter (Responses API).
|
|
@@ -428,7 +490,8 @@ declare class XaiFileStore {
|
|
|
428
490
|
* Mirrors `@gullabs/core`'s `packages/core/src/model-config/*.ts` doc-density
|
|
429
491
|
* style, but is a single self-contained `z.strictObject` — unlike Gemini's
|
|
430
492
|
* schemas, xai has no service-tier branching (no `z.union` of tier variants
|
|
431
|
-
* needed), no `topK`, and
|
|
493
|
+
* needed), no `topK`, and a reasoning-effort union of `'low'|'medium'|'high'`
|
|
494
|
+
* (live-verified 2026-08-24).
|
|
432
495
|
*
|
|
433
496
|
* @module
|
|
434
497
|
*/
|
|
@@ -440,6 +503,7 @@ declare const Grok45ConfigSchema: z.ZodObject<{
|
|
|
440
503
|
reasoning: z.ZodOptional<z.ZodObject<{
|
|
441
504
|
effort: z.ZodEnum<{
|
|
442
505
|
low: "low";
|
|
506
|
+
medium: "medium";
|
|
443
507
|
high: "high";
|
|
444
508
|
}>;
|
|
445
509
|
}, z.core.$strict>>;
|
|
@@ -447,6 +511,110 @@ declare const Grok45ConfigSchema: z.ZodObject<{
|
|
|
447
511
|
providerOptions: z.ZodOptional<z.ZodObject<{
|
|
448
512
|
xai: z.ZodOptional<z.ZodObject<{
|
|
449
513
|
promptCacheKey: z.ZodOptional<z.ZodString>;
|
|
514
|
+
tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
|
|
515
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
516
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
517
|
+
type: z.ZodLiteral<"web_search">;
|
|
518
|
+
allowedDomains: z.ZodArray<z.ZodString>;
|
|
519
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
520
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
521
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
522
|
+
type: z.ZodLiteral<"web_search">;
|
|
523
|
+
excludedDomains: z.ZodArray<z.ZodString>;
|
|
524
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
525
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
526
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
527
|
+
type: z.ZodLiteral<"web_search">;
|
|
528
|
+
}, z.core.$strict>]>], null>, z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
|
|
529
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
530
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
531
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
532
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
533
|
+
type: z.ZodLiteral<"x_search">;
|
|
534
|
+
allowedXHandles: z.ZodArray<z.ZodString>;
|
|
535
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
536
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
537
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
538
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
539
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
540
|
+
type: z.ZodLiteral<"x_search">;
|
|
541
|
+
excludedXHandles: z.ZodArray<z.ZodString>;
|
|
542
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
543
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
544
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
545
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
546
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
547
|
+
type: z.ZodLiteral<"x_search">;
|
|
548
|
+
}, z.core.$strict>]>], null>, z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
|
|
549
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
550
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
551
|
+
type: z.ZodLiteral<"web_search">;
|
|
552
|
+
allowedDomains: z.ZodArray<z.ZodString>;
|
|
553
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
554
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
555
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
556
|
+
type: z.ZodLiteral<"web_search">;
|
|
557
|
+
excludedDomains: z.ZodArray<z.ZodString>;
|
|
558
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
559
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
560
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
561
|
+
type: z.ZodLiteral<"web_search">;
|
|
562
|
+
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
563
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
564
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
565
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
566
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
567
|
+
type: z.ZodLiteral<"x_search">;
|
|
568
|
+
allowedXHandles: z.ZodArray<z.ZodString>;
|
|
569
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
570
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
571
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
572
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
573
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
574
|
+
type: z.ZodLiteral<"x_search">;
|
|
575
|
+
excludedXHandles: z.ZodArray<z.ZodString>;
|
|
576
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
577
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
578
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
579
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
580
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
581
|
+
type: z.ZodLiteral<"x_search">;
|
|
582
|
+
}, z.core.$strict>]>], null>, z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
|
|
583
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
584
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
585
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
586
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
587
|
+
type: z.ZodLiteral<"x_search">;
|
|
588
|
+
allowedXHandles: z.ZodArray<z.ZodString>;
|
|
589
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
590
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
591
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
592
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
593
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
594
|
+
type: z.ZodLiteral<"x_search">;
|
|
595
|
+
excludedXHandles: z.ZodArray<z.ZodString>;
|
|
596
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
597
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
598
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
599
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
600
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
601
|
+
type: z.ZodLiteral<"x_search">;
|
|
602
|
+
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
603
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
604
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
605
|
+
type: z.ZodLiteral<"web_search">;
|
|
606
|
+
allowedDomains: z.ZodArray<z.ZodString>;
|
|
607
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
608
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
609
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
610
|
+
type: z.ZodLiteral<"web_search">;
|
|
611
|
+
excludedDomains: z.ZodArray<z.ZodString>;
|
|
612
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
613
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
614
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
615
|
+
type: z.ZodLiteral<"web_search">;
|
|
616
|
+
}, z.core.$strict>]>], null>]>>;
|
|
617
|
+
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
450
618
|
}, z.core.$strict>>;
|
|
451
619
|
}, z.core.$strict>>;
|
|
452
620
|
}, z.core.$strict>;
|
|
@@ -480,6 +648,110 @@ declare const Grok46ConfigSchema: z.ZodObject<{
|
|
|
480
648
|
providerOptions: z.ZodOptional<z.ZodObject<{
|
|
481
649
|
xai: z.ZodOptional<z.ZodObject<{
|
|
482
650
|
promptCacheKey: z.ZodOptional<z.ZodString>;
|
|
651
|
+
tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
|
|
652
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
653
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
654
|
+
type: z.ZodLiteral<"web_search">;
|
|
655
|
+
allowedDomains: z.ZodArray<z.ZodString>;
|
|
656
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
657
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
658
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
659
|
+
type: z.ZodLiteral<"web_search">;
|
|
660
|
+
excludedDomains: z.ZodArray<z.ZodString>;
|
|
661
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
662
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
663
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
664
|
+
type: z.ZodLiteral<"web_search">;
|
|
665
|
+
}, z.core.$strict>]>], null>, z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
|
|
666
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
667
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
668
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
669
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
670
|
+
type: z.ZodLiteral<"x_search">;
|
|
671
|
+
allowedXHandles: z.ZodArray<z.ZodString>;
|
|
672
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
673
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
674
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
675
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
676
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
677
|
+
type: z.ZodLiteral<"x_search">;
|
|
678
|
+
excludedXHandles: z.ZodArray<z.ZodString>;
|
|
679
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
680
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
681
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
682
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
683
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
684
|
+
type: z.ZodLiteral<"x_search">;
|
|
685
|
+
}, z.core.$strict>]>], null>, z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
|
|
686
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
687
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
688
|
+
type: z.ZodLiteral<"web_search">;
|
|
689
|
+
allowedDomains: z.ZodArray<z.ZodString>;
|
|
690
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
691
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
692
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
693
|
+
type: z.ZodLiteral<"web_search">;
|
|
694
|
+
excludedDomains: z.ZodArray<z.ZodString>;
|
|
695
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
696
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
697
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
698
|
+
type: z.ZodLiteral<"web_search">;
|
|
699
|
+
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
700
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
701
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
702
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
703
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
704
|
+
type: z.ZodLiteral<"x_search">;
|
|
705
|
+
allowedXHandles: z.ZodArray<z.ZodString>;
|
|
706
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
707
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
708
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
709
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
710
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
711
|
+
type: z.ZodLiteral<"x_search">;
|
|
712
|
+
excludedXHandles: z.ZodArray<z.ZodString>;
|
|
713
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
714
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
715
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
716
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
717
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
718
|
+
type: z.ZodLiteral<"x_search">;
|
|
719
|
+
}, z.core.$strict>]>], null>, z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
|
|
720
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
721
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
722
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
723
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
724
|
+
type: z.ZodLiteral<"x_search">;
|
|
725
|
+
allowedXHandles: z.ZodArray<z.ZodString>;
|
|
726
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
727
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
728
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
729
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
730
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
731
|
+
type: z.ZodLiteral<"x_search">;
|
|
732
|
+
excludedXHandles: z.ZodArray<z.ZodString>;
|
|
733
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
734
|
+
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
735
|
+
toDate: z.ZodOptional<z.ZodISODate>;
|
|
736
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
737
|
+
enableVideoUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
738
|
+
type: z.ZodLiteral<"x_search">;
|
|
739
|
+
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
740
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
741
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
742
|
+
type: z.ZodLiteral<"web_search">;
|
|
743
|
+
allowedDomains: z.ZodArray<z.ZodString>;
|
|
744
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
745
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
746
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
747
|
+
type: z.ZodLiteral<"web_search">;
|
|
748
|
+
excludedDomains: z.ZodArray<z.ZodString>;
|
|
749
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
750
|
+
enableImageUnderstanding: z.ZodOptional<z.ZodBoolean>;
|
|
751
|
+
enableImageSearch: z.ZodOptional<z.ZodBoolean>;
|
|
752
|
+
type: z.ZodLiteral<"web_search">;
|
|
753
|
+
}, z.core.$strict>]>], null>]>>;
|
|
754
|
+
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
483
755
|
}, z.core.$strict>>;
|
|
484
756
|
}, z.core.$strict>>;
|
|
485
757
|
}, z.core.$strict>;
|
|
@@ -539,7 +811,16 @@ declare const xaiRegistry: ModelRegistry;
|
|
|
539
811
|
*/
|
|
540
812
|
|
|
541
813
|
/** Identifies this pricing snapshot — bump the date when rates change. */
|
|
542
|
-
declare const xaiPricingVersion: "xai-2026-08-
|
|
814
|
+
declare const xaiPricingVersion: "xai-2026-08-24";
|
|
815
|
+
/**
|
|
816
|
+
* Live-pinned 2026-08-24 per-invocation tool rates (µUSD per call).
|
|
817
|
+
* Source: `usage.server_side_tool_usage_details` on /v1/responses.
|
|
818
|
+
* $5 / 1,000 web or X searches; $10 / 1,000 attachment/document searches.
|
|
819
|
+
*/
|
|
820
|
+
declare const XAI_TOOL_RATE_MICRO_USD: {
|
|
821
|
+
readonly web_search_calls: 5000;
|
|
822
|
+
readonly x_search_calls: 5000;
|
|
823
|
+
};
|
|
543
824
|
/**
|
|
544
825
|
* Per-model rate entry (all values in µUSD per million tokens).
|
|
545
826
|
*
|
|
@@ -592,8 +873,13 @@ declare const XAI_PRICING: Readonly<Record<string, XaiModelRates>>;
|
|
|
592
873
|
* 4. Billable input = `inputTokens − (cachedInputTokens ?? 0)`, clamped to 0.
|
|
593
874
|
* 5. Round each component (input, cached, output) independently to the
|
|
594
875
|
* nearest integer micro-USD.
|
|
595
|
-
* 6. `microUsd` is the sum of the
|
|
596
|
-
* `details.input + details.cached + details.output === microUsd
|
|
876
|
+
* 6. `microUsd` is the sum of the four components — guarantees
|
|
877
|
+
* `details.input + details.cached + details.output + details.tools === microUsd`.
|
|
878
|
+
* 7. Tool lanes: live-pinned counters `web_search_calls`, `x_search_calls`,
|
|
879
|
+
* `document_search_calls`. If `usage.details.server_tools_requested === 1`
|
|
880
|
+
* and those counters are absent, token lanes are priced, `tools: 0`,
|
|
881
|
+
* `confidence: 'estimated'`. `'exact'` requires counters present or no
|
|
882
|
+
* server tools requested.
|
|
597
883
|
*/
|
|
598
884
|
declare function computeXaiCost(model: string, usage: Usage, tier?: string): Cost;
|
|
599
885
|
/**
|
|
@@ -639,4 +925,4 @@ declare function xaiPricingSource(): PricingSource;
|
|
|
639
925
|
*/
|
|
640
926
|
declare function xaiProvider(opts?: XaiAdapterOptions): ProviderPlugin;
|
|
641
927
|
|
|
642
|
-
export { type FileDeleteOptions, Grok45ConfigSchema, Grok46ConfigSchema, XAI_FILES_DEFAULT_BASE_URL, XAI_FILE_MAX_BYTES, XAI_FILE_TTL_MAX_SECONDS, XAI_FILE_TTL_MIN_SECONDS, XAI_PRICING, type XaiAdapterOptions, type XaiClientLike, type XaiFileHandle, type XaiFileListOptions, type XaiFileListResult, XaiFileStore, type XaiFileStoreOptions, type XaiFileUploadInput, type XaiInputContentPart, type XaiInputFilePart, type XaiInputImagePart, type XaiInputItem, type XaiInputTextPart, type XaiMessageOutputItem, type XaiModelRates, type XaiOutputItem, type XaiOutputTextPart, type XaiProviderOptions, type XaiReasoningOutputItem, type XaiReasoningSummaryPart, type XaiResponseCreateParams, type XaiResponseShape, type XaiTextFormat, type XaiUsageShape, buildXaiClient, classifyXaiError, computeXaiCost, grok45ModelDescriptor, grok46ModelDescriptor, requireApiKey, xaiAdapter, xaiModelDescriptors, xaiPricingSource, xaiPricingVersion, xaiProvider, xaiRegistry };
|
|
928
|
+
export { type FileDeleteOptions, Grok45ConfigSchema, Grok46ConfigSchema, XAI_FILES_DEFAULT_BASE_URL, XAI_FILE_MAX_BYTES, XAI_FILE_TTL_MAX_SECONDS, XAI_FILE_TTL_MIN_SECONDS, XAI_PRICING, XAI_TOOL_RATE_MICRO_USD, type XaiAdapterOptions, type XaiClientLike, type XaiFileHandle, type XaiFileListOptions, type XaiFileListResult, XaiFileStore, type XaiFileStoreOptions, type XaiFileUploadInput, type XaiInputContentPart, type XaiInputFilePart, type XaiInputImagePart, type XaiInputItem, type XaiInputTextPart, type XaiMessageOutputItem, type XaiModelRates, type XaiOutputItem, type XaiOutputTextPart, type XaiProviderOptions, type XaiReasoningOutputItem, type XaiReasoningSummaryPart, type XaiResponseCreateParams, type XaiResponseShape, type XaiTextFormat, type XaiUsageShape, type XaiWebSearchTool, type XaiXSearchTool, buildXaiClient, classifyXaiError, computeXaiCost, grok45ModelDescriptor, grok46ModelDescriptor, requireApiKey, xaiAdapter, xaiModelDescriptors, xaiPricingSource, xaiPricingVersion, xaiProvider, xaiRegistry };
|