@kaana.ai/contracts 8.1.0 → 8.3.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 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';
@@ -254,8 +254,8 @@ export declare const modelDeploymentSchema: z.ZodObject<{
254
254
  status: z.ZodEnum<{
255
255
  active: "active";
256
256
  retired: "retired";
257
- degraded: "degraded";
258
257
  disabled: "disabled";
258
+ degraded: "degraded";
259
259
  }>;
260
260
  dedicatedCapacity: z.ZodBoolean;
261
261
  priceVersionId: z.ZodOptional<z.ZodString>;
@@ -562,6 +562,26 @@ export declare const modelCatalogueEntrySchema: z.ZodObject<{
562
562
  ultra: "ultra";
563
563
  }>>;
564
564
  }, z.core.$strip>;
565
+ /**
566
+ * What a model line's image input costs at most, as the line's own documented
567
+ * rule states it (contract set 8.2.0, Kaana ADR 0007). Internal: Oxy reads it
568
+ * from the declared catalogue to bound the input of a request carrying images;
569
+ * `GET /v1/models` does not serve it.
570
+ *
571
+ * `maxInputTokensPerImage` is the most input tokens the line's provider bills
572
+ * for ONE image the contract admits (`checkImageInput`), at any `detail` the
573
+ * contract offers, from the publisher's documented resize and tokenization
574
+ * rule. Images are billed as input tokens at the line's `input_tokens` price;
575
+ * this figure only sizes a hold and qualifies a route, the settlement is the
576
+ * provider's own count.
577
+ *
578
+ * ABSENT means undeclared, even on a model whose `inputModalities` lists
579
+ * `image`: nobody has stated what one image costs on it, so no request carrying
580
+ * an image is authorized on it.
581
+ */
582
+ export declare const declaredImageInputSchema: z.ZodObject<{
583
+ maxInputTokensPerImage: z.ZodNumber;
584
+ }, z.core.$strict>;
565
585
  /**
566
586
  * One model as Kaana DECLARES it in `configs/public-catalogue.json` (Kaana ADR
567
587
  * 0002, amendment 2026-10-15): the public `modelSchema` without the three
@@ -791,6 +811,9 @@ export declare const declaredModelSchema: z.ZodObject<{
791
811
  platform_internal: "platform_internal";
792
812
  public: "public";
793
813
  }>;
814
+ imageInput: z.ZodOptional<z.ZodObject<{
815
+ maxInputTokensPerImage: z.ZodNumber;
816
+ }, z.core.$strict>>;
794
817
  }, z.core.$strict>;
795
818
  /**
796
819
  * The declared catalogue: identity, publisher, licence, provenance, data
@@ -1019,9 +1042,13 @@ export declare const declaredCatalogueSchema: z.ZodObject<{
1019
1042
  platform_internal: "platform_internal";
1020
1043
  public: "public";
1021
1044
  }>;
1045
+ imageInput: z.ZodOptional<z.ZodObject<{
1046
+ maxInputTokensPerImage: z.ZodNumber;
1047
+ }, z.core.$strict>>;
1022
1048
  }, z.core.$strict>>;
1023
1049
  }, z.core.$strict>;
1024
1050
  export type DeclaredModel = z.infer<typeof declaredModelSchema>;
1051
+ export type DeclaredImageInput = z.infer<typeof declaredImageInputSchema>;
1025
1052
  export type DeclaredCatalogue = z.infer<typeof declaredCatalogueSchema>;
1026
1053
  export type AvailabilityScope = z.infer<typeof availabilityScopeSchema>;
1027
1054
  export type CommercialPermission = z.infer<typeof commercialPermissionSchema>;
@@ -354,6 +354,28 @@ export const modelCatalogueEntrySchema = z.object({
354
354
  */
355
355
  powerClass: modelPowerClassSchema.optional(),
356
356
  });
357
+ /**
358
+ * What a model line's image input costs at most, as the line's own documented
359
+ * rule states it (contract set 8.2.0, Kaana ADR 0007). Internal: Oxy reads it
360
+ * from the declared catalogue to bound the input of a request carrying images;
361
+ * `GET /v1/models` does not serve it.
362
+ *
363
+ * `maxInputTokensPerImage` is the most input tokens the line's provider bills
364
+ * for ONE image the contract admits (`checkImageInput`), at any `detail` the
365
+ * contract offers, from the publisher's documented resize and tokenization
366
+ * rule. Images are billed as input tokens at the line's `input_tokens` price;
367
+ * this figure only sizes a hold and qualifies a route, the settlement is the
368
+ * provider's own count.
369
+ *
370
+ * ABSENT means undeclared, even on a model whose `inputModalities` lists
371
+ * `image`: nobody has stated what one image costs on it, so no request carrying
372
+ * an image is authorized on it.
373
+ */
374
+ export const declaredImageInputSchema = z
375
+ .object({
376
+ maxInputTokensPerImage: z.number().int().positive().safe(),
377
+ })
378
+ .strict();
357
379
  /**
358
380
  * One model as Kaana DECLARES it in `configs/public-catalogue.json` (Kaana ADR
359
381
  * 0002, amendment 2026-10-15): the public `modelSchema` without the three
@@ -368,8 +390,20 @@ export const modelCatalogueEntrySchema = z.object({
368
390
  */
369
391
  export const declaredModelSchema = modelSchema
370
392
  .omit({ schemaVersion: true, currentRevision: true, availableRevisions: true })
371
- .extend({ audience: z.enum(['public', 'platform_internal']) })
372
- .strict();
393
+ .extend({
394
+ audience: z.enum(['public', 'platform_internal']),
395
+ imageInput: declaredImageInputSchema.optional(),
396
+ })
397
+ .strict()
398
+ .superRefine((model, ctx) => {
399
+ if (model.imageInput !== undefined && !model.capabilities.inputModalities.includes('image')) {
400
+ ctx.addIssue({
401
+ code: 'custom',
402
+ path: ['imageInput'],
403
+ message: 'a model that bounds its image input takes image input',
404
+ });
405
+ }
406
+ });
373
407
  /**
374
408
  * The declared catalogue: identity, publisher, licence, provenance, data
375
409
  * policy, capabilities, voices and the LIST PRICE per unit of every model
@@ -74,6 +74,7 @@ export declare const grantRequestFactsSchema: z.ZodObject<{
74
74
  audioInputMilliseconds: z.ZodOptional<z.ZodNumber>;
75
75
  embeddingInputs: z.ZodOptional<z.ZodNumber>;
76
76
  images: z.ZodOptional<z.ZodNumber>;
77
+ inputImages: z.ZodOptional<z.ZodNumber>;
77
78
  declaredTools: z.ZodNumber;
78
79
  stream: z.ZodBoolean;
79
80
  realtimeSessionKind: z.ZodOptional<z.ZodEnum<{
@@ -125,6 +126,7 @@ export declare const inferenceAuthorizationRequestSchema: z.ZodObject<{
125
126
  audioInputMilliseconds: z.ZodOptional<z.ZodNumber>;
126
127
  embeddingInputs: z.ZodOptional<z.ZodNumber>;
127
128
  images: z.ZodOptional<z.ZodNumber>;
129
+ inputImages: z.ZodOptional<z.ZodNumber>;
128
130
  declaredTools: z.ZodNumber;
129
131
  stream: z.ZodBoolean;
130
132
  realtimeSessionKind: z.ZodOptional<z.ZodEnum<{
@@ -204,6 +206,7 @@ export declare const authorizationRequestSchema: z.ZodDiscriminatedUnion<[z.ZodO
204
206
  audioInputMilliseconds: z.ZodOptional<z.ZodNumber>;
205
207
  embeddingInputs: z.ZodOptional<z.ZodNumber>;
206
208
  images: z.ZodOptional<z.ZodNumber>;
209
+ inputImages: z.ZodOptional<z.ZodNumber>;
207
210
  declaredTools: z.ZodNumber;
208
211
  stream: z.ZodBoolean;
209
212
  realtimeSessionKind: z.ZodOptional<z.ZodEnum<{
@@ -22,7 +22,7 @@ import { maxUtf16Length, minUtf16Length } from '../stringBounds.js';
22
22
  import { powerLevelSchema, realtimeSessionKindSchema } from '../public/catalogue.js';
23
23
  import { generationRecordSchema } from '../public/generations.js';
24
24
  import { delegatedUserIdSchema, generationIdSchema, idempotencyKeySchema, inferenceEnvironmentSchema, inferenceRegionSchema, inferenceTimestampSchema, modelIdSchema, modelRevisionLabelSchema, oxyApplicationIdSchema, oxyCredentialIdSchema, requestIdSchema, } from '../public/identifiers.js';
25
- import { requestLabelsSchema } from '../public/messages.js';
25
+ import { MAX_INPUT_IMAGES, requestLabelsSchema } from '../public/messages.js';
26
26
  import { moneySchema } from '../public/money.js';
27
27
  import { routingPolicyReferenceSchema } from '../public/policy.js';
28
28
  import { inferenceScopeSchema } from './attribution.js';
@@ -107,6 +107,13 @@ export const grantRequestFactsSchema = z
107
107
  /** Embeddings: how many inputs. Images: how many images. */
108
108
  embeddingInputs: z.number().int().positive().max(2048).optional(),
109
109
  images: z.number().int().positive().max(10).optional(),
110
+ /**
111
+ * Completions: how many image parts the input carries (contract set 8.2.0,
112
+ * Kaana ADR 0007), present exactly when it carries one. Their bytes are not
113
+ * in `estimatedInputTokens`: Oxy bounds each image by the line's declared
114
+ * `imageInput.maxInputTokensPerImage` and admits only lines that declare it.
115
+ */
116
+ inputImages: z.number().int().positive().max(MAX_INPUT_IMAGES).optional(),
110
117
  /** How many tools the request declares; their definitions stay in Kaana. */
111
118
  declaredTools: z.number().int().nonnegative().max(128),
112
119
  stream: z.boolean(),
@@ -631,8 +631,8 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
631
631
  type: z.ZodLiteral<"message">;
632
632
  itemId: z.ZodOptional<z.ZodString>;
633
633
  role: z.ZodEnum<{
634
- user: "user";
635
634
  system: "system";
635
+ user: "user";
636
636
  assistant: "assistant";
637
637
  }>;
638
638
  content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -682,8 +682,8 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
682
682
  type: z.ZodLiteral<"message">;
683
683
  itemId: z.ZodOptional<z.ZodString>;
684
684
  role: z.ZodEnum<{
685
- user: "user";
686
685
  system: "system";
686
+ user: "user";
687
687
  assistant: "assistant";
688
688
  }>;
689
689
  content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -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
  }>;
@@ -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>;