@opencode/ai 0.0.0-dev-21779 → 0.0.0-dev-21787
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/protocols/alibaba-chat.d.ts +10 -0
- package/dist/protocols/anthropic-messages.js +0 -1
- package/dist/protocols/gemini.d.ts +0 -9
- package/dist/protocols/gemini.js +0 -2
- package/dist/protocols/openai-chat.d.ts +80 -0
- package/dist/protocols/openai-chat.js +7 -1
- package/dist/protocols/openai-compatible-chat.d.ts +10 -0
- package/dist/protocols/shared.d.ts +1 -8
- package/dist/protocols/shared.js +2 -6
- package/dist/protocols/venice-chat.d.ts +10 -0
- package/dist/protocols/zai-chat.d.ts +10 -0
- package/dist/provider-error.js +2 -0
- package/dist/providers/alibaba.d.ts +10 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +10 -0
- package/dist/providers/azure.d.ts +10 -0
- package/dist/providers/baseten.d.ts +20 -0
- package/dist/providers/cerebras.d.ts +20 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +20 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +20 -0
- package/dist/providers/cohere.d.ts +20 -0
- package/dist/providers/deepinfra.d.ts +20 -0
- package/dist/providers/deepseek.d.ts +20 -0
- package/dist/providers/digitalocean.d.ts +30 -0
- package/dist/providers/fireworks.d.ts +20 -0
- package/dist/providers/google-vertex-chat.d.ts +10 -0
- package/dist/providers/groq.d.ts +20 -0
- package/dist/providers/meta.d.ts +10 -0
- package/dist/providers/minimax.d.ts +10 -0
- package/dist/providers/moonshot.d.ts +10 -0
- package/dist/providers/openai-compatible.d.ts +10 -0
- package/dist/providers/openai.d.ts +10 -0
- package/dist/providers/openrouter.d.ts +40 -0
- package/dist/providers/togetherai.d.ts +20 -0
- package/dist/providers/venice.d.ts +10 -0
- package/dist/providers/xai.d.ts +10 -0
- package/dist/providers/zai-coding-plan.d.ts +10 -0
- package/dist/providers/zai.d.ts +10 -0
- package/dist/schema/events.d.ts +0 -2
- package/dist/schema/events.js +0 -2
- package/package.json +3 -3
|
@@ -42,6 +42,11 @@ export declare const protocol: Protocol<{
|
|
|
42
42
|
readonly image_url: {
|
|
43
43
|
readonly url: string;
|
|
44
44
|
};
|
|
45
|
+
} | {
|
|
46
|
+
readonly type: "video_url";
|
|
47
|
+
readonly video_url: {
|
|
48
|
+
readonly url: string;
|
|
49
|
+
};
|
|
45
50
|
} | {
|
|
46
51
|
readonly type: "file";
|
|
47
52
|
readonly file: {
|
|
@@ -63,6 +68,11 @@ export declare const protocol: Protocol<{
|
|
|
63
68
|
readonly image_url: {
|
|
64
69
|
readonly url: string;
|
|
65
70
|
};
|
|
71
|
+
} | {
|
|
72
|
+
readonly type: "video_url";
|
|
73
|
+
readonly video_url: {
|
|
74
|
+
readonly url: string;
|
|
75
|
+
};
|
|
66
76
|
} | {
|
|
67
77
|
readonly type: "file";
|
|
68
78
|
readonly file: {
|
|
@@ -1026,7 +1026,6 @@ const mergeUsage = (left, right, providerMetadataKey) => {
|
|
|
1026
1026
|
reasoningTokens,
|
|
1027
1027
|
totalTokens: ProviderShared.totalTokens(inputTokens, outputTokens, undefined),
|
|
1028
1028
|
cost: right.cost ?? left.cost,
|
|
1029
|
-
allowance: right.allowance ?? left.allowance,
|
|
1030
1029
|
providerMetadata: {
|
|
1031
1030
|
[providerMetadataKey]: mergeJsonRecords(left.providerMetadata?.[providerMetadataKey], right.providerMetadata?.[providerMetadataKey]) ??
|
|
1032
1031
|
{},
|
|
@@ -106,9 +106,6 @@ declare const GeminiBody: Schema.Struct<{
|
|
|
106
106
|
export type GeminiBody = Schema.Schema.Type<typeof GeminiBody>;
|
|
107
107
|
declare const GeminiUsage: Schema.Struct<{
|
|
108
108
|
readonly cost: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.Finite>, never>>;
|
|
109
|
-
readonly opencode: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.Struct<{
|
|
110
|
-
readonly allowance: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.Finite>, never>>;
|
|
111
|
-
}>>, never>>;
|
|
112
109
|
readonly cachedContentTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
113
110
|
readonly thoughtsTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
114
111
|
readonly promptTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
@@ -264,9 +261,6 @@ export declare const protocol: Protocol<{
|
|
|
264
261
|
} | null | undefined;
|
|
265
262
|
readonly usageMetadata?: {
|
|
266
263
|
readonly cost?: number | undefined;
|
|
267
|
-
readonly opencode?: {
|
|
268
|
-
readonly allowance?: number | undefined;
|
|
269
|
-
} | undefined;
|
|
270
264
|
readonly cachedContentTokenCount?: number | null | undefined;
|
|
271
265
|
readonly thoughtsTokenCount?: number | null | undefined;
|
|
272
266
|
readonly promptTokenCount?: number | null | undefined;
|
|
@@ -295,9 +289,6 @@ export declare const protocol: Protocol<{
|
|
|
295
289
|
} | null | undefined;
|
|
296
290
|
readonly usageMetadata?: {
|
|
297
291
|
readonly cost?: number | undefined;
|
|
298
|
-
readonly opencode?: {
|
|
299
|
-
readonly allowance?: number | undefined;
|
|
300
|
-
} | undefined;
|
|
301
292
|
readonly cachedContentTokenCount?: number | null | undefined;
|
|
302
293
|
readonly thoughtsTokenCount?: number | null | undefined;
|
|
303
294
|
readonly promptTokenCount?: number | null | undefined;
|
package/dist/protocols/gemini.js
CHANGED
|
@@ -433,7 +433,6 @@ const mapUsage = (usage, metadataKey, metadata = usage ?? {}) => {
|
|
|
433
433
|
reasoningTokens: thoughts,
|
|
434
434
|
totalTokens: ProviderShared.totalTokens(promptTokens, outputTokens, usage.totalTokenCount ?? undefined),
|
|
435
435
|
cost: usage.cost,
|
|
436
|
-
allowance: usage.opencode?.allowance,
|
|
437
436
|
providerMetadata: providerMetadata(metadataKey, metadata),
|
|
438
437
|
});
|
|
439
438
|
};
|
|
@@ -449,7 +448,6 @@ const mapContinuedUsage = (requests, metadataKey) => {
|
|
|
449
448
|
thoughtsTokenCount: sum("thoughtsTokenCount"),
|
|
450
449
|
// Every continued request is billed on its own.
|
|
451
450
|
cost: sum("cost"),
|
|
452
|
-
opencode: { allowance: ProviderShared.sumTokens(...requests.map((usage) => usage.opencode?.allowance)) },
|
|
453
451
|
}, metadataKey, {
|
|
454
452
|
promptTokenCount: sum("promptTokenCount"),
|
|
455
453
|
cachedContentTokenCount: sum("cachedContentTokenCount"),
|
|
@@ -77,6 +77,11 @@ export declare const OpenAIChatMessage: Schema.toTaggedUnion<"role", readonly [S
|
|
|
77
77
|
readonly image_url: Schema.Struct<{
|
|
78
78
|
readonly url: Schema.String;
|
|
79
79
|
}>;
|
|
80
|
+
}>, Schema.Struct<{
|
|
81
|
+
readonly type: Schema.Literal<"video_url">;
|
|
82
|
+
readonly video_url: Schema.Struct<{
|
|
83
|
+
readonly url: Schema.String;
|
|
84
|
+
}>;
|
|
80
85
|
}>, Schema.Struct<{
|
|
81
86
|
readonly type: Schema.Literal<"file">;
|
|
82
87
|
readonly file: Schema.Struct<{
|
|
@@ -98,6 +103,11 @@ export declare const OpenAIChatMessage: Schema.toTaggedUnion<"role", readonly [S
|
|
|
98
103
|
readonly image_url: Schema.Struct<{
|
|
99
104
|
readonly url: Schema.String;
|
|
100
105
|
}>;
|
|
106
|
+
}>, Schema.Struct<{
|
|
107
|
+
readonly type: Schema.Literal<"video_url">;
|
|
108
|
+
readonly video_url: Schema.Struct<{
|
|
109
|
+
readonly url: Schema.String;
|
|
110
|
+
}>;
|
|
101
111
|
}>, Schema.Struct<{
|
|
102
112
|
readonly type: Schema.Literal<"file">;
|
|
103
113
|
readonly file: Schema.Struct<{
|
|
@@ -161,6 +171,11 @@ export declare const bodyFields: {
|
|
|
161
171
|
readonly image_url: Schema.Struct<{
|
|
162
172
|
readonly url: Schema.String;
|
|
163
173
|
}>;
|
|
174
|
+
}>, Schema.Struct<{
|
|
175
|
+
readonly type: Schema.Literal<"video_url">;
|
|
176
|
+
readonly video_url: Schema.Struct<{
|
|
177
|
+
readonly url: Schema.String;
|
|
178
|
+
}>;
|
|
164
179
|
}>, Schema.Struct<{
|
|
165
180
|
readonly type: Schema.Literal<"file">;
|
|
166
181
|
readonly file: Schema.Struct<{
|
|
@@ -182,6 +197,11 @@ export declare const bodyFields: {
|
|
|
182
197
|
readonly image_url: Schema.Struct<{
|
|
183
198
|
readonly url: Schema.String;
|
|
184
199
|
}>;
|
|
200
|
+
}>, Schema.Struct<{
|
|
201
|
+
readonly type: Schema.Literal<"video_url">;
|
|
202
|
+
readonly video_url: Schema.Struct<{
|
|
203
|
+
readonly url: Schema.String;
|
|
204
|
+
}>;
|
|
185
205
|
}>, Schema.Struct<{
|
|
186
206
|
readonly type: Schema.Literal<"file">;
|
|
187
207
|
readonly file: Schema.Struct<{
|
|
@@ -280,6 +300,11 @@ declare const OpenAIChatBody: Schema.Struct<{
|
|
|
280
300
|
readonly image_url: Schema.Struct<{
|
|
281
301
|
readonly url: Schema.String;
|
|
282
302
|
}>;
|
|
303
|
+
}>, Schema.Struct<{
|
|
304
|
+
readonly type: Schema.Literal<"video_url">;
|
|
305
|
+
readonly video_url: Schema.Struct<{
|
|
306
|
+
readonly url: Schema.String;
|
|
307
|
+
}>;
|
|
283
308
|
}>, Schema.Struct<{
|
|
284
309
|
readonly type: Schema.Literal<"file">;
|
|
285
310
|
readonly file: Schema.Struct<{
|
|
@@ -301,6 +326,11 @@ declare const OpenAIChatBody: Schema.Struct<{
|
|
|
301
326
|
readonly image_url: Schema.Struct<{
|
|
302
327
|
readonly url: Schema.String;
|
|
303
328
|
}>;
|
|
329
|
+
}>, Schema.Struct<{
|
|
330
|
+
readonly type: Schema.Literal<"video_url">;
|
|
331
|
+
readonly video_url: Schema.Struct<{
|
|
332
|
+
readonly url: Schema.String;
|
|
333
|
+
}>;
|
|
304
334
|
}>, Schema.Struct<{
|
|
305
335
|
readonly type: Schema.Literal<"file">;
|
|
306
336
|
readonly file: Schema.Struct<{
|
|
@@ -575,6 +605,11 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
575
605
|
readonly image_url: {
|
|
576
606
|
readonly url: string;
|
|
577
607
|
};
|
|
608
|
+
} | {
|
|
609
|
+
readonly type: "video_url";
|
|
610
|
+
readonly video_url: {
|
|
611
|
+
readonly url: string;
|
|
612
|
+
};
|
|
578
613
|
} | {
|
|
579
614
|
readonly type: "file";
|
|
580
615
|
readonly file: {
|
|
@@ -596,6 +631,11 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
596
631
|
readonly image_url: {
|
|
597
632
|
readonly url: string;
|
|
598
633
|
};
|
|
634
|
+
} | {
|
|
635
|
+
readonly type: "video_url";
|
|
636
|
+
readonly video_url: {
|
|
637
|
+
readonly url: string;
|
|
638
|
+
};
|
|
599
639
|
} | {
|
|
600
640
|
readonly type: "file";
|
|
601
641
|
readonly file: {
|
|
@@ -695,6 +735,11 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
695
735
|
readonly image_url: {
|
|
696
736
|
readonly url: string;
|
|
697
737
|
};
|
|
738
|
+
} | {
|
|
739
|
+
readonly type: "video_url";
|
|
740
|
+
readonly video_url: {
|
|
741
|
+
readonly url: string;
|
|
742
|
+
};
|
|
698
743
|
} | {
|
|
699
744
|
readonly type: "file";
|
|
700
745
|
readonly file: {
|
|
@@ -716,6 +761,11 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
716
761
|
readonly image_url: {
|
|
717
762
|
readonly url: string;
|
|
718
763
|
};
|
|
764
|
+
} | {
|
|
765
|
+
readonly type: "video_url";
|
|
766
|
+
readonly video_url: {
|
|
767
|
+
readonly url: string;
|
|
768
|
+
};
|
|
719
769
|
} | {
|
|
720
770
|
readonly type: "file";
|
|
721
771
|
readonly file: {
|
|
@@ -1035,6 +1085,11 @@ export declare const protocol: Protocol<{
|
|
|
1035
1085
|
readonly image_url: {
|
|
1036
1086
|
readonly url: string;
|
|
1037
1087
|
};
|
|
1088
|
+
} | {
|
|
1089
|
+
readonly type: "video_url";
|
|
1090
|
+
readonly video_url: {
|
|
1091
|
+
readonly url: string;
|
|
1092
|
+
};
|
|
1038
1093
|
} | {
|
|
1039
1094
|
readonly type: "file";
|
|
1040
1095
|
readonly file: {
|
|
@@ -1056,6 +1111,11 @@ export declare const protocol: Protocol<{
|
|
|
1056
1111
|
readonly image_url: {
|
|
1057
1112
|
readonly url: string;
|
|
1058
1113
|
};
|
|
1114
|
+
} | {
|
|
1115
|
+
readonly type: "video_url";
|
|
1116
|
+
readonly video_url: {
|
|
1117
|
+
readonly url: string;
|
|
1118
|
+
};
|
|
1059
1119
|
} | {
|
|
1060
1120
|
readonly type: "file";
|
|
1061
1121
|
readonly file: {
|
|
@@ -1230,6 +1290,11 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
1230
1290
|
readonly image_url: {
|
|
1231
1291
|
readonly url: string;
|
|
1232
1292
|
};
|
|
1293
|
+
} | {
|
|
1294
|
+
readonly type: "video_url";
|
|
1295
|
+
readonly video_url: {
|
|
1296
|
+
readonly url: string;
|
|
1297
|
+
};
|
|
1233
1298
|
} | {
|
|
1234
1299
|
readonly type: "file";
|
|
1235
1300
|
readonly file: {
|
|
@@ -1251,6 +1316,11 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
1251
1316
|
readonly image_url: {
|
|
1252
1317
|
readonly url: string;
|
|
1253
1318
|
};
|
|
1319
|
+
} | {
|
|
1320
|
+
readonly type: "video_url";
|
|
1321
|
+
readonly video_url: {
|
|
1322
|
+
readonly url: string;
|
|
1323
|
+
};
|
|
1254
1324
|
} | {
|
|
1255
1325
|
readonly type: "file";
|
|
1256
1326
|
readonly file: {
|
|
@@ -1352,6 +1422,11 @@ export declare const route: Route<{
|
|
|
1352
1422
|
readonly image_url: {
|
|
1353
1423
|
readonly url: string;
|
|
1354
1424
|
};
|
|
1425
|
+
} | {
|
|
1426
|
+
readonly type: "video_url";
|
|
1427
|
+
readonly video_url: {
|
|
1428
|
+
readonly url: string;
|
|
1429
|
+
};
|
|
1355
1430
|
} | {
|
|
1356
1431
|
readonly type: "file";
|
|
1357
1432
|
readonly file: {
|
|
@@ -1373,6 +1448,11 @@ export declare const route: Route<{
|
|
|
1373
1448
|
readonly image_url: {
|
|
1374
1449
|
readonly url: string;
|
|
1375
1450
|
};
|
|
1451
|
+
} | {
|
|
1452
|
+
readonly type: "video_url";
|
|
1453
|
+
readonly video_url: {
|
|
1454
|
+
readonly url: string;
|
|
1455
|
+
};
|
|
1376
1456
|
} | {
|
|
1377
1457
|
readonly type: "file";
|
|
1378
1458
|
readonly file: {
|
|
@@ -90,6 +90,10 @@ const OpenAIChatUserContent = Schema.Union([
|
|
|
90
90
|
type: Schema.Literal("image_url"),
|
|
91
91
|
image_url: Schema.Struct({ url: Schema.String }),
|
|
92
92
|
}),
|
|
93
|
+
Schema.Struct({
|
|
94
|
+
type: Schema.Literal("video_url"),
|
|
95
|
+
video_url: Schema.Struct({ url: Schema.String }),
|
|
96
|
+
}),
|
|
93
97
|
Schema.Struct({
|
|
94
98
|
type: Schema.Literal("file"),
|
|
95
99
|
file: Schema.Struct({ filename: Schema.String, file_data: Schema.String }),
|
|
@@ -244,9 +248,11 @@ const lowerMedia = Effect.fnUntraced(function* (part) {
|
|
|
244
248
|
file_data: (yield* ProviderShared.requireInlineMedia("OpenAI Chat", part.media)).dataUrl,
|
|
245
249
|
},
|
|
246
250
|
};
|
|
247
|
-
if (part.media.kind !== "image")
|
|
251
|
+
if (part.media.kind !== "image" && part.media.kind !== "video")
|
|
248
252
|
return yield* ProviderShared.invalidRequest(`OpenAI Chat does not support media type ${part.media.mediaType}`);
|
|
249
253
|
const url = ProviderShared.mediaUrl(part.media) ?? (yield* ProviderShared.requireInlineMedia("OpenAI Chat", part.media)).dataUrl;
|
|
254
|
+
if (part.media.kind === "video")
|
|
255
|
+
return { type: "video_url", video_url: { url } };
|
|
250
256
|
return { type: "image_url", image_url: { url } };
|
|
251
257
|
});
|
|
252
258
|
const openAICompatibleReasoningContent = (native) => isRecord(native) && typeof native.reasoning_content === "string" ? native.reasoning_content : undefined;
|
|
@@ -15,6 +15,11 @@ export declare const route: Route<{
|
|
|
15
15
|
readonly image_url: {
|
|
16
16
|
readonly url: string;
|
|
17
17
|
};
|
|
18
|
+
} | {
|
|
19
|
+
readonly type: "video_url";
|
|
20
|
+
readonly video_url: {
|
|
21
|
+
readonly url: string;
|
|
22
|
+
};
|
|
18
23
|
} | {
|
|
19
24
|
readonly type: "file";
|
|
20
25
|
readonly file: {
|
|
@@ -36,6 +41,11 @@ export declare const route: Route<{
|
|
|
36
41
|
readonly image_url: {
|
|
37
42
|
readonly url: string;
|
|
38
43
|
};
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "video_url";
|
|
46
|
+
readonly video_url: {
|
|
47
|
+
readonly url: string;
|
|
48
|
+
};
|
|
39
49
|
} | {
|
|
40
50
|
readonly type: "file";
|
|
41
51
|
readonly file: {
|
|
@@ -13,20 +13,13 @@ export declare const optionalNull: <const S extends Schema.Top>(schema: S) => Sc
|
|
|
13
13
|
export declare const optionalNullish: <const S extends Schema.Top>(schema: S) => Schema.decodeTo<Schema.optional<Schema.toType<S>>, Schema.optional<Schema.NullOr<S>>, never, never>;
|
|
14
14
|
/** Optional field whose malformed value decodes to `undefined` instead of failing the enclosing struct. */
|
|
15
15
|
export declare const lenient: <const S extends Schema.Top>(schema: S) => Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<S>, S["DecodingServices"]>>;
|
|
16
|
-
/**
|
|
17
|
-
* Billing an endpoint reports beside its token usage. `cost` is the USD it charged (OpenRouter, LiteLLM, OpenCode
|
|
18
|
-
* Zen); OpenCode Go reports the subscription allowance a request used as `opencode.allowance`, also in USD.
|
|
19
|
-
*/
|
|
16
|
+
/** Billing an endpoint reports beside its token usage: `cost` is the USD it charged (OpenRouter, LiteLLM, OpenCode Zen). */
|
|
20
17
|
export declare const ReportedBilling: Schema.Struct<{
|
|
21
18
|
readonly cost: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.Finite>, never>>;
|
|
22
|
-
readonly opencode: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.Struct<{
|
|
23
|
-
readonly allowance: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.Finite>, never>>;
|
|
24
|
-
}>>, never>>;
|
|
25
19
|
}>;
|
|
26
20
|
/** Reads `ReportedBilling` from a raw usage object, which provider metadata keeps as the endpoint sent it. */
|
|
27
21
|
export declare const reportedBilling: (usage: unknown) => {} | {
|
|
28
22
|
cost: number | undefined;
|
|
29
|
-
allowance: number | undefined;
|
|
30
23
|
};
|
|
31
24
|
/**
|
|
32
25
|
* Accepts stream frames that carry no `type`, alongside the typed event schema. Gateways inject such frames as
|
package/dist/protocols/shared.js
CHANGED
|
@@ -19,18 +19,14 @@ export const optionalNullish = (schema) => Schema.optional(Schema.NullOr(schema)
|
|
|
19
19
|
export const lenient = (schema) => Schema.optionalKey(Schema.UndefinedOr(schema).pipe(Schema.catchDecoding(() => Effect.succeed(Option.some(undefined)))));
|
|
20
20
|
/** A billed amount in USD; a malformed or negative one decodes as absent. */
|
|
21
21
|
const billedAmount = lenient(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0)));
|
|
22
|
-
/**
|
|
23
|
-
* Billing an endpoint reports beside its token usage. `cost` is the USD it charged (OpenRouter, LiteLLM, OpenCode
|
|
24
|
-
* Zen); OpenCode Go reports the subscription allowance a request used as `opencode.allowance`, also in USD.
|
|
25
|
-
*/
|
|
22
|
+
/** Billing an endpoint reports beside its token usage: `cost` is the USD it charged (OpenRouter, LiteLLM, OpenCode Zen). */
|
|
26
23
|
export const ReportedBilling = Schema.Struct({
|
|
27
24
|
cost: billedAmount,
|
|
28
|
-
opencode: lenient(Schema.Struct({ allowance: billedAmount })),
|
|
29
25
|
});
|
|
30
26
|
/** Reads `ReportedBilling` from a raw usage object, which provider metadata keeps as the endpoint sent it. */
|
|
31
27
|
export const reportedBilling = (usage) => Option.match(Schema.decodeUnknownOption(ReportedBilling)(usage), {
|
|
32
28
|
onNone: () => ({}),
|
|
33
|
-
onSome: (billing) => ({ cost: billing.cost
|
|
29
|
+
onSome: (billing) => ({ cost: billing.cost }),
|
|
34
30
|
});
|
|
35
31
|
/**
|
|
36
32
|
* Accepts stream frames that carry no `type`, alongside the typed event schema. Gateways inject such frames as
|
|
@@ -96,6 +96,11 @@ export declare const protocol: Protocol<{
|
|
|
96
96
|
readonly image_url: {
|
|
97
97
|
readonly url: string;
|
|
98
98
|
};
|
|
99
|
+
} | {
|
|
100
|
+
readonly type: "video_url";
|
|
101
|
+
readonly video_url: {
|
|
102
|
+
readonly url: string;
|
|
103
|
+
};
|
|
99
104
|
} | {
|
|
100
105
|
readonly type: "file";
|
|
101
106
|
readonly file: {
|
|
@@ -117,6 +122,11 @@ export declare const protocol: Protocol<{
|
|
|
117
122
|
readonly image_url: {
|
|
118
123
|
readonly url: string;
|
|
119
124
|
};
|
|
125
|
+
} | {
|
|
126
|
+
readonly type: "video_url";
|
|
127
|
+
readonly video_url: {
|
|
128
|
+
readonly url: string;
|
|
129
|
+
};
|
|
120
130
|
} | {
|
|
121
131
|
readonly type: "file";
|
|
122
132
|
readonly file: {
|
|
@@ -34,6 +34,11 @@ export declare const protocol: Protocol<{
|
|
|
34
34
|
readonly image_url: {
|
|
35
35
|
readonly url: string;
|
|
36
36
|
};
|
|
37
|
+
} | {
|
|
38
|
+
readonly type: "video_url";
|
|
39
|
+
readonly video_url: {
|
|
40
|
+
readonly url: string;
|
|
41
|
+
};
|
|
37
42
|
} | {
|
|
38
43
|
readonly type: "file";
|
|
39
44
|
readonly file: {
|
|
@@ -55,6 +60,11 @@ export declare const protocol: Protocol<{
|
|
|
55
60
|
readonly image_url: {
|
|
56
61
|
readonly url: string;
|
|
57
62
|
};
|
|
63
|
+
} | {
|
|
64
|
+
readonly type: "video_url";
|
|
65
|
+
readonly video_url: {
|
|
66
|
+
readonly url: string;
|
|
67
|
+
};
|
|
58
68
|
} | {
|
|
59
69
|
readonly type: "file";
|
|
60
70
|
readonly file: {
|
package/dist/provider-error.js
CHANGED
|
@@ -50,6 +50,8 @@ const exclusions = [
|
|
|
50
50
|
/too many requests/i,
|
|
51
51
|
// Cohere reports an output limit above the model maximum as "too many tokens"; compaction cannot fix it.
|
|
52
52
|
/max[_ ]tokens must be less than/i,
|
|
53
|
+
// Bedrock phrases throttling as "Too many tokens[, per day], please wait..."; it is a 429 to retry, not overflow.
|
|
54
|
+
/too many tokens(?: per day)?, please wait/i,
|
|
53
55
|
];
|
|
54
56
|
export const isContextOverflow = (message) => !exclusions.some((pattern) => pattern.test(message)) &&
|
|
55
57
|
(patterns.some((pattern) => pattern.test(message)) || /^4(?:00|13)\s*(status code)?\s*\(no body\)/i.test(message));
|
|
@@ -33,6 +33,11 @@ export declare const routes: (Route<{
|
|
|
33
33
|
readonly image_url: {
|
|
34
34
|
readonly url: string;
|
|
35
35
|
};
|
|
36
|
+
} | {
|
|
37
|
+
readonly type: "video_url";
|
|
38
|
+
readonly video_url: {
|
|
39
|
+
readonly url: string;
|
|
40
|
+
};
|
|
36
41
|
} | {
|
|
37
42
|
readonly type: "file";
|
|
38
43
|
readonly file: {
|
|
@@ -54,6 +59,11 @@ export declare const routes: (Route<{
|
|
|
54
59
|
readonly image_url: {
|
|
55
60
|
readonly url: string;
|
|
56
61
|
};
|
|
62
|
+
} | {
|
|
63
|
+
readonly type: "video_url";
|
|
64
|
+
readonly video_url: {
|
|
65
|
+
readonly url: string;
|
|
66
|
+
};
|
|
57
67
|
} | {
|
|
58
68
|
readonly type: "file";
|
|
59
69
|
readonly file: {
|
|
@@ -311,6 +311,11 @@ export declare const routes: (Route<{
|
|
|
311
311
|
readonly image_url: {
|
|
312
312
|
readonly url: string;
|
|
313
313
|
};
|
|
314
|
+
} | {
|
|
315
|
+
readonly type: "video_url";
|
|
316
|
+
readonly video_url: {
|
|
317
|
+
readonly url: string;
|
|
318
|
+
};
|
|
314
319
|
} | {
|
|
315
320
|
readonly type: "file";
|
|
316
321
|
readonly file: {
|
|
@@ -332,6 +337,11 @@ export declare const routes: (Route<{
|
|
|
332
337
|
readonly image_url: {
|
|
333
338
|
readonly url: string;
|
|
334
339
|
};
|
|
340
|
+
} | {
|
|
341
|
+
readonly type: "video_url";
|
|
342
|
+
readonly video_url: {
|
|
343
|
+
readonly url: string;
|
|
344
|
+
};
|
|
335
345
|
} | {
|
|
336
346
|
readonly type: "file";
|
|
337
347
|
readonly file: {
|
|
@@ -236,6 +236,11 @@ export declare const routes: (Route<{
|
|
|
236
236
|
readonly image_url: {
|
|
237
237
|
readonly url: string;
|
|
238
238
|
};
|
|
239
|
+
} | {
|
|
240
|
+
readonly type: "video_url";
|
|
241
|
+
readonly video_url: {
|
|
242
|
+
readonly url: string;
|
|
243
|
+
};
|
|
239
244
|
} | {
|
|
240
245
|
readonly type: "file";
|
|
241
246
|
readonly file: {
|
|
@@ -257,6 +262,11 @@ export declare const routes: (Route<{
|
|
|
257
262
|
readonly image_url: {
|
|
258
263
|
readonly url: string;
|
|
259
264
|
};
|
|
265
|
+
} | {
|
|
266
|
+
readonly type: "video_url";
|
|
267
|
+
readonly video_url: {
|
|
268
|
+
readonly url: string;
|
|
269
|
+
};
|
|
260
270
|
} | {
|
|
261
271
|
readonly type: "file";
|
|
262
272
|
readonly file: {
|
|
@@ -25,6 +25,11 @@ export declare const route: Route<{
|
|
|
25
25
|
readonly image_url: {
|
|
26
26
|
readonly url: string;
|
|
27
27
|
};
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: "video_url";
|
|
30
|
+
readonly video_url: {
|
|
31
|
+
readonly url: string;
|
|
32
|
+
};
|
|
28
33
|
} | {
|
|
29
34
|
readonly type: "file";
|
|
30
35
|
readonly file: {
|
|
@@ -46,6 +51,11 @@ export declare const route: Route<{
|
|
|
46
51
|
readonly image_url: {
|
|
47
52
|
readonly url: string;
|
|
48
53
|
};
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: "video_url";
|
|
56
|
+
readonly video_url: {
|
|
57
|
+
readonly url: string;
|
|
58
|
+
};
|
|
49
59
|
} | {
|
|
50
60
|
readonly type: "file";
|
|
51
61
|
readonly file: {
|
|
@@ -147,6 +157,11 @@ export declare const routes: Route<{
|
|
|
147
157
|
readonly image_url: {
|
|
148
158
|
readonly url: string;
|
|
149
159
|
};
|
|
160
|
+
} | {
|
|
161
|
+
readonly type: "video_url";
|
|
162
|
+
readonly video_url: {
|
|
163
|
+
readonly url: string;
|
|
164
|
+
};
|
|
150
165
|
} | {
|
|
151
166
|
readonly type: "file";
|
|
152
167
|
readonly file: {
|
|
@@ -168,6 +183,11 @@ export declare const routes: Route<{
|
|
|
168
183
|
readonly image_url: {
|
|
169
184
|
readonly url: string;
|
|
170
185
|
};
|
|
186
|
+
} | {
|
|
187
|
+
readonly type: "video_url";
|
|
188
|
+
readonly video_url: {
|
|
189
|
+
readonly url: string;
|
|
190
|
+
};
|
|
171
191
|
} | {
|
|
172
192
|
readonly type: "file";
|
|
173
193
|
readonly file: {
|
|
@@ -21,6 +21,11 @@ export declare const route: Route<{
|
|
|
21
21
|
readonly image_url: {
|
|
22
22
|
readonly url: string;
|
|
23
23
|
};
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "video_url";
|
|
26
|
+
readonly video_url: {
|
|
27
|
+
readonly url: string;
|
|
28
|
+
};
|
|
24
29
|
} | {
|
|
25
30
|
readonly type: "file";
|
|
26
31
|
readonly file: {
|
|
@@ -42,6 +47,11 @@ export declare const route: Route<{
|
|
|
42
47
|
readonly image_url: {
|
|
43
48
|
readonly url: string;
|
|
44
49
|
};
|
|
50
|
+
} | {
|
|
51
|
+
readonly type: "video_url";
|
|
52
|
+
readonly video_url: {
|
|
53
|
+
readonly url: string;
|
|
54
|
+
};
|
|
45
55
|
} | {
|
|
46
56
|
readonly type: "file";
|
|
47
57
|
readonly file: {
|
|
@@ -143,6 +153,11 @@ export declare const routes: Route<{
|
|
|
143
153
|
readonly image_url: {
|
|
144
154
|
readonly url: string;
|
|
145
155
|
};
|
|
156
|
+
} | {
|
|
157
|
+
readonly type: "video_url";
|
|
158
|
+
readonly video_url: {
|
|
159
|
+
readonly url: string;
|
|
160
|
+
};
|
|
146
161
|
} | {
|
|
147
162
|
readonly type: "file";
|
|
148
163
|
readonly file: {
|
|
@@ -164,6 +179,11 @@ export declare const routes: Route<{
|
|
|
164
179
|
readonly image_url: {
|
|
165
180
|
readonly url: string;
|
|
166
181
|
};
|
|
182
|
+
} | {
|
|
183
|
+
readonly type: "video_url";
|
|
184
|
+
readonly video_url: {
|
|
185
|
+
readonly url: string;
|
|
186
|
+
};
|
|
167
187
|
} | {
|
|
168
188
|
readonly type: "file";
|
|
169
189
|
readonly file: {
|
|
@@ -518,6 +518,11 @@ export declare const route: import("../route/client.js").Route<{
|
|
|
518
518
|
readonly image_url: {
|
|
519
519
|
readonly url: string;
|
|
520
520
|
};
|
|
521
|
+
} | {
|
|
522
|
+
readonly type: "video_url";
|
|
523
|
+
readonly video_url: {
|
|
524
|
+
readonly url: string;
|
|
525
|
+
};
|
|
521
526
|
} | {
|
|
522
527
|
readonly type: "file";
|
|
523
528
|
readonly file: {
|
|
@@ -539,6 +544,11 @@ export declare const route: import("../route/client.js").Route<{
|
|
|
539
544
|
readonly image_url: {
|
|
540
545
|
readonly url: string;
|
|
541
546
|
};
|
|
547
|
+
} | {
|
|
548
|
+
readonly type: "video_url";
|
|
549
|
+
readonly video_url: {
|
|
550
|
+
readonly url: string;
|
|
551
|
+
};
|
|
542
552
|
} | {
|
|
543
553
|
readonly type: "file";
|
|
544
554
|
readonly file: {
|
|
@@ -912,6 +922,11 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
912
922
|
readonly image_url: {
|
|
913
923
|
readonly url: string;
|
|
914
924
|
};
|
|
925
|
+
} | {
|
|
926
|
+
readonly type: "video_url";
|
|
927
|
+
readonly video_url: {
|
|
928
|
+
readonly url: string;
|
|
929
|
+
};
|
|
915
930
|
} | {
|
|
916
931
|
readonly type: "file";
|
|
917
932
|
readonly file: {
|
|
@@ -933,6 +948,11 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
933
948
|
readonly image_url: {
|
|
934
949
|
readonly url: string;
|
|
935
950
|
};
|
|
951
|
+
} | {
|
|
952
|
+
readonly type: "video_url";
|
|
953
|
+
readonly video_url: {
|
|
954
|
+
readonly url: string;
|
|
955
|
+
};
|
|
936
956
|
} | {
|
|
937
957
|
readonly type: "file";
|
|
938
958
|
readonly file: {
|