@kaana.ai/contracts 8.2.0 → 8.4.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/catalogue.d.ts +32 -1
- package/dist/internal/decisions.d.ts +2 -0
- package/dist/internal/grant.d.ts +3 -0
- package/dist/internal/realtime.d.ts +6 -2
- package/dist/internal/request.d.ts +2 -2
- package/dist/internal/settlement.d.ts +2 -0
- package/dist/internal/streamEvents.d.ts +2 -0
- package/dist/internal/usage.d.ts +1 -0
- package/dist/public/anthropicMessages.d.ts +284 -0
- package/dist/public/anthropicMessages.js +274 -0
- package/dist/public/audio.d.ts +3 -0
- package/dist/public/catalogue.d.ts +28 -0
- package/dist/public/catalogue.js +40 -0
- package/dist/public/chatCompletions.d.ts +2 -2
- package/dist/public/decisions.d.ts +1 -0
- package/dist/public/generations.d.ts +6 -0
- package/dist/public/messages.d.ts +2 -2
- package/dist/public/messages.js +1 -1
- package/dist/public/money.d.ts +16 -1
- package/dist/public/money.js +11 -0
- package/dist/public/realtime.d.ts +11 -7
- package/dist/public/responses.d.ts +3 -2
- package/dist/public/streamEvents.d.ts +2 -0
- package/dist/public/version.d.ts +14 -1
- package/dist/public/version.js +14 -1
- package/openapi.json +1313 -165
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Accounts, applications, `oxy_sk_…` keys, limits and billing are managed in
|
|
11
11
|
* Oxy Console (`https://console.oxy.so`), never here.
|
|
12
12
|
*/
|
|
13
|
+
export * from './public/anthropicMessages.js';
|
|
13
14
|
export * from './public/audio.js';
|
|
14
15
|
export * from './public/audioFormats.js';
|
|
15
16
|
export * from './public/catalogue.js';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Accounts, applications, `oxy_sk_…` keys, limits and billing are managed in
|
|
11
11
|
* Oxy Console (`https://console.oxy.so`), never here.
|
|
12
12
|
*/
|
|
13
|
+
export * from './public/anthropicMessages.js';
|
|
13
14
|
export * from './public/audio.js';
|
|
14
15
|
export * from './public/audioFormats.js';
|
|
15
16
|
export * from './public/catalogue.js';
|
|
@@ -113,6 +113,13 @@ export declare const catalogueModelSchema: z.ZodObject<{
|
|
|
113
113
|
}>>;
|
|
114
114
|
}, z.core.$strict>>;
|
|
115
115
|
}, z.core.$strict>>;
|
|
116
|
+
unreported: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
117
|
+
tools: "tools";
|
|
118
|
+
parallelToolCalls: "parallelToolCalls";
|
|
119
|
+
structuredOutput: "structuredOutput";
|
|
120
|
+
jsonMode: "jsonMode";
|
|
121
|
+
promptCaching: "promptCaching";
|
|
122
|
+
}>>>;
|
|
116
123
|
}, z.core.$strict>;
|
|
117
124
|
license: z.ZodObject<{
|
|
118
125
|
licenseId: z.ZodString;
|
|
@@ -254,8 +261,8 @@ export declare const modelDeploymentSchema: z.ZodObject<{
|
|
|
254
261
|
status: z.ZodEnum<{
|
|
255
262
|
active: "active";
|
|
256
263
|
retired: "retired";
|
|
257
|
-
degraded: "degraded";
|
|
258
264
|
disabled: "disabled";
|
|
265
|
+
degraded: "degraded";
|
|
259
266
|
}>;
|
|
260
267
|
dedicatedCapacity: z.ZodBoolean;
|
|
261
268
|
priceVersionId: z.ZodOptional<z.ZodString>;
|
|
@@ -436,6 +443,13 @@ export declare const modelCatalogueEntrySchema: z.ZodObject<{
|
|
|
436
443
|
}>>;
|
|
437
444
|
}, z.core.$strict>>;
|
|
438
445
|
}, z.core.$strict>>;
|
|
446
|
+
unreported: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
447
|
+
tools: "tools";
|
|
448
|
+
parallelToolCalls: "parallelToolCalls";
|
|
449
|
+
structuredOutput: "structuredOutput";
|
|
450
|
+
jsonMode: "jsonMode";
|
|
451
|
+
promptCaching: "promptCaching";
|
|
452
|
+
}>>>;
|
|
439
453
|
}, z.core.$strict>;
|
|
440
454
|
license: z.ZodObject<{
|
|
441
455
|
licenseId: z.ZodString;
|
|
@@ -501,6 +515,7 @@ export declare const modelCatalogueEntrySchema: z.ZodObject<{
|
|
|
501
515
|
audio_output_tokens: "audio_output_tokens";
|
|
502
516
|
session_milliseconds: "session_milliseconds";
|
|
503
517
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
518
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
504
519
|
}>;
|
|
505
520
|
amount: z.core.$ZodBranded<z.ZodString, "ExactDecimal", "out">;
|
|
506
521
|
per: z.ZodNumber;
|
|
@@ -704,6 +719,13 @@ export declare const declaredModelSchema: z.ZodObject<{
|
|
|
704
719
|
}>>;
|
|
705
720
|
}, z.core.$strict>>;
|
|
706
721
|
}, z.core.$strict>>;
|
|
722
|
+
unreported: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
723
|
+
tools: "tools";
|
|
724
|
+
parallelToolCalls: "parallelToolCalls";
|
|
725
|
+
structuredOutput: "structuredOutput";
|
|
726
|
+
jsonMode: "jsonMode";
|
|
727
|
+
promptCaching: "promptCaching";
|
|
728
|
+
}>>>;
|
|
707
729
|
}, z.core.$strict>;
|
|
708
730
|
license: z.ZodObject<{
|
|
709
731
|
licenseId: z.ZodString;
|
|
@@ -767,6 +789,7 @@ export declare const declaredModelSchema: z.ZodObject<{
|
|
|
767
789
|
audio_output_tokens: "audio_output_tokens";
|
|
768
790
|
session_milliseconds: "session_milliseconds";
|
|
769
791
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
792
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
770
793
|
}>;
|
|
771
794
|
amount: z.core.$ZodBranded<z.ZodString, "ExactDecimal", "out">;
|
|
772
795
|
per: z.ZodNumber;
|
|
@@ -935,6 +958,13 @@ export declare const declaredCatalogueSchema: z.ZodObject<{
|
|
|
935
958
|
}>>;
|
|
936
959
|
}, z.core.$strict>>;
|
|
937
960
|
}, z.core.$strict>>;
|
|
961
|
+
unreported: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
962
|
+
tools: "tools";
|
|
963
|
+
parallelToolCalls: "parallelToolCalls";
|
|
964
|
+
structuredOutput: "structuredOutput";
|
|
965
|
+
jsonMode: "jsonMode";
|
|
966
|
+
promptCaching: "promptCaching";
|
|
967
|
+
}>>>;
|
|
938
968
|
}, z.core.$strict>;
|
|
939
969
|
license: z.ZodObject<{
|
|
940
970
|
licenseId: z.ZodString;
|
|
@@ -998,6 +1028,7 @@ export declare const declaredCatalogueSchema: z.ZodObject<{
|
|
|
998
1028
|
audio_output_tokens: "audio_output_tokens";
|
|
999
1029
|
session_milliseconds: "session_milliseconds";
|
|
1000
1030
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
1031
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
1001
1032
|
}>;
|
|
1002
1033
|
amount: z.core.$ZodBranded<z.ZodString, "ExactDecimal", "out">;
|
|
1003
1034
|
per: z.ZodNumber;
|
|
@@ -72,6 +72,7 @@ export declare const decisionResultSchema: z.ZodObject<{
|
|
|
72
72
|
audio_output_tokens: "audio_output_tokens";
|
|
73
73
|
session_milliseconds: "session_milliseconds";
|
|
74
74
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
75
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
75
76
|
}>;
|
|
76
77
|
quantity: z.ZodNumber;
|
|
77
78
|
}, z.core.$strict>>;
|
|
@@ -245,6 +246,7 @@ export declare const decisionFailureSchema: z.ZodObject<{
|
|
|
245
246
|
audio_output_tokens: "audio_output_tokens";
|
|
246
247
|
session_milliseconds: "session_milliseconds";
|
|
247
248
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
249
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
248
250
|
}>;
|
|
249
251
|
quantity: z.ZodNumber;
|
|
250
252
|
}, z.core.$strict>>;
|
package/dist/internal/grant.d.ts
CHANGED
|
@@ -561,6 +561,7 @@ export declare const receiptAccessSchema: z.ZodObject<{
|
|
|
561
561
|
audio_output_tokens: "audio_output_tokens";
|
|
562
562
|
session_milliseconds: "session_milliseconds";
|
|
563
563
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
564
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
564
565
|
}>;
|
|
565
566
|
amount: z.core.$ZodBranded<z.ZodString, "ExactDecimal", "out">;
|
|
566
567
|
per: z.ZodNumber;
|
|
@@ -610,6 +611,7 @@ export declare const receiptAccessSchema: z.ZodObject<{
|
|
|
610
611
|
audio_output_tokens: "audio_output_tokens";
|
|
611
612
|
session_milliseconds: "session_milliseconds";
|
|
612
613
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
614
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
613
615
|
}>;
|
|
614
616
|
quantity: z.ZodNumber;
|
|
615
617
|
}, z.core.$strict>>;
|
|
@@ -672,6 +674,7 @@ export declare const receiptAccessSchema: z.ZodObject<{
|
|
|
672
674
|
audio_output_tokens: "audio_output_tokens";
|
|
673
675
|
session_milliseconds: "session_milliseconds";
|
|
674
676
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
677
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
675
678
|
}>;
|
|
676
679
|
quantity: z.ZodNumber;
|
|
677
680
|
}, z.core.$strict>>;
|
|
@@ -326,6 +326,7 @@ export declare const realtimeResponseDoneEventSchema: z.ZodObject<{
|
|
|
326
326
|
audio_output_tokens: "audio_output_tokens";
|
|
327
327
|
session_milliseconds: "session_milliseconds";
|
|
328
328
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
329
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
329
330
|
}>;
|
|
330
331
|
quantity: z.ZodNumber;
|
|
331
332
|
}, z.core.$strict>>;
|
|
@@ -442,6 +443,7 @@ export declare const realtimeSessionClosedEventSchema: z.ZodObject<{
|
|
|
442
443
|
audio_output_tokens: "audio_output_tokens";
|
|
443
444
|
session_milliseconds: "session_milliseconds";
|
|
444
445
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
446
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
445
447
|
}>;
|
|
446
448
|
quantity: z.ZodNumber;
|
|
447
449
|
}, z.core.$strict>>;
|
|
@@ -631,8 +633,8 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
631
633
|
type: z.ZodLiteral<"message">;
|
|
632
634
|
itemId: z.ZodOptional<z.ZodString>;
|
|
633
635
|
role: z.ZodEnum<{
|
|
634
|
-
user: "user";
|
|
635
636
|
system: "system";
|
|
637
|
+
user: "user";
|
|
636
638
|
assistant: "assistant";
|
|
637
639
|
}>;
|
|
638
640
|
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -682,8 +684,8 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
682
684
|
type: z.ZodLiteral<"message">;
|
|
683
685
|
itemId: z.ZodOptional<z.ZodString>;
|
|
684
686
|
role: z.ZodEnum<{
|
|
685
|
-
user: "user";
|
|
686
687
|
system: "system";
|
|
688
|
+
user: "user";
|
|
687
689
|
assistant: "assistant";
|
|
688
690
|
}>;
|
|
689
691
|
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -899,6 +901,7 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
899
901
|
audio_output_tokens: "audio_output_tokens";
|
|
900
902
|
session_milliseconds: "session_milliseconds";
|
|
901
903
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
904
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
902
905
|
}>;
|
|
903
906
|
quantity: z.ZodNumber;
|
|
904
907
|
}, z.core.$strict>>;
|
|
@@ -1005,6 +1008,7 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
1005
1008
|
audio_output_tokens: "audio_output_tokens";
|
|
1006
1009
|
session_milliseconds: "session_milliseconds";
|
|
1007
1010
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
1011
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
1008
1012
|
}>;
|
|
1009
1013
|
quantity: z.ZodNumber;
|
|
1010
1014
|
}, z.core.$strict>>;
|
|
@@ -47,9 +47,9 @@ export declare const inferenceInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
47
47
|
format: z.ZodLiteral<"messages">;
|
|
48
48
|
messages: z.ZodArray<z.ZodObject<{
|
|
49
49
|
role: z.ZodEnum<{
|
|
50
|
-
user: "user";
|
|
51
50
|
system: "system";
|
|
52
51
|
developer: "developer";
|
|
52
|
+
user: "user";
|
|
53
53
|
assistant: "assistant";
|
|
54
54
|
tool: "tool";
|
|
55
55
|
}>;
|
|
@@ -231,9 +231,9 @@ export declare const inferenceRequestSchema: z.ZodObject<{
|
|
|
231
231
|
format: z.ZodLiteral<"messages">;
|
|
232
232
|
messages: z.ZodArray<z.ZodObject<{
|
|
233
233
|
role: z.ZodEnum<{
|
|
234
|
-
user: "user";
|
|
235
234
|
system: "system";
|
|
236
235
|
developer: "developer";
|
|
236
|
+
user: "user";
|
|
237
237
|
assistant: "assistant";
|
|
238
238
|
tool: "tool";
|
|
239
239
|
}>;
|
|
@@ -92,6 +92,7 @@ export declare const settlementSchema: z.ZodObject<{
|
|
|
92
92
|
audio_output_tokens: "audio_output_tokens";
|
|
93
93
|
session_milliseconds: "session_milliseconds";
|
|
94
94
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
95
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
95
96
|
}>;
|
|
96
97
|
quantity: z.ZodNumber;
|
|
97
98
|
}, z.core.$strict>>;
|
|
@@ -216,6 +217,7 @@ export declare const settlementPageSchema: z.ZodObject<{
|
|
|
216
217
|
audio_output_tokens: "audio_output_tokens";
|
|
217
218
|
session_milliseconds: "session_milliseconds";
|
|
218
219
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
220
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
219
221
|
}>;
|
|
220
222
|
quantity: z.ZodNumber;
|
|
221
223
|
}, z.core.$strict>>;
|
|
@@ -82,6 +82,7 @@ export declare const inferenceStreamUsageEventSchema: z.ZodObject<{
|
|
|
82
82
|
audio_output_tokens: "audio_output_tokens";
|
|
83
83
|
session_milliseconds: "session_milliseconds";
|
|
84
84
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
85
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
85
86
|
}>;
|
|
86
87
|
quantity: z.ZodNumber;
|
|
87
88
|
}, z.core.$strict>>;
|
|
@@ -300,6 +301,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
300
301
|
audio_output_tokens: "audio_output_tokens";
|
|
301
302
|
session_milliseconds: "session_milliseconds";
|
|
302
303
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
304
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
303
305
|
}>;
|
|
304
306
|
quantity: z.ZodNumber;
|
|
305
307
|
}, z.core.$strict>>;
|
package/dist/internal/usage.d.ts
CHANGED
|
@@ -116,6 +116,7 @@ export declare const normalizedUsageReportSchema: z.ZodObject<{
|
|
|
116
116
|
audio_output_tokens: "audio_output_tokens";
|
|
117
117
|
session_milliseconds: "session_milliseconds";
|
|
118
118
|
input_transcription_milliseconds: "input_transcription_milliseconds";
|
|
119
|
+
cache_write_input_tokens: "cache_write_input_tokens";
|
|
119
120
|
}>;
|
|
120
121
|
quantity: z.ZodNumber;
|
|
121
122
|
}, z.core.$strict>>;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `POST /v1/messages` — the Anthropic-Messages-compatible surface.
|
|
3
|
+
*
|
|
4
|
+
* It speaks the flat Anthropic request, response and stream shapes so an
|
|
5
|
+
* unmodified Anthropic SDK or Claude Code works with
|
|
6
|
+
* `ANTHROPIC_BASE_URL=https://kaana.ai` and an `oxy_sk_…` key (sent as
|
|
7
|
+
* `x-api-key` or as `Authorization: Bearer`). Like `/v1/chat/completions` it
|
|
8
|
+
* gains NO Kaana-specific request field, and it is `.strict()` everywhere: a
|
|
9
|
+
* stock SDK sending a parameter Kaana does not implement is told so rather than
|
|
10
|
+
* having it silently dropped.
|
|
11
|
+
*
|
|
12
|
+
* ## What is refused, and why
|
|
13
|
+
*
|
|
14
|
+
* - **`cache_control`, anywhere** (on a block, a tool, `system` or the
|
|
15
|
+
* request). Kaana's usage units have no unit for a cache WRITE (see the
|
|
16
|
+
* Anthropic adapter's usage meter): a cache write is billed at a premium
|
|
17
|
+
* over input, so honouring the marker while folding the write into
|
|
18
|
+
* `input_tokens` would report less than the request cost. The marker is
|
|
19
|
+
* refused, by name and path, instead of being dropped.
|
|
20
|
+
* - **`thinking` other than `{ type: 'disabled' }`.** The contract's reasoning
|
|
21
|
+
* control is an effort (`low`, `medium`, `high`), not a token budget, and a
|
|
22
|
+
* thinking block has no part in a message: reasoning is private and is never
|
|
23
|
+
* returned. Reasoning effort is asked with `output_config.effort`, which
|
|
24
|
+
* maps one to one. A `thinking` or `redacted_thinking` block in a message is
|
|
25
|
+
* refused for the same reason.
|
|
26
|
+
* - **Server tools** (`web_search`, `bash`, `text_editor`, …), `mcp_servers`,
|
|
27
|
+
* `container`, `service_tier`, `disable_parallel_tool_use`, `document`
|
|
28
|
+
* blocks and any other member this file does not name.
|
|
29
|
+
* - **An image `url` source**: nothing fetches an image URL (ADR 0007); a
|
|
30
|
+
* `base64` source is carried inline under the image rules.
|
|
31
|
+
*
|
|
32
|
+
* `stop_reason: 'stop_sequence'` is never produced: the finish reason Kaana
|
|
33
|
+
* measures does not say WHICH stop sequence ended the turn, and `stop_sequence`
|
|
34
|
+
* would then have to name one. A turn that ended on a stop sequence reports
|
|
35
|
+
* `end_turn`.
|
|
36
|
+
*
|
|
37
|
+
* `metadata.user_id` is accepted and neither forwarded nor stored: it is an
|
|
38
|
+
* end-user identifier, and Kaana persists none.
|
|
39
|
+
*
|
|
40
|
+
* `usage` is derived from the measured units: `input_tokens`, `output_tokens`
|
|
41
|
+
* (reasoning included, as Anthropic counts it) and, only when the route
|
|
42
|
+
* measured it, `cache_read_input_tokens`. There is no `cache_creation_*`.
|
|
43
|
+
*/
|
|
44
|
+
import { z } from 'zod';
|
|
45
|
+
export declare const anthropicMessagesRequestSchema: z.ZodObject<{
|
|
46
|
+
model: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
|
|
47
|
+
medium: "medium";
|
|
48
|
+
high: "high";
|
|
49
|
+
auto: "auto";
|
|
50
|
+
instant: "instant";
|
|
51
|
+
xhigh: "xhigh";
|
|
52
|
+
pro: "pro";
|
|
53
|
+
ultra: "ultra";
|
|
54
|
+
}>]>;
|
|
55
|
+
max_tokens: z.ZodNumber;
|
|
56
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
57
|
+
role: z.ZodEnum<{
|
|
58
|
+
user: "user";
|
|
59
|
+
assistant: "assistant";
|
|
60
|
+
}>;
|
|
61
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
62
|
+
type: z.ZodLiteral<"text">;
|
|
63
|
+
text: z.ZodString;
|
|
64
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"image">;
|
|
66
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
|
+
type: z.ZodLiteral<"base64">;
|
|
68
|
+
media_type: z.ZodString;
|
|
69
|
+
data: z.ZodString;
|
|
70
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"url">;
|
|
72
|
+
url: z.ZodString;
|
|
73
|
+
}, z.core.$strict>], "type">;
|
|
74
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"tool_use">;
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
79
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
80
|
+
type: z.ZodLiteral<"tool_result">;
|
|
81
|
+
tool_use_id: z.ZodString;
|
|
82
|
+
content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
83
|
+
type: z.ZodLiteral<"text">;
|
|
84
|
+
text: z.ZodString;
|
|
85
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<"image">;
|
|
87
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<"base64">;
|
|
89
|
+
media_type: z.ZodString;
|
|
90
|
+
data: z.ZodString;
|
|
91
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
92
|
+
type: z.ZodLiteral<"url">;
|
|
93
|
+
url: z.ZodString;
|
|
94
|
+
}, z.core.$strict>], "type">;
|
|
95
|
+
}, z.core.$strict>]>>]>>;
|
|
96
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
+
}, z.core.$strict>]>>]>;
|
|
98
|
+
}, z.core.$strict>>;
|
|
99
|
+
system: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
100
|
+
type: z.ZodLiteral<"text">;
|
|
101
|
+
text: z.ZodString;
|
|
102
|
+
}, z.core.$strict>>]>>;
|
|
103
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
top_k: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
stop_sequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
107
|
+
stream: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
|
+
type: z.ZodOptional<z.ZodLiteral<"custom">>;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
description: z.ZodOptional<z.ZodString>;
|
|
112
|
+
input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
113
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
114
|
+
}, z.core.$strict>>>;
|
|
115
|
+
tool_choice: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
116
|
+
type: z.ZodLiteral<"auto">;
|
|
117
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
118
|
+
type: z.ZodLiteral<"any">;
|
|
119
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
120
|
+
type: z.ZodLiteral<"none">;
|
|
121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
122
|
+
type: z.ZodLiteral<"tool">;
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
}, z.core.$strict>], "type">>;
|
|
125
|
+
thinking: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
type: z.ZodLiteral<"disabled">;
|
|
127
|
+
}, z.core.$strict>>;
|
|
128
|
+
output_config: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
effort: z.ZodOptional<z.ZodEnum<{
|
|
130
|
+
low: "low";
|
|
131
|
+
medium: "medium";
|
|
132
|
+
high: "high";
|
|
133
|
+
}>>;
|
|
134
|
+
}, z.core.$strict>>;
|
|
135
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
136
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
+
}, z.core.$strict>>;
|
|
138
|
+
}, z.core.$strict>;
|
|
139
|
+
/** The non-streaming body. The request id rides in `Kaana-Request-Id` and `Request-Id`. */
|
|
140
|
+
export declare const anthropicMessageSchema: z.ZodObject<{
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
type: z.ZodLiteral<"message">;
|
|
143
|
+
role: z.ZodLiteral<"assistant">;
|
|
144
|
+
model: z.ZodString;
|
|
145
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
146
|
+
type: z.ZodLiteral<"text">;
|
|
147
|
+
text: z.ZodString;
|
|
148
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
149
|
+
type: z.ZodLiteral<"tool_use">;
|
|
150
|
+
id: z.ZodString;
|
|
151
|
+
name: z.ZodString;
|
|
152
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
153
|
+
}, z.core.$strict>], "type">>;
|
|
154
|
+
stop_reason: z.ZodEnum<{
|
|
155
|
+
refusal: "refusal";
|
|
156
|
+
tool_use: "tool_use";
|
|
157
|
+
max_tokens: "max_tokens";
|
|
158
|
+
end_turn: "end_turn";
|
|
159
|
+
}>;
|
|
160
|
+
stop_sequence: z.ZodLiteral<null>;
|
|
161
|
+
usage: z.ZodObject<{
|
|
162
|
+
input_tokens: z.ZodNumber;
|
|
163
|
+
output_tokens: z.ZodNumber;
|
|
164
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
}, z.core.$strict>;
|
|
167
|
+
/** The error body, and the data of a stream's `event: error` frame. */
|
|
168
|
+
export declare const anthropicErrorSchema: z.ZodObject<{
|
|
169
|
+
type: z.ZodLiteral<"error">;
|
|
170
|
+
error: z.ZodObject<{
|
|
171
|
+
type: z.ZodEnum<{
|
|
172
|
+
request_too_large: "request_too_large";
|
|
173
|
+
invalid_request_error: "invalid_request_error";
|
|
174
|
+
authentication_error: "authentication_error";
|
|
175
|
+
billing_error: "billing_error";
|
|
176
|
+
permission_error: "permission_error";
|
|
177
|
+
not_found_error: "not_found_error";
|
|
178
|
+
rate_limit_error: "rate_limit_error";
|
|
179
|
+
timeout_error: "timeout_error";
|
|
180
|
+
overloaded_error: "overloaded_error";
|
|
181
|
+
api_error: "api_error";
|
|
182
|
+
}>;
|
|
183
|
+
message: z.ZodString;
|
|
184
|
+
}, z.core.$strict>;
|
|
185
|
+
request_id: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, z.core.$strict>;
|
|
187
|
+
/**
|
|
188
|
+
* One frame of a streamed message: `event: <type>` and this as its data. The
|
|
189
|
+
* input tokens are known only when the route reports usage, so `message_start`
|
|
190
|
+
* carries zeros and the final `message_delta` the measured totals. A stream that
|
|
191
|
+
* fails after its first frame ends with an `error` frame and no `message_stop`.
|
|
192
|
+
*/
|
|
193
|
+
export declare const anthropicStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
194
|
+
type: z.ZodLiteral<"message_start">;
|
|
195
|
+
message: z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
type: z.ZodLiteral<"message">;
|
|
198
|
+
role: z.ZodLiteral<"assistant">;
|
|
199
|
+
model: z.ZodString;
|
|
200
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
201
|
+
type: z.ZodLiteral<"text">;
|
|
202
|
+
text: z.ZodString;
|
|
203
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
204
|
+
type: z.ZodLiteral<"tool_use">;
|
|
205
|
+
id: z.ZodString;
|
|
206
|
+
name: z.ZodString;
|
|
207
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
208
|
+
}, z.core.$strict>], "type">>;
|
|
209
|
+
stop_reason: z.ZodLiteral<null>;
|
|
210
|
+
stop_sequence: z.ZodLiteral<null>;
|
|
211
|
+
usage: z.ZodObject<{
|
|
212
|
+
input_tokens: z.ZodNumber;
|
|
213
|
+
output_tokens: z.ZodNumber;
|
|
214
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
215
|
+
}, z.core.$strict>;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
218
|
+
type: z.ZodLiteral<"content_block_start">;
|
|
219
|
+
index: z.ZodNumber;
|
|
220
|
+
content_block: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
221
|
+
type: z.ZodLiteral<"text">;
|
|
222
|
+
text: z.ZodLiteral<"">;
|
|
223
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
224
|
+
type: z.ZodLiteral<"tool_use">;
|
|
225
|
+
id: z.ZodString;
|
|
226
|
+
name: z.ZodString;
|
|
227
|
+
input: z.ZodObject<{}, z.core.$strict>;
|
|
228
|
+
}, z.core.$strict>], "type">;
|
|
229
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
230
|
+
type: z.ZodLiteral<"content_block_delta">;
|
|
231
|
+
index: z.ZodNumber;
|
|
232
|
+
delta: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"text_delta">;
|
|
234
|
+
text: z.ZodString;
|
|
235
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
236
|
+
type: z.ZodLiteral<"input_json_delta">;
|
|
237
|
+
partial_json: z.ZodString;
|
|
238
|
+
}, z.core.$strict>], "type">;
|
|
239
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
240
|
+
type: z.ZodLiteral<"content_block_stop">;
|
|
241
|
+
index: z.ZodNumber;
|
|
242
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
243
|
+
type: z.ZodLiteral<"message_delta">;
|
|
244
|
+
delta: z.ZodObject<{
|
|
245
|
+
stop_reason: z.ZodEnum<{
|
|
246
|
+
refusal: "refusal";
|
|
247
|
+
tool_use: "tool_use";
|
|
248
|
+
max_tokens: "max_tokens";
|
|
249
|
+
end_turn: "end_turn";
|
|
250
|
+
}>;
|
|
251
|
+
stop_sequence: z.ZodLiteral<null>;
|
|
252
|
+
}, z.core.$strict>;
|
|
253
|
+
usage: z.ZodObject<{
|
|
254
|
+
input_tokens: z.ZodNumber;
|
|
255
|
+
output_tokens: z.ZodNumber;
|
|
256
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
257
|
+
}, z.core.$strict>;
|
|
258
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
259
|
+
type: z.ZodLiteral<"message_stop">;
|
|
260
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
261
|
+
type: z.ZodLiteral<"ping">;
|
|
262
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
263
|
+
type: z.ZodLiteral<"error">;
|
|
264
|
+
error: z.ZodObject<{
|
|
265
|
+
type: z.ZodEnum<{
|
|
266
|
+
request_too_large: "request_too_large";
|
|
267
|
+
invalid_request_error: "invalid_request_error";
|
|
268
|
+
authentication_error: "authentication_error";
|
|
269
|
+
billing_error: "billing_error";
|
|
270
|
+
permission_error: "permission_error";
|
|
271
|
+
not_found_error: "not_found_error";
|
|
272
|
+
rate_limit_error: "rate_limit_error";
|
|
273
|
+
timeout_error: "timeout_error";
|
|
274
|
+
overloaded_error: "overloaded_error";
|
|
275
|
+
api_error: "api_error";
|
|
276
|
+
}>;
|
|
277
|
+
message: z.ZodString;
|
|
278
|
+
}, z.core.$strict>;
|
|
279
|
+
request_id: z.ZodOptional<z.ZodString>;
|
|
280
|
+
}, z.core.$strict>], "type">;
|
|
281
|
+
export type AnthropicMessagesRequest = z.infer<typeof anthropicMessagesRequestSchema>;
|
|
282
|
+
export type AnthropicMessage = z.infer<typeof anthropicMessageSchema>;
|
|
283
|
+
export type AnthropicError = z.infer<typeof anthropicErrorSchema>;
|
|
284
|
+
export type AnthropicStreamEvent = z.infer<typeof anthropicStreamEventSchema>;
|