@opencode/ai 2.1.3 → 2.1.4
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/experimental/evaluation.js +3 -10
- package/dist/image-client.d.ts +8 -8
- package/dist/image.d.ts +148 -148
- package/dist/promise.d.ts +120 -120
- package/dist/protocols/alibaba-chat.d.ts +12 -12
- package/dist/protocols/alibaba-messages.d.ts +11 -11
- package/dist/protocols/alibaba-responses.d.ts +35 -35
- package/dist/protocols/anthropic-messages.d.ts +40 -44
- package/dist/protocols/anthropic-messages.js +3 -3
- package/dist/protocols/bedrock-converse.d.ts +30 -32
- package/dist/protocols/bedrock-converse.js +2 -3
- package/dist/protocols/cartesia-speech.d.ts +32 -32
- package/dist/protocols/cohere-chat.d.ts +7 -8
- package/dist/protocols/deepgram-speech.d.ts +32 -32
- package/dist/protocols/elevenlabs-speech.d.ts +32 -32
- package/dist/protocols/gemini.d.ts +34 -34
- package/dist/protocols/gemini.js +2 -2
- package/dist/protocols/google-interactions.d.ts +14 -14
- package/dist/protocols/google-interactions.js +2 -2
- package/dist/protocols/google-speech.d.ts +32 -32
- package/dist/protocols/google-transcription.d.ts +32 -32
- package/dist/protocols/meta-messages.d.ts +23 -23
- package/dist/protocols/meta-responses.d.ts +78 -78
- package/dist/protocols/mistral-chat.d.ts +81 -78
- package/dist/protocols/mistral-chat.js +2 -1
- package/dist/protocols/open-responses-channel.js +47 -46
- package/dist/protocols/open-responses-continuation.d.ts +8 -2
- package/dist/protocols/open-responses-continuation.js +3 -1
- package/dist/protocols/open-responses.d.ts +398 -398
- package/dist/protocols/open-responses.js +8 -7
- package/dist/protocols/openai-chat.d.ts +60 -60
- package/dist/protocols/openai-chat.js +3 -3
- package/dist/protocols/openai-compatible-chat.d.ts +13 -14
- package/dist/protocols/openai-compatible-responses.d.ts +36 -37
- package/dist/protocols/openai-images.d.ts +32 -32
- package/dist/protocols/openai-responses.d.ts +235 -235
- package/dist/protocols/openai-responses.js +1 -1
- package/dist/protocols/openai-speech.d.ts +32 -32
- package/dist/protocols/openai-transcription.d.ts +32 -32
- package/dist/protocols/openai-transcription.js +12 -7
- package/dist/protocols/utils/partial-json-options.d.ts +0 -1
- package/dist/protocols/utils/partial-json-options.js +0 -1
- package/dist/protocols/utils/tool-stream.d.ts +1 -1
- package/dist/protocols/venice-chat.d.ts +52 -53
- package/dist/protocols/venice-chat.js +6 -5
- package/dist/protocols/xai-responses.d.ts +78 -78
- package/dist/protocols/zai-chat.d.ts +33 -30
- package/dist/protocols/zai-chat.js +8 -3
- package/dist/protocols/zai-messages.d.ts +21 -19
- package/dist/protocols/zai-messages.js +3 -2
- package/dist/provider-error.js +5 -3
- package/dist/providers/alibaba.d.ts +69 -69
- package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
- package/dist/providers/amazon-bedrock.d.ts +15 -15
- package/dist/providers/anthropic-compatible.d.ts +13 -13
- package/dist/providers/anthropic.d.ts +13 -13
- package/dist/providers/azure.d.ts +106 -106
- package/dist/providers/baseten.d.ts +24 -24
- package/dist/providers/cerebras.d.ts +24 -24
- package/dist/providers/cloudflare-ai-gateway.d.ts +230 -227
- package/dist/providers/cloudflare-ai-gateway.js +1 -2
- package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
- package/dist/providers/cohere.d.ts +75 -75
- package/dist/providers/deepinfra.d.ts +24 -24
- package/dist/providers/deepseek.d.ts +24 -24
- package/dist/providers/digitalocean.d.ts +36 -36
- package/dist/providers/fireworks.d.ts +24 -24
- package/dist/providers/google-vertex-chat.d.ts +12 -12
- package/dist/providers/google-vertex-messages.d.ts +13 -13
- package/dist/providers/google-vertex-mistral.d.ts +17 -17
- package/dist/providers/google-vertex-responses.d.ts +35 -35
- package/dist/providers/google-vertex.d.ts +17 -17
- package/dist/providers/google-vertex.js +2 -2
- package/dist/providers/google.d.ts +17 -17
- package/dist/providers/groq.d.ts +24 -24
- package/dist/providers/meta.d.ts +179 -179
- package/dist/providers/minimax.d.ts +71 -71
- package/dist/providers/mistral.d.ts +28 -28
- package/dist/providers/moonshot.d.ts +202 -202
- package/dist/providers/open-responses-options.d.ts +0 -1
- package/dist/providers/open-responses-options.js +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +35 -35
- package/dist/providers/openai-compatible.d.ts +12 -12
- package/dist/providers/openai-compatible.js +1 -1
- package/dist/providers/openai-options.d.ts +0 -1
- package/dist/providers/openai-options.js +0 -1
- package/dist/providers/openai.d.ts +100 -100
- package/dist/providers/openrouter.d.ts +36 -36
- package/dist/providers/togetherai.d.ts +24 -24
- package/dist/providers/venice.d.ts +195 -20
- package/dist/providers/xai.d.ts +12 -12
- package/dist/providers/zai-coding-plan.d.ts +149 -69
- package/dist/providers/zai.d.ts +84 -19
- package/dist/route/auth-options.d.ts +0 -3
- package/dist/route/auth.d.ts +0 -2
- package/dist/route/auth.js +0 -2
- package/dist/route/client.d.ts +0 -2
- package/dist/route/client.js +3 -4
- package/dist/route/executor-service.js +1 -1
- package/dist/speech-client.d.ts +8 -8
- package/dist/speech.d.ts +148 -148
- package/dist/transcription-client.d.ts +8 -8
- package/dist/transcription.d.ts +148 -148
- package/dist/video-client.d.ts +8 -8
- package/dist/video.d.ts +114 -114
- package/package.json +6 -5
|
@@ -566,7 +566,7 @@ export const lowerConversation = Effect.fnUntraced(function* (request, adapter)
|
|
|
566
566
|
export const lowerGeneration = (request, options = OpenResponsesOptions.resolve(request)) => {
|
|
567
567
|
const generation = request.generation;
|
|
568
568
|
const cacheKey = ProviderShared.promptCacheKey(request);
|
|
569
|
-
const parallelToolCalls = resolveParallelToolCalls(request);
|
|
569
|
+
const parallelToolCalls = resolveParallelToolCalls(request, options);
|
|
570
570
|
return {
|
|
571
571
|
stream: true,
|
|
572
572
|
max_output_tokens: generation?.maxTokens,
|
|
@@ -593,15 +593,15 @@ export const lowerGeneration = (request, options = OpenResponsesOptions.resolve(
|
|
|
593
593
|
...(options.truncation ? { truncation: options.truncation } : {}),
|
|
594
594
|
};
|
|
595
595
|
};
|
|
596
|
-
export const resolveParallelToolCalls = (request) => {
|
|
597
|
-
const configured =
|
|
596
|
+
export const resolveParallelToolCalls = (request, options = OpenResponsesOptions.resolve(request)) => {
|
|
597
|
+
const configured = options.parallelToolCalls;
|
|
598
598
|
if (configured !== undefined)
|
|
599
599
|
return configured;
|
|
600
600
|
const disabled = request.toolChoice?.disableParallelToolUse;
|
|
601
601
|
return disabled === undefined ? undefined : !disabled;
|
|
602
602
|
};
|
|
603
|
-
export const allowedToolChoice = (request) => {
|
|
604
|
-
const allowed =
|
|
603
|
+
export const allowedToolChoice = (request, options = OpenResponsesOptions.resolve(request)) => {
|
|
604
|
+
const allowed = options.allowedTools;
|
|
605
605
|
if (!allowed)
|
|
606
606
|
return undefined;
|
|
607
607
|
return {
|
|
@@ -612,11 +612,12 @@ export const allowedToolChoice = (request) => {
|
|
|
612
612
|
};
|
|
613
613
|
export const fromRequestWithAdapter = Effect.fn("OpenResponses.fromRequestWithAdapter")(function* (request, adapter) {
|
|
614
614
|
const projected = ProviderShared.flattenToolRequest(request);
|
|
615
|
+
const options = OpenResponsesOptions.resolve(request);
|
|
615
616
|
return {
|
|
616
617
|
...(yield* lowerConversation(projected.request, adapter)),
|
|
617
|
-
...lowerGeneration(request),
|
|
618
|
+
...lowerGeneration(request, options),
|
|
618
619
|
tools: projected.tools.length === 0 ? undefined : yield* lowerTools(projected.tools, adapter),
|
|
619
|
-
tool_choice: allowedToolChoice(request) ??
|
|
620
|
+
tool_choice: allowedToolChoice(request, options) ??
|
|
620
621
|
(request.toolChoice ? yield* lowerToolChoice(adapter.name, request.toolChoice) : undefined),
|
|
621
622
|
};
|
|
622
623
|
});
|
|
@@ -571,13 +571,6 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
571
571
|
messages: ({
|
|
572
572
|
readonly role: "system";
|
|
573
573
|
readonly content: string | readonly ({
|
|
574
|
-
readonly type: "text";
|
|
575
|
-
readonly text: string;
|
|
576
|
-
readonly cache_control?: {
|
|
577
|
-
readonly type: "ephemeral";
|
|
578
|
-
readonly ttl?: string | undefined;
|
|
579
|
-
} | undefined;
|
|
580
|
-
} | {
|
|
581
574
|
readonly type: "image_url";
|
|
582
575
|
readonly image_url: {
|
|
583
576
|
readonly url: string;
|
|
@@ -588,17 +581,17 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
588
581
|
readonly filename: string;
|
|
589
582
|
readonly file_data: string;
|
|
590
583
|
};
|
|
591
|
-
}
|
|
592
|
-
} | {
|
|
593
|
-
readonly role: "user";
|
|
594
|
-
readonly content: string | readonly ({
|
|
584
|
+
} | {
|
|
595
585
|
readonly type: "text";
|
|
596
586
|
readonly text: string;
|
|
597
587
|
readonly cache_control?: {
|
|
598
588
|
readonly type: "ephemeral";
|
|
599
589
|
readonly ttl?: string | undefined;
|
|
600
590
|
} | undefined;
|
|
601
|
-
}
|
|
591
|
+
})[];
|
|
592
|
+
} | {
|
|
593
|
+
readonly role: "user";
|
|
594
|
+
readonly content: string | readonly ({
|
|
602
595
|
readonly type: "image_url";
|
|
603
596
|
readonly image_url: {
|
|
604
597
|
readonly url: string;
|
|
@@ -609,6 +602,13 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
609
602
|
readonly filename: string;
|
|
610
603
|
readonly file_data: string;
|
|
611
604
|
};
|
|
605
|
+
} | {
|
|
606
|
+
readonly type: "text";
|
|
607
|
+
readonly text: string;
|
|
608
|
+
readonly cache_control?: {
|
|
609
|
+
readonly type: "ephemeral";
|
|
610
|
+
readonly ttl?: string | undefined;
|
|
611
|
+
} | undefined;
|
|
612
612
|
})[];
|
|
613
613
|
} | {
|
|
614
614
|
readonly role: "tool";
|
|
@@ -691,13 +691,6 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
691
691
|
messages: ({
|
|
692
692
|
readonly role: "system";
|
|
693
693
|
readonly content: string | readonly ({
|
|
694
|
-
readonly type: "text";
|
|
695
|
-
readonly text: string;
|
|
696
|
-
readonly cache_control?: {
|
|
697
|
-
readonly type: "ephemeral";
|
|
698
|
-
readonly ttl?: string | undefined;
|
|
699
|
-
} | undefined;
|
|
700
|
-
} | {
|
|
701
694
|
readonly type: "image_url";
|
|
702
695
|
readonly image_url: {
|
|
703
696
|
readonly url: string;
|
|
@@ -708,17 +701,17 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
708
701
|
readonly filename: string;
|
|
709
702
|
readonly file_data: string;
|
|
710
703
|
};
|
|
711
|
-
}
|
|
712
|
-
} | {
|
|
713
|
-
readonly role: "user";
|
|
714
|
-
readonly content: string | readonly ({
|
|
704
|
+
} | {
|
|
715
705
|
readonly type: "text";
|
|
716
706
|
readonly text: string;
|
|
717
707
|
readonly cache_control?: {
|
|
718
708
|
readonly type: "ephemeral";
|
|
719
709
|
readonly ttl?: string | undefined;
|
|
720
710
|
} | undefined;
|
|
721
|
-
}
|
|
711
|
+
})[];
|
|
712
|
+
} | {
|
|
713
|
+
readonly role: "user";
|
|
714
|
+
readonly content: string | readonly ({
|
|
722
715
|
readonly type: "image_url";
|
|
723
716
|
readonly image_url: {
|
|
724
717
|
readonly url: string;
|
|
@@ -729,6 +722,13 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
|
|
|
729
722
|
readonly filename: string;
|
|
730
723
|
readonly file_data: string;
|
|
731
724
|
};
|
|
725
|
+
} | {
|
|
726
|
+
readonly type: "text";
|
|
727
|
+
readonly text: string;
|
|
728
|
+
readonly cache_control?: {
|
|
729
|
+
readonly type: "ephemeral";
|
|
730
|
+
readonly ttl?: string | undefined;
|
|
731
|
+
} | undefined;
|
|
732
732
|
})[];
|
|
733
733
|
} | {
|
|
734
734
|
readonly role: "tool";
|
|
@@ -1031,13 +1031,6 @@ export declare const protocol: Protocol<{
|
|
|
1031
1031
|
readonly messages: readonly ({
|
|
1032
1032
|
readonly role: "system";
|
|
1033
1033
|
readonly content: string | readonly ({
|
|
1034
|
-
readonly type: "text";
|
|
1035
|
-
readonly text: string;
|
|
1036
|
-
readonly cache_control?: {
|
|
1037
|
-
readonly type: "ephemeral";
|
|
1038
|
-
readonly ttl?: string | undefined;
|
|
1039
|
-
} | undefined;
|
|
1040
|
-
} | {
|
|
1041
1034
|
readonly type: "image_url";
|
|
1042
1035
|
readonly image_url: {
|
|
1043
1036
|
readonly url: string;
|
|
@@ -1048,17 +1041,17 @@ export declare const protocol: Protocol<{
|
|
|
1048
1041
|
readonly filename: string;
|
|
1049
1042
|
readonly file_data: string;
|
|
1050
1043
|
};
|
|
1051
|
-
}
|
|
1052
|
-
} | {
|
|
1053
|
-
readonly role: "user";
|
|
1054
|
-
readonly content: string | readonly ({
|
|
1044
|
+
} | {
|
|
1055
1045
|
readonly type: "text";
|
|
1056
1046
|
readonly text: string;
|
|
1057
1047
|
readonly cache_control?: {
|
|
1058
1048
|
readonly type: "ephemeral";
|
|
1059
1049
|
readonly ttl?: string | undefined;
|
|
1060
1050
|
} | undefined;
|
|
1061
|
-
}
|
|
1051
|
+
})[];
|
|
1052
|
+
} | {
|
|
1053
|
+
readonly role: "user";
|
|
1054
|
+
readonly content: string | readonly ({
|
|
1062
1055
|
readonly type: "image_url";
|
|
1063
1056
|
readonly image_url: {
|
|
1064
1057
|
readonly url: string;
|
|
@@ -1069,6 +1062,13 @@ export declare const protocol: Protocol<{
|
|
|
1069
1062
|
readonly filename: string;
|
|
1070
1063
|
readonly file_data: string;
|
|
1071
1064
|
};
|
|
1065
|
+
} | {
|
|
1066
|
+
readonly type: "text";
|
|
1067
|
+
readonly text: string;
|
|
1068
|
+
readonly cache_control?: {
|
|
1069
|
+
readonly type: "ephemeral";
|
|
1070
|
+
readonly ttl?: string | undefined;
|
|
1071
|
+
} | undefined;
|
|
1072
1072
|
})[];
|
|
1073
1073
|
} | {
|
|
1074
1074
|
readonly role: "tool";
|
|
@@ -1226,13 +1226,6 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
1226
1226
|
readonly messages: readonly ({
|
|
1227
1227
|
readonly role: "system";
|
|
1228
1228
|
readonly content: string | readonly ({
|
|
1229
|
-
readonly type: "text";
|
|
1230
|
-
readonly text: string;
|
|
1231
|
-
readonly cache_control?: {
|
|
1232
|
-
readonly type: "ephemeral";
|
|
1233
|
-
readonly ttl?: string | undefined;
|
|
1234
|
-
} | undefined;
|
|
1235
|
-
} | {
|
|
1236
1229
|
readonly type: "image_url";
|
|
1237
1230
|
readonly image_url: {
|
|
1238
1231
|
readonly url: string;
|
|
@@ -1243,17 +1236,17 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
1243
1236
|
readonly filename: string;
|
|
1244
1237
|
readonly file_data: string;
|
|
1245
1238
|
};
|
|
1246
|
-
}
|
|
1247
|
-
} | {
|
|
1248
|
-
readonly role: "user";
|
|
1249
|
-
readonly content: string | readonly ({
|
|
1239
|
+
} | {
|
|
1250
1240
|
readonly type: "text";
|
|
1251
1241
|
readonly text: string;
|
|
1252
1242
|
readonly cache_control?: {
|
|
1253
1243
|
readonly type: "ephemeral";
|
|
1254
1244
|
readonly ttl?: string | undefined;
|
|
1255
1245
|
} | undefined;
|
|
1256
|
-
}
|
|
1246
|
+
})[];
|
|
1247
|
+
} | {
|
|
1248
|
+
readonly role: "user";
|
|
1249
|
+
readonly content: string | readonly ({
|
|
1257
1250
|
readonly type: "image_url";
|
|
1258
1251
|
readonly image_url: {
|
|
1259
1252
|
readonly url: string;
|
|
@@ -1264,6 +1257,13 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
1264
1257
|
readonly filename: string;
|
|
1265
1258
|
readonly file_data: string;
|
|
1266
1259
|
};
|
|
1260
|
+
} | {
|
|
1261
|
+
readonly type: "text";
|
|
1262
|
+
readonly text: string;
|
|
1263
|
+
readonly cache_control?: {
|
|
1264
|
+
readonly type: "ephemeral";
|
|
1265
|
+
readonly ttl?: string | undefined;
|
|
1266
|
+
} | undefined;
|
|
1267
1267
|
})[];
|
|
1268
1268
|
} | {
|
|
1269
1269
|
readonly role: "tool";
|
|
@@ -1348,13 +1348,6 @@ export declare const route: Route<{
|
|
|
1348
1348
|
readonly messages: readonly ({
|
|
1349
1349
|
readonly role: "system";
|
|
1350
1350
|
readonly content: string | readonly ({
|
|
1351
|
-
readonly type: "text";
|
|
1352
|
-
readonly text: string;
|
|
1353
|
-
readonly cache_control?: {
|
|
1354
|
-
readonly type: "ephemeral";
|
|
1355
|
-
readonly ttl?: string | undefined;
|
|
1356
|
-
} | undefined;
|
|
1357
|
-
} | {
|
|
1358
1351
|
readonly type: "image_url";
|
|
1359
1352
|
readonly image_url: {
|
|
1360
1353
|
readonly url: string;
|
|
@@ -1365,17 +1358,17 @@ export declare const route: Route<{
|
|
|
1365
1358
|
readonly filename: string;
|
|
1366
1359
|
readonly file_data: string;
|
|
1367
1360
|
};
|
|
1368
|
-
}
|
|
1369
|
-
} | {
|
|
1370
|
-
readonly role: "user";
|
|
1371
|
-
readonly content: string | readonly ({
|
|
1361
|
+
} | {
|
|
1372
1362
|
readonly type: "text";
|
|
1373
1363
|
readonly text: string;
|
|
1374
1364
|
readonly cache_control?: {
|
|
1375
1365
|
readonly type: "ephemeral";
|
|
1376
1366
|
readonly ttl?: string | undefined;
|
|
1377
1367
|
} | undefined;
|
|
1378
|
-
}
|
|
1368
|
+
})[];
|
|
1369
|
+
} | {
|
|
1370
|
+
readonly role: "user";
|
|
1371
|
+
readonly content: string | readonly ({
|
|
1379
1372
|
readonly type: "image_url";
|
|
1380
1373
|
readonly image_url: {
|
|
1381
1374
|
readonly url: string;
|
|
@@ -1386,6 +1379,13 @@ export declare const route: Route<{
|
|
|
1386
1379
|
readonly filename: string;
|
|
1387
1380
|
readonly file_data: string;
|
|
1388
1381
|
};
|
|
1382
|
+
} | {
|
|
1383
|
+
readonly type: "text";
|
|
1384
|
+
readonly text: string;
|
|
1385
|
+
readonly cache_control?: {
|
|
1386
|
+
readonly type: "ephemeral";
|
|
1387
|
+
readonly ttl?: string | undefined;
|
|
1388
|
+
} | undefined;
|
|
1389
1389
|
})[];
|
|
1390
1390
|
} | {
|
|
1391
1391
|
readonly role: "tool";
|
|
@@ -419,7 +419,7 @@ const lowerMessages = Effect.fnUntraced(function* (request, options) {
|
|
|
419
419
|
const mistral = ["mistral", "devstral", "codestral", "pixtral", "mixtral"].some((family) => modelID.includes(family));
|
|
420
420
|
const lowering = {
|
|
421
421
|
...options,
|
|
422
|
-
providerMetadataKey: request.model.route.providerMetadataKey ??
|
|
422
|
+
providerMetadataKey: request.model.route.providerMetadataKey ?? request.model.provider,
|
|
423
423
|
toolCallID: (id) => {
|
|
424
424
|
if (mistral)
|
|
425
425
|
return id
|
|
@@ -607,7 +607,7 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (reques
|
|
|
607
607
|
return yield* ProviderShared.invalidRequest(`OpenAI Chat reasoning field conflicts with reserved field ${reasoningField}`);
|
|
608
608
|
const generation = request.generation;
|
|
609
609
|
const flattened = ProviderShared.flattenToolRequest(request);
|
|
610
|
-
const provider =
|
|
610
|
+
const provider = request.model.provider;
|
|
611
611
|
const baseURL = request.model.route.endpoint.baseURL;
|
|
612
612
|
const detectedMaxTokensField = detectMaxTokensField(provider, baseURL);
|
|
613
613
|
const maxTokensField = request.model.compatibility?.maxTokensField ?? detectedMaxTokensField;
|
|
@@ -1005,7 +1005,7 @@ export const protocol = Protocol.make({
|
|
|
1005
1005
|
stream: {
|
|
1006
1006
|
event: OpenAIChatStreamEvent,
|
|
1007
1007
|
initial: (request) => ({
|
|
1008
|
-
providerMetadataKey: request.model.route.providerMetadataKey ??
|
|
1008
|
+
providerMetadataKey: request.model.route.providerMetadataKey ?? request.model.provider,
|
|
1009
1009
|
tools: ToolStream.empty(),
|
|
1010
1010
|
pendingTools: {},
|
|
1011
1011
|
toolCallEvents: [],
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Route
|
|
2
|
-
export type OpenAICompatibleChatLanguageModelInput = RouteRoutedLanguageModelInput;
|
|
1
|
+
import { Route } from "../route/client.js";
|
|
3
2
|
/**
|
|
4
3
|
* Route for non-OpenAI providers that expose an OpenAI Chat-compatible
|
|
5
4
|
* `/chat/completions` endpoint. Reuses `OpenAIChat.protocol` end-to-end and
|
|
@@ -12,13 +11,6 @@ export declare const route: Route<{
|
|
|
12
11
|
readonly messages: readonly ({
|
|
13
12
|
readonly role: "system";
|
|
14
13
|
readonly content: string | readonly ({
|
|
15
|
-
readonly type: "text";
|
|
16
|
-
readonly text: string;
|
|
17
|
-
readonly cache_control?: {
|
|
18
|
-
readonly type: "ephemeral";
|
|
19
|
-
readonly ttl?: string | undefined;
|
|
20
|
-
} | undefined;
|
|
21
|
-
} | {
|
|
22
14
|
readonly type: "image_url";
|
|
23
15
|
readonly image_url: {
|
|
24
16
|
readonly url: string;
|
|
@@ -29,17 +21,17 @@ export declare const route: Route<{
|
|
|
29
21
|
readonly filename: string;
|
|
30
22
|
readonly file_data: string;
|
|
31
23
|
};
|
|
32
|
-
}
|
|
33
|
-
} | {
|
|
34
|
-
readonly role: "user";
|
|
35
|
-
readonly content: string | readonly ({
|
|
24
|
+
} | {
|
|
36
25
|
readonly type: "text";
|
|
37
26
|
readonly text: string;
|
|
38
27
|
readonly cache_control?: {
|
|
39
28
|
readonly type: "ephemeral";
|
|
40
29
|
readonly ttl?: string | undefined;
|
|
41
30
|
} | undefined;
|
|
42
|
-
}
|
|
31
|
+
})[];
|
|
32
|
+
} | {
|
|
33
|
+
readonly role: "user";
|
|
34
|
+
readonly content: string | readonly ({
|
|
43
35
|
readonly type: "image_url";
|
|
44
36
|
readonly image_url: {
|
|
45
37
|
readonly url: string;
|
|
@@ -50,6 +42,13 @@ export declare const route: Route<{
|
|
|
50
42
|
readonly filename: string;
|
|
51
43
|
readonly file_data: string;
|
|
52
44
|
};
|
|
45
|
+
} | {
|
|
46
|
+
readonly type: "text";
|
|
47
|
+
readonly text: string;
|
|
48
|
+
readonly cache_control?: {
|
|
49
|
+
readonly type: "ephemeral";
|
|
50
|
+
readonly ttl?: string | undefined;
|
|
51
|
+
} | undefined;
|
|
53
52
|
})[];
|
|
54
53
|
} | {
|
|
55
54
|
readonly role: "tool";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Route
|
|
2
|
-
export type OpenAICompatibleResponsesLanguageModelInput = RouteRoutedLanguageModelInput;
|
|
1
|
+
import { Route } from "../route/client.js";
|
|
3
2
|
/**
|
|
4
3
|
* Deployment adapter for providers that expose an Open Responses-compatible
|
|
5
4
|
* `/responses` endpoint. Provider helpers configure identity, endpoint, and
|
|
@@ -8,10 +7,6 @@ export type OpenAICompatibleResponsesLanguageModelInput = RouteRoutedLanguageMod
|
|
|
8
7
|
export declare const route: Route<{
|
|
9
8
|
readonly model: string;
|
|
10
9
|
readonly input: readonly ({
|
|
11
|
-
readonly type: "compaction";
|
|
12
|
-
readonly id?: string | null | undefined;
|
|
13
|
-
readonly encrypted_content: string;
|
|
14
|
-
} | {
|
|
15
10
|
readonly type: "configuration_update";
|
|
16
11
|
readonly reasoning: {
|
|
17
12
|
readonly effort: import("../index.js").ReasoningEffort;
|
|
@@ -24,10 +19,45 @@ export declare const route: Route<{
|
|
|
24
19
|
readonly type: "message";
|
|
25
20
|
readonly role: "developer";
|
|
26
21
|
readonly content: string;
|
|
22
|
+
} | {
|
|
23
|
+
readonly type: "function_call_output";
|
|
24
|
+
readonly call_id: string;
|
|
25
|
+
readonly output: string | readonly ({
|
|
26
|
+
readonly type: "input_text";
|
|
27
|
+
readonly text: string;
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: "input_video";
|
|
30
|
+
readonly video_url: string;
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: "input_image";
|
|
33
|
+
readonly image_url: string;
|
|
34
|
+
readonly detail?: string | undefined;
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: "input_file";
|
|
37
|
+
readonly filename: string;
|
|
38
|
+
readonly detail?: string | undefined;
|
|
39
|
+
readonly file_data?: string | undefined;
|
|
40
|
+
readonly file_url?: string | undefined;
|
|
41
|
+
})[];
|
|
42
|
+
} | {
|
|
43
|
+
readonly type: "reasoning";
|
|
44
|
+
readonly id?: string | undefined;
|
|
45
|
+
readonly summary: readonly {
|
|
46
|
+
readonly type: "summary_text";
|
|
47
|
+
readonly text: string;
|
|
48
|
+
}[];
|
|
49
|
+
readonly encrypted_content?: string | null | undefined;
|
|
50
|
+
} | {
|
|
51
|
+
readonly type: "compaction";
|
|
52
|
+
readonly id?: string | null | undefined;
|
|
53
|
+
readonly encrypted_content: string;
|
|
27
54
|
} | {
|
|
28
55
|
readonly type: "message";
|
|
29
56
|
readonly role: "user";
|
|
30
57
|
readonly content: readonly ({
|
|
58
|
+
readonly type: "input_text";
|
|
59
|
+
readonly text: string;
|
|
60
|
+
} | {
|
|
31
61
|
readonly type: "input_image";
|
|
32
62
|
readonly image_url: string;
|
|
33
63
|
readonly detail?: string | undefined;
|
|
@@ -37,9 +67,6 @@ export declare const route: Route<{
|
|
|
37
67
|
readonly detail?: string | undefined;
|
|
38
68
|
readonly file_data?: string | undefined;
|
|
39
69
|
readonly file_url?: string | undefined;
|
|
40
|
-
} | {
|
|
41
|
-
readonly type: "input_text";
|
|
42
|
-
readonly text: string;
|
|
43
70
|
})[];
|
|
44
71
|
readonly id?: string | undefined;
|
|
45
72
|
readonly status?: string | undefined;
|
|
@@ -53,14 +80,6 @@ export declare const route: Route<{
|
|
|
53
80
|
}[];
|
|
54
81
|
readonly phase?: "commentary" | "final_answer" | null | undefined;
|
|
55
82
|
readonly status?: string | undefined;
|
|
56
|
-
} | {
|
|
57
|
-
readonly type: "reasoning";
|
|
58
|
-
readonly id?: string | undefined;
|
|
59
|
-
readonly summary: readonly {
|
|
60
|
-
readonly type: "summary_text";
|
|
61
|
-
readonly text: string;
|
|
62
|
-
}[];
|
|
63
|
-
readonly encrypted_content?: string | null | undefined;
|
|
64
83
|
} | {
|
|
65
84
|
readonly type: "function_call";
|
|
66
85
|
readonly id?: string | undefined;
|
|
@@ -68,26 +87,6 @@ export declare const route: Route<{
|
|
|
68
87
|
readonly name: string;
|
|
69
88
|
readonly namespace?: string | undefined;
|
|
70
89
|
readonly arguments: string;
|
|
71
|
-
} | {
|
|
72
|
-
readonly type: "function_call_output";
|
|
73
|
-
readonly call_id: string;
|
|
74
|
-
readonly output: string | readonly ({
|
|
75
|
-
readonly type: "input_image";
|
|
76
|
-
readonly image_url: string;
|
|
77
|
-
readonly detail?: string | undefined;
|
|
78
|
-
} | {
|
|
79
|
-
readonly type: "input_file";
|
|
80
|
-
readonly filename: string;
|
|
81
|
-
readonly detail?: string | undefined;
|
|
82
|
-
readonly file_data?: string | undefined;
|
|
83
|
-
readonly file_url?: string | undefined;
|
|
84
|
-
} | {
|
|
85
|
-
readonly type: "input_text";
|
|
86
|
-
readonly text: string;
|
|
87
|
-
} | {
|
|
88
|
-
readonly type: "input_video";
|
|
89
|
-
readonly video_url: string;
|
|
90
|
-
})[];
|
|
91
90
|
} | {
|
|
92
91
|
readonly [x: string]: unknown;
|
|
93
92
|
readonly type: "web_search_call";
|
|
@@ -30,14 +30,6 @@ interface State {
|
|
|
30
30
|
readonly usage?: MediaUsage;
|
|
31
31
|
}
|
|
32
32
|
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
33
|
-
readonly type: "generation-queued";
|
|
34
|
-
readonly id: string;
|
|
35
|
-
readonly position?: number | undefined;
|
|
36
|
-
} | {
|
|
37
|
-
readonly type: "generation-progress";
|
|
38
|
-
readonly id: string;
|
|
39
|
-
readonly progress?: number | undefined;
|
|
40
|
-
} | {
|
|
41
33
|
readonly type: "image-partial";
|
|
42
34
|
readonly index: number;
|
|
43
35
|
readonly image: Media.Asset;
|
|
@@ -45,17 +37,17 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
45
37
|
readonly type: "image";
|
|
46
38
|
readonly index: number;
|
|
47
39
|
readonly image: Media.Asset;
|
|
40
|
+
} | {
|
|
41
|
+
readonly type: "generation-queued";
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly position?: number | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "generation-progress";
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly progress?: number | undefined;
|
|
48
48
|
} | {
|
|
49
49
|
readonly type: "finish";
|
|
50
50
|
readonly usage?: {
|
|
51
|
-
readonly type: "tokens";
|
|
52
|
-
readonly input?: number | undefined;
|
|
53
|
-
readonly output?: number | undefined;
|
|
54
|
-
readonly total?: number | undefined;
|
|
55
|
-
readonly details?: {
|
|
56
|
-
readonly [x: string]: unknown;
|
|
57
|
-
} | undefined;
|
|
58
|
-
} | {
|
|
59
51
|
readonly type: "seconds";
|
|
60
52
|
readonly seconds: number;
|
|
61
53
|
} | {
|
|
@@ -67,6 +59,14 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
67
59
|
} | {
|
|
68
60
|
readonly type: "compute";
|
|
69
61
|
readonly seconds: number;
|
|
62
|
+
} | {
|
|
63
|
+
readonly type: "tokens";
|
|
64
|
+
readonly input?: number | undefined;
|
|
65
|
+
readonly output?: number | undefined;
|
|
66
|
+
readonly total?: number | undefined;
|
|
67
|
+
readonly details?: {
|
|
68
|
+
readonly [x: string]: unknown;
|
|
69
|
+
} | undefined;
|
|
70
70
|
} | undefined;
|
|
71
71
|
readonly notices?: readonly {
|
|
72
72
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -86,14 +86,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
86
86
|
export declare const model: (input: MediaRoute.ModelInput) => ImageModel<OpenAIImageOptions>;
|
|
87
87
|
export declare const OpenAIImages: {
|
|
88
88
|
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
89
|
-
readonly type: "generation-queued";
|
|
90
|
-
readonly id: string;
|
|
91
|
-
readonly position?: number | undefined;
|
|
92
|
-
} | {
|
|
93
|
-
readonly type: "generation-progress";
|
|
94
|
-
readonly id: string;
|
|
95
|
-
readonly progress?: number | undefined;
|
|
96
|
-
} | {
|
|
97
89
|
readonly type: "image-partial";
|
|
98
90
|
readonly index: number;
|
|
99
91
|
readonly image: Media.Asset;
|
|
@@ -101,17 +93,17 @@ export declare const OpenAIImages: {
|
|
|
101
93
|
readonly type: "image";
|
|
102
94
|
readonly index: number;
|
|
103
95
|
readonly image: Media.Asset;
|
|
96
|
+
} | {
|
|
97
|
+
readonly type: "generation-queued";
|
|
98
|
+
readonly id: string;
|
|
99
|
+
readonly position?: number | undefined;
|
|
100
|
+
} | {
|
|
101
|
+
readonly type: "generation-progress";
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly progress?: number | undefined;
|
|
104
104
|
} | {
|
|
105
105
|
readonly type: "finish";
|
|
106
106
|
readonly usage?: {
|
|
107
|
-
readonly type: "tokens";
|
|
108
|
-
readonly input?: number | undefined;
|
|
109
|
-
readonly output?: number | undefined;
|
|
110
|
-
readonly total?: number | undefined;
|
|
111
|
-
readonly details?: {
|
|
112
|
-
readonly [x: string]: unknown;
|
|
113
|
-
} | undefined;
|
|
114
|
-
} | {
|
|
115
107
|
readonly type: "seconds";
|
|
116
108
|
readonly seconds: number;
|
|
117
109
|
} | {
|
|
@@ -123,6 +115,14 @@ export declare const OpenAIImages: {
|
|
|
123
115
|
} | {
|
|
124
116
|
readonly type: "compute";
|
|
125
117
|
readonly seconds: number;
|
|
118
|
+
} | {
|
|
119
|
+
readonly type: "tokens";
|
|
120
|
+
readonly input?: number | undefined;
|
|
121
|
+
readonly output?: number | undefined;
|
|
122
|
+
readonly total?: number | undefined;
|
|
123
|
+
readonly details?: {
|
|
124
|
+
readonly [x: string]: unknown;
|
|
125
|
+
} | undefined;
|
|
126
126
|
} | undefined;
|
|
127
127
|
readonly notices?: readonly {
|
|
128
128
|
readonly type: "filtered" | "moderated" | "other";
|