@opencode/ai 2.0.15 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +441 -99
- package/dist/ai-client.d.ts +8 -0
- package/dist/ai-client.js +12 -0
- package/dist/experimental/evaluation-client.d.ts +3 -3
- package/dist/experimental/evaluation-client.js +1 -1
- package/dist/experimental/evaluation.js +1 -1
- package/dist/generation.d.ts +39 -29
- package/dist/generation.js +62 -36
- package/dist/image-client.d.ts +59 -17
- package/dist/image-client.js +16 -24
- package/dist/image.d.ts +394 -55
- package/dist/image.js +48 -57
- package/dist/index.d.ts +15 -2
- package/dist/index.js +10 -0
- package/dist/llm.d.ts +7 -5
- package/dist/llm.js +10 -4
- package/dist/media-client.d.ts +30 -0
- package/dist/media-client.js +51 -0
- package/dist/media-model.d.ts +43 -0
- package/dist/media-model.js +47 -0
- package/dist/media.d.ts +10 -9
- package/dist/media.js +11 -12
- package/dist/promise.d.ts +473 -15
- package/dist/promise.js +71 -13
- package/dist/protocols/alibaba-chat.d.ts +12 -0
- package/dist/protocols/alibaba-chat.js +4 -1
- package/dist/protocols/alibaba-messages.d.ts +1 -1
- package/dist/protocols/alibaba-messages.js +6 -4
- package/dist/protocols/alibaba-responses.d.ts +2 -2
- package/dist/protocols/anthropic-messages.d.ts +34 -34
- package/dist/protocols/anthropic-messages.js +14 -9
- package/dist/protocols/assemblyai-transcription.d.ts +41 -0
- package/dist/protocols/assemblyai-transcription.js +136 -0
- package/dist/protocols/bedrock-converse.d.ts +7 -0
- package/dist/protocols/bedrock-converse.js +39 -19
- package/dist/protocols/bfl-images.d.ts +38 -0
- package/dist/protocols/bfl-images.js +153 -0
- package/dist/protocols/cartesia-speech.d.ts +143 -0
- package/dist/protocols/cartesia-speech.js +120 -0
- package/dist/protocols/deepgram-speech.d.ts +135 -0
- package/dist/protocols/deepgram-speech.js +91 -0
- package/dist/protocols/deepgram-transcription.d.ts +26 -0
- package/dist/protocols/deepgram-transcription.js +125 -0
- package/dist/protocols/elevenlabs-speech.d.ts +138 -0
- package/dist/protocols/elevenlabs-speech.js +111 -0
- package/dist/protocols/fal-images.d.ts +25 -0
- package/dist/protocols/fal-images.js +104 -0
- package/dist/protocols/fal-video.d.ts +29 -0
- package/dist/protocols/fal-video.js +73 -0
- package/dist/protocols/gemini.d.ts +22 -22
- package/dist/protocols/gemini.js +19 -36
- package/dist/protocols/google-images.d.ts +3 -3
- package/dist/protocols/google-images.js +12 -34
- package/dist/protocols/google-speech.d.ts +146 -0
- package/dist/protocols/google-speech.js +88 -0
- package/dist/protocols/google-transcription.d.ts +174 -0
- package/dist/protocols/google-transcription.js +126 -0
- package/dist/protocols/google-video.d.ts +26 -0
- package/dist/protocols/google-video.js +142 -0
- package/dist/protocols/meta-images.d.ts +3 -4
- package/dist/protocols/meta-images.js +13 -29
- package/dist/protocols/meta-messages.d.ts +5 -5
- package/dist/protocols/meta-responses.d.ts +4 -4
- package/dist/protocols/meta-responses.js +6 -4
- package/dist/protocols/open-responses.d.ts +10 -9
- package/dist/protocols/open-responses.js +4 -9
- package/dist/protocols/openai-chat.d.ts +84 -0
- package/dist/protocols/openai-chat.js +28 -17
- package/dist/protocols/openai-compatible-chat.d.ts +12 -0
- package/dist/protocols/openai-compatible-responses.d.ts +2 -2
- package/dist/protocols/openai-images.d.ts +130 -7
- package/dist/protocols/openai-images.js +143 -91
- package/dist/protocols/openai-responses.d.ts +20 -20
- package/dist/protocols/openai-responses.js +31 -31
- package/dist/protocols/openai-speech.d.ts +136 -0
- package/dist/protocols/openai-speech.js +97 -0
- package/dist/protocols/openai-transcription.d.ts +211 -0
- package/dist/protocols/openai-transcription.js +202 -0
- package/dist/protocols/replicate-images.d.ts +28 -0
- package/dist/protocols/replicate-images.js +127 -0
- package/dist/protocols/runway-video.d.ts +38 -0
- package/dist/protocols/runway-video.js +140 -0
- package/dist/protocols/shared.d.ts +21 -17
- package/dist/protocols/shared.js +27 -36
- package/dist/protocols/stability-images.d.ts +39 -0
- package/dist/protocols/stability-images.js +136 -0
- package/dist/protocols/utils/fal-queue.d.ts +26 -0
- package/dist/protocols/utils/fal-queue.js +67 -0
- package/dist/protocols/utils/gemini-generate-content.d.ts +65 -0
- package/dist/protocols/utils/gemini-generate-content.js +65 -0
- package/dist/protocols/utils/gemini-json-schema.d.ts +3 -0
- package/dist/protocols/utils/gemini-json-schema.js +76 -0
- package/dist/protocols/utils/media-input.d.ts +23 -1
- package/dist/protocols/utils/media-input.js +40 -0
- package/dist/protocols/utils/responses-checkpoint.js +3 -7
- package/dist/protocols/utils/responses-compaction.d.ts +3 -1
- package/dist/protocols/utils/responses-compaction.js +16 -3
- package/dist/protocols/utils/speech-stream.d.ts +49 -0
- package/dist/protocols/utils/speech-stream.js +64 -0
- package/dist/protocols/utils/tool-schema.d.ts +2 -2
- package/dist/protocols/utils/tool-schema.js +62 -19
- package/dist/protocols/xai-images.d.ts +4 -4
- package/dist/protocols/xai-images.js +14 -40
- package/dist/protocols/xai-responses.d.ts +2 -2
- package/dist/protocols/xai-responses.js +1 -1
- package/dist/protocols/xai-video.d.ts +34 -0
- package/dist/protocols/xai-video.js +141 -0
- package/dist/protocols/zai-chat.d.ts +13 -1
- package/dist/protocols/zai-images.d.ts +2 -2
- package/dist/protocols/zai-images.js +11 -14
- package/dist/protocols/zai-messages.d.ts +1 -1
- package/dist/provider-error.js +10 -1
- package/dist/providers/alibaba.d.ts +15 -3
- package/dist/providers/amazon-bedrock-mantle.d.ts +14 -2
- package/dist/providers/amazon-bedrock.d.ts +2 -0
- package/dist/providers/amazon-bedrock.js +1 -0
- package/dist/providers/anthropic-compatible.d.ts +5 -5
- package/dist/providers/anthropic.d.ts +5 -5
- package/dist/providers/assemblyai.d.ts +25 -0
- package/dist/providers/assemblyai.js +24 -0
- package/dist/providers/azure.d.ts +20 -8
- package/dist/providers/azure.js +2 -2
- package/dist/providers/baseten.d.ts +24 -0
- package/dist/providers/black-forest-labs.d.ts +25 -0
- package/dist/providers/black-forest-labs.js +23 -0
- package/dist/providers/cartesia.d.ts +24 -0
- package/dist/providers/cartesia.js +17 -0
- package/dist/providers/cerebras.d.ts +24 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +42 -18
- package/dist/providers/cloudflare-workers-ai.d.ts +24 -0
- package/dist/providers/deepgram.d.ts +29 -0
- package/dist/providers/deepgram.js +25 -0
- package/dist/providers/deepinfra.d.ts +24 -0
- package/dist/providers/deepseek.d.ts +24 -0
- package/dist/providers/elevenlabs.d.ts +24 -0
- package/dist/providers/elevenlabs.js +23 -0
- package/dist/providers/fal.d.ts +29 -0
- package/dist/providers/fal.js +26 -0
- package/dist/providers/fireworks.d.ts +24 -0
- package/dist/providers/google-vertex-chat.d.ts +12 -0
- package/dist/providers/google-vertex-messages.d.ts +5 -5
- package/dist/providers/google-vertex-responses.d.ts +2 -2
- package/dist/providers/google-vertex.d.ts +6 -6
- package/dist/providers/google.d.ts +21 -6
- package/dist/providers/google.js +13 -9
- package/dist/providers/groq.d.ts +24 -0
- package/dist/providers/index.d.ts +9 -0
- package/dist/providers/index.js +9 -0
- package/dist/providers/meta.d.ts +22 -10
- package/dist/providers/meta.js +4 -8
- package/dist/providers/minimax.d.ts +19 -7
- package/dist/providers/moonshot.d.ts +19 -7
- package/dist/providers/moonshot.js +3 -3
- package/dist/providers/openai-compatible-responses.d.ts +2 -2
- package/dist/providers/openai-compatible.d.ts +12 -0
- package/dist/providers/openai-options.d.ts +3 -9
- package/dist/providers/openai-options.js +4 -7
- package/dist/providers/openai.d.ts +33 -12
- package/dist/providers/openai.js +17 -9
- package/dist/providers/opencode-zen.js +1 -1
- package/dist/providers/openrouter.d.ts +54 -7
- package/dist/providers/openrouter.js +10 -5
- package/dist/providers/replicate.d.ts +25 -0
- package/dist/providers/replicate.js +17 -0
- package/dist/providers/runway.d.ts +24 -0
- package/dist/providers/runway.js +17 -0
- package/dist/providers/stability.d.ts +28 -0
- package/dist/providers/stability.js +18 -0
- package/dist/providers/togetherai.d.ts +24 -0
- package/dist/providers/typesafe-ai.js +1 -1
- package/dist/providers/vercel-ai-gateway.js +1 -1
- package/dist/providers/xai.d.ts +17 -0
- package/dist/providers/xai.js +7 -9
- package/dist/providers/zai-coding-plan.d.ts +16 -4
- package/dist/providers/zai.d.ts +13 -1
- package/dist/providers/zai.js +4 -8
- package/dist/route/auth.d.ts +5 -2
- package/dist/route/auth.js +20 -13
- package/dist/route/client.d.ts +9 -7
- package/dist/route/client.js +6 -8
- package/dist/route/endpoint.d.ts +1 -0
- package/dist/route/endpoint.js +2 -2
- package/dist/route/executor-service.d.ts +4 -2
- package/dist/route/executor-service.js +2 -1
- package/dist/route/executor.d.ts +3 -1
- package/dist/route/executor.js +7 -0
- package/dist/route/framing.d.ts +15 -2
- package/dist/route/framing.js +53 -4
- package/dist/route/index.d.ts +1 -1
- package/dist/route/media-protocol.d.ts +145 -18
- package/dist/route/media-protocol.js +96 -28
- package/dist/route/media.d.ts +54 -9
- package/dist/route/media.js +194 -38
- package/dist/route/protocol.d.ts +3 -1
- package/dist/schema/events.d.ts +0 -6
- package/dist/schema/messages.d.ts +0 -3
- package/dist/schema/options.d.ts +10 -6
- package/dist/schema/options.js +10 -5
- package/dist/speech-client.d.ts +66 -0
- package/dist/speech-client.js +21 -0
- package/dist/speech.d.ts +1307 -0
- package/dist/speech.js +124 -0
- package/dist/testing.d.ts +2 -2
- package/dist/transcription-client.d.ts +82 -0
- package/dist/transcription-client.js +13 -0
- package/dist/transcription.d.ts +1492 -0
- package/dist/transcription.js +127 -0
- package/dist/utils/bytes.d.ts +1 -0
- package/dist/utils/bytes.js +10 -0
- package/dist/utils/json.d.ts +4 -0
- package/dist/utils/json.js +4 -0
- package/dist/utils/media-type.d.ts +3 -1
- package/dist/utils/media-type.js +25 -2
- package/dist/video-client.d.ts +59 -0
- package/dist/video-client.js +20 -0
- package/dist/video.d.ts +1351 -0
- package/dist/video.js +118 -0
- package/package.json +3 -3
- package/dist/protocols/utils/gemini-tool-schema.d.ts +0 -2
- package/dist/protocols/utils/gemini-tool-schema.js +0 -103
- package/dist/protocols/utils/meta-image.d.ts +0 -2
- package/dist/protocols/utils/meta-image.js +0 -13
- package/dist/protocols/utils/openai-image.d.ts +0 -5
- package/dist/protocols/utils/openai-image.js +0 -18
package/dist/providers/meta.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
|
3
3
|
import { MetaImages } from "../protocols/meta-images.js";
|
|
4
4
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
5
5
|
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
6
|
-
import { ToolDefinition, type ModelID } from "../schema/index.js";
|
|
6
|
+
import { ToolDefinition, type ModelID, type OpenString } from "../schema/index.js";
|
|
7
7
|
import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js";
|
|
8
8
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
9
9
|
export type ProviderOptionsInput = OpenResponsesProviderOptionsInput & Pick<AnthropicMessages.OptionsInput, "thinking" | "effort">;
|
|
@@ -23,8 +23,8 @@ export interface WebSearchOptions {
|
|
|
23
23
|
export declare const webSearch: (options?: WebSearchOptions) => ToolDefinition;
|
|
24
24
|
export interface ImageGenerationOptions {
|
|
25
25
|
readonly size?: string;
|
|
26
|
-
readonly outputFormat?: "webp" | "png" | "jpeg"
|
|
27
|
-
readonly reasoningStrength?: "low" | "high"
|
|
26
|
+
readonly outputFormat?: OpenString<"webp" | "png" | "jpeg">;
|
|
27
|
+
readonly reasoningStrength?: OpenString<"low" | "high">;
|
|
28
28
|
readonly enableImageSearch?: boolean;
|
|
29
29
|
readonly enableWebSearch?: boolean;
|
|
30
30
|
readonly enableShell?: boolean;
|
|
@@ -54,6 +54,12 @@ export declare const routes: (Route<{
|
|
|
54
54
|
readonly image_url: {
|
|
55
55
|
readonly url: string;
|
|
56
56
|
};
|
|
57
|
+
} | {
|
|
58
|
+
readonly type: "file";
|
|
59
|
+
readonly file: {
|
|
60
|
+
readonly filename: string;
|
|
61
|
+
readonly file_data: string;
|
|
62
|
+
};
|
|
57
63
|
})[];
|
|
58
64
|
} | {
|
|
59
65
|
readonly role: "user";
|
|
@@ -69,6 +75,12 @@ export declare const routes: (Route<{
|
|
|
69
75
|
readonly image_url: {
|
|
70
76
|
readonly url: string;
|
|
71
77
|
};
|
|
78
|
+
} | {
|
|
79
|
+
readonly type: "file";
|
|
80
|
+
readonly file: {
|
|
81
|
+
readonly filename: string;
|
|
82
|
+
readonly file_data: string;
|
|
83
|
+
};
|
|
72
84
|
})[];
|
|
73
85
|
} | {
|
|
74
86
|
readonly [x: string]: unknown;
|
|
@@ -203,8 +215,8 @@ export declare const routes: (Route<{
|
|
|
203
215
|
} | {
|
|
204
216
|
readonly type: "input_file";
|
|
205
217
|
readonly filename: string;
|
|
206
|
-
readonly detail?: string | undefined;
|
|
207
218
|
readonly file_data?: string | undefined;
|
|
219
|
+
readonly detail?: string | undefined;
|
|
208
220
|
readonly file_url?: string | undefined;
|
|
209
221
|
} | {
|
|
210
222
|
readonly type: "input_text";
|
|
@@ -240,8 +252,8 @@ export declare const routes: (Route<{
|
|
|
240
252
|
} | {
|
|
241
253
|
readonly type: "input_file";
|
|
242
254
|
readonly filename: string;
|
|
243
|
-
readonly detail?: string | undefined;
|
|
244
255
|
readonly file_data?: string | undefined;
|
|
256
|
+
readonly detail?: string | undefined;
|
|
245
257
|
readonly file_url?: string | undefined;
|
|
246
258
|
} | {
|
|
247
259
|
readonly type: "input_text";
|
|
@@ -548,20 +560,20 @@ export declare const routes: (Route<{
|
|
|
548
560
|
readonly thinking?: {
|
|
549
561
|
readonly type: "enabled";
|
|
550
562
|
readonly budget_tokens: number;
|
|
551
|
-
readonly display?:
|
|
563
|
+
readonly display?: OpenString<"summarized" | "omitted"> | undefined;
|
|
552
564
|
readonly block_binding?: {
|
|
553
|
-
readonly prefix_mismatch_behavior?:
|
|
565
|
+
readonly prefix_mismatch_behavior?: OpenString<"error" | "drop_block"> | undefined;
|
|
554
566
|
} | undefined;
|
|
555
567
|
} | {
|
|
556
568
|
readonly type: "adaptive";
|
|
557
|
-
readonly display?:
|
|
569
|
+
readonly display?: OpenString<"summarized" | "omitted"> | undefined;
|
|
558
570
|
readonly block_binding?: {
|
|
559
|
-
readonly prefix_mismatch_behavior?:
|
|
571
|
+
readonly prefix_mismatch_behavior?: OpenString<"error" | "drop_block"> | undefined;
|
|
560
572
|
} | undefined;
|
|
561
573
|
} | {
|
|
562
574
|
readonly type: "disabled";
|
|
563
575
|
} | undefined;
|
|
564
|
-
readonly service_tier?: "auto" |
|
|
576
|
+
readonly service_tier?: OpenString<"auto" | "standard_only"> | undefined;
|
|
565
577
|
readonly container?: string | {
|
|
566
578
|
readonly id?: string | null | undefined;
|
|
567
579
|
readonly skills?: readonly {
|
package/dist/providers/meta.js
CHANGED
|
@@ -6,7 +6,8 @@ import { MetaImages } from "../protocols/meta-images.js";
|
|
|
6
6
|
import { AuthOptions } from "../route/auth-options.js";
|
|
7
7
|
import { Route } from "../route/client.js";
|
|
8
8
|
import { Endpoint } from "../route/endpoint.js";
|
|
9
|
-
import {
|
|
9
|
+
import { MediaRoute } from "../route/media.js";
|
|
10
|
+
import { ProviderID, ToolDefinition } from "../schema/index.js";
|
|
10
11
|
export const id = ProviderID.make("meta");
|
|
11
12
|
const baseURL = "https://api.meta.ai/v1";
|
|
12
13
|
export const webSearch = (options = {}) => ToolDefinition.make({
|
|
@@ -84,13 +85,8 @@ export const configure = (input = {}) => {
|
|
|
84
85
|
id: modelID,
|
|
85
86
|
compatibility: { requireSignature: false },
|
|
86
87
|
});
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
baseURL: endpoint ?? baseURL,
|
|
90
|
-
auth: options.auth,
|
|
91
|
-
headers: input.headers,
|
|
92
|
-
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
93
|
-
});
|
|
88
|
+
const media = MediaRoute.deployment(input, options.auth);
|
|
89
|
+
const image = (modelID) => MetaImages.model({ ...media, id: modelID });
|
|
94
90
|
return { id, model: responses, responses, chat, messages, image, configure };
|
|
95
91
|
};
|
|
96
92
|
export const provider = configure();
|
|
@@ -249,20 +249,20 @@ export declare const routes: (Route<{
|
|
|
249
249
|
readonly thinking?: {
|
|
250
250
|
readonly type: "enabled";
|
|
251
251
|
readonly budget_tokens: number;
|
|
252
|
-
readonly display?: (
|
|
252
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
253
253
|
readonly block_binding?: {
|
|
254
|
-
readonly prefix_mismatch_behavior?: (
|
|
254
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
255
255
|
} | undefined;
|
|
256
256
|
} | {
|
|
257
257
|
readonly type: "adaptive";
|
|
258
|
-
readonly display?: (
|
|
258
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
259
259
|
readonly block_binding?: {
|
|
260
|
-
readonly prefix_mismatch_behavior?: (
|
|
260
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
261
261
|
} | undefined;
|
|
262
262
|
} | {
|
|
263
263
|
readonly type: "disabled";
|
|
264
264
|
} | undefined;
|
|
265
|
-
readonly service_tier?: "auto" |
|
|
265
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
266
266
|
readonly container?: string | {
|
|
267
267
|
readonly id?: string | null | undefined;
|
|
268
268
|
readonly skills?: readonly {
|
|
@@ -372,8 +372,8 @@ export declare const routes: (Route<{
|
|
|
372
372
|
} | {
|
|
373
373
|
readonly type: "input_file";
|
|
374
374
|
readonly filename: string;
|
|
375
|
-
readonly detail?: string | undefined;
|
|
376
375
|
readonly file_data?: string | undefined;
|
|
376
|
+
readonly detail?: string | undefined;
|
|
377
377
|
readonly file_url?: string | undefined;
|
|
378
378
|
} | {
|
|
379
379
|
readonly type: "input_text";
|
|
@@ -409,8 +409,8 @@ export declare const routes: (Route<{
|
|
|
409
409
|
} | {
|
|
410
410
|
readonly type: "input_file";
|
|
411
411
|
readonly filename: string;
|
|
412
|
-
readonly detail?: string | undefined;
|
|
413
412
|
readonly file_data?: string | undefined;
|
|
413
|
+
readonly detail?: string | undefined;
|
|
414
414
|
readonly file_url?: string | undefined;
|
|
415
415
|
} | {
|
|
416
416
|
readonly type: "input_text";
|
|
@@ -486,6 +486,12 @@ export declare const routes: (Route<{
|
|
|
486
486
|
readonly image_url: {
|
|
487
487
|
readonly url: string;
|
|
488
488
|
};
|
|
489
|
+
} | {
|
|
490
|
+
readonly type: "file";
|
|
491
|
+
readonly file: {
|
|
492
|
+
readonly filename: string;
|
|
493
|
+
readonly file_data: string;
|
|
494
|
+
};
|
|
489
495
|
})[];
|
|
490
496
|
} | {
|
|
491
497
|
readonly role: "user";
|
|
@@ -501,6 +507,12 @@ export declare const routes: (Route<{
|
|
|
501
507
|
readonly image_url: {
|
|
502
508
|
readonly url: string;
|
|
503
509
|
};
|
|
510
|
+
} | {
|
|
511
|
+
readonly type: "file";
|
|
512
|
+
readonly file: {
|
|
513
|
+
readonly filename: string;
|
|
514
|
+
readonly file_data: string;
|
|
515
|
+
};
|
|
504
516
|
})[];
|
|
505
517
|
} | {
|
|
506
518
|
readonly [x: string]: unknown;
|
|
@@ -247,20 +247,20 @@ export declare const routes: (Route<{
|
|
|
247
247
|
readonly thinking?: {
|
|
248
248
|
readonly type: "enabled";
|
|
249
249
|
readonly budget_tokens: number;
|
|
250
|
-
readonly display?: (
|
|
250
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
251
251
|
readonly block_binding?: {
|
|
252
|
-
readonly prefix_mismatch_behavior?: (
|
|
252
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
253
253
|
} | undefined;
|
|
254
254
|
} | {
|
|
255
255
|
readonly type: "adaptive";
|
|
256
|
-
readonly display?: (
|
|
256
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
257
257
|
readonly block_binding?: {
|
|
258
|
-
readonly prefix_mismatch_behavior?: (
|
|
258
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
259
259
|
} | undefined;
|
|
260
260
|
} | {
|
|
261
261
|
readonly type: "disabled";
|
|
262
262
|
} | undefined;
|
|
263
|
-
readonly service_tier?: "auto" |
|
|
263
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
264
264
|
readonly container?: string | {
|
|
265
265
|
readonly id?: string | null | undefined;
|
|
266
266
|
readonly skills?: readonly {
|
|
@@ -370,8 +370,8 @@ export declare const routes: (Route<{
|
|
|
370
370
|
} | {
|
|
371
371
|
readonly type: "input_file";
|
|
372
372
|
readonly filename: string;
|
|
373
|
-
readonly detail?: string | undefined;
|
|
374
373
|
readonly file_data?: string | undefined;
|
|
374
|
+
readonly detail?: string | undefined;
|
|
375
375
|
readonly file_url?: string | undefined;
|
|
376
376
|
} | {
|
|
377
377
|
readonly type: "input_text";
|
|
@@ -407,8 +407,8 @@ export declare const routes: (Route<{
|
|
|
407
407
|
} | {
|
|
408
408
|
readonly type: "input_file";
|
|
409
409
|
readonly filename: string;
|
|
410
|
-
readonly detail?: string | undefined;
|
|
411
410
|
readonly file_data?: string | undefined;
|
|
411
|
+
readonly detail?: string | undefined;
|
|
412
412
|
readonly file_url?: string | undefined;
|
|
413
413
|
} | {
|
|
414
414
|
readonly type: "input_text";
|
|
@@ -484,6 +484,12 @@ export declare const routes: (Route<{
|
|
|
484
484
|
readonly image_url: {
|
|
485
485
|
readonly url: string;
|
|
486
486
|
};
|
|
487
|
+
} | {
|
|
488
|
+
readonly type: "file";
|
|
489
|
+
readonly file: {
|
|
490
|
+
readonly filename: string;
|
|
491
|
+
readonly file_data: string;
|
|
492
|
+
};
|
|
487
493
|
})[];
|
|
488
494
|
} | {
|
|
489
495
|
readonly role: "user";
|
|
@@ -499,6 +505,12 @@ export declare const routes: (Route<{
|
|
|
499
505
|
readonly image_url: {
|
|
500
506
|
readonly url: string;
|
|
501
507
|
};
|
|
508
|
+
} | {
|
|
509
|
+
readonly type: "file";
|
|
510
|
+
readonly file: {
|
|
511
|
+
readonly filename: string;
|
|
512
|
+
readonly file_data: string;
|
|
513
|
+
};
|
|
502
514
|
})[];
|
|
503
515
|
} | {
|
|
504
516
|
readonly [x: string]: unknown;
|
|
@@ -64,17 +64,17 @@ export const configure = (input = {}) => {
|
|
|
64
64
|
supportsStore: false,
|
|
65
65
|
supportsStrictMode: false,
|
|
66
66
|
supportsPromptCacheKey: true,
|
|
67
|
-
|
|
67
|
+
sanitizer: "moonshot",
|
|
68
68
|
reasoningField: "reasoning_content",
|
|
69
69
|
},
|
|
70
70
|
});
|
|
71
71
|
const messages = (modelID) => messagesRoute.with(defaults).model({
|
|
72
72
|
id: modelID,
|
|
73
|
-
compatibility: { requireSignature: false,
|
|
73
|
+
compatibility: { requireSignature: false, sanitizer: "moonshot" },
|
|
74
74
|
});
|
|
75
75
|
const responses = (modelID) => responsesRoute
|
|
76
76
|
.with(defaults)
|
|
77
|
-
.model({ id: modelID, compatibility: {
|
|
77
|
+
.model({ id: modelID, compatibility: { sanitizer: "moonshot" } });
|
|
78
78
|
return { id, model: chat, chat, messages, responses, configure };
|
|
79
79
|
};
|
|
80
80
|
export const provider = configure();
|
|
@@ -82,8 +82,8 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
82
82
|
} | {
|
|
83
83
|
readonly type: "input_file";
|
|
84
84
|
readonly filename: string;
|
|
85
|
-
readonly detail?: string | undefined;
|
|
86
85
|
readonly file_data?: string | undefined;
|
|
86
|
+
readonly detail?: string | undefined;
|
|
87
87
|
readonly file_url?: string | undefined;
|
|
88
88
|
} | {
|
|
89
89
|
readonly type: "input_text";
|
|
@@ -119,8 +119,8 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
119
119
|
} | {
|
|
120
120
|
readonly type: "input_file";
|
|
121
121
|
readonly filename: string;
|
|
122
|
-
readonly detail?: string | undefined;
|
|
123
122
|
readonly file_data?: string | undefined;
|
|
123
|
+
readonly detail?: string | undefined;
|
|
124
124
|
readonly file_url?: string | undefined;
|
|
125
125
|
} | {
|
|
126
126
|
readonly type: "input_text";
|
|
@@ -30,6 +30,12 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
30
30
|
readonly image_url: {
|
|
31
31
|
readonly url: string;
|
|
32
32
|
};
|
|
33
|
+
} | {
|
|
34
|
+
readonly type: "file";
|
|
35
|
+
readonly file: {
|
|
36
|
+
readonly filename: string;
|
|
37
|
+
readonly file_data: string;
|
|
38
|
+
};
|
|
33
39
|
})[];
|
|
34
40
|
} | {
|
|
35
41
|
readonly role: "user";
|
|
@@ -45,6 +51,12 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
45
51
|
readonly image_url: {
|
|
46
52
|
readonly url: string;
|
|
47
53
|
};
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: "file";
|
|
56
|
+
readonly file: {
|
|
57
|
+
readonly filename: string;
|
|
58
|
+
readonly file_data: string;
|
|
59
|
+
};
|
|
48
60
|
})[];
|
|
49
61
|
} | {
|
|
50
62
|
readonly [x: string]: unknown;
|
|
@@ -10,17 +10,11 @@ export type OpenAIOptionsInput = Omit<Options, "serviceTier"> & {
|
|
|
10
10
|
readonly [key: string]: unknown;
|
|
11
11
|
};
|
|
12
12
|
export type OpenAIProviderOptionsInput = OpenAIOptionsInput;
|
|
13
|
-
export declare const gpt5DefaultOptions: (modelID: string
|
|
14
|
-
|
|
15
|
-
}) => ProviderOptions | undefined;
|
|
16
|
-
export declare const openAIDefaultOptions: (modelID: string, options?: {
|
|
17
|
-
readonly textVerbosity?: boolean;
|
|
18
|
-
}) => ProviderOptions | undefined;
|
|
13
|
+
export declare const gpt5DefaultOptions: (modelID: string) => ProviderOptions | undefined;
|
|
14
|
+
export declare const openAIDefaultOptions: (modelID: string) => ProviderOptions | undefined;
|
|
19
15
|
export declare const withOpenAIOptions: <Options extends {
|
|
20
16
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
21
|
-
}>(modelID: string, options: Options,
|
|
22
|
-
readonly textVerbosity?: boolean;
|
|
23
|
-
}) => Omit<Options, "providerOptions"> & {
|
|
17
|
+
}>(modelID: string, options: Options) => Omit<Options, "providerOptions"> & {
|
|
24
18
|
readonly providerOptions?: ProviderOptions;
|
|
25
19
|
};
|
|
26
20
|
export * as OpenAIProviderOptions from "./openai-options.js";
|
|
@@ -13,7 +13,7 @@ const openAIProviderOptions = (options) => {
|
|
|
13
13
|
return undefined;
|
|
14
14
|
return result;
|
|
15
15
|
};
|
|
16
|
-
export const gpt5DefaultOptions = (modelID
|
|
16
|
+
export const gpt5DefaultOptions = (modelID) => {
|
|
17
17
|
const id = modelID.toLowerCase();
|
|
18
18
|
if (!id.includes("gpt-5") || id.includes("gpt-5-chat") || id.includes("gpt-5-pro"))
|
|
19
19
|
return undefined;
|
|
@@ -26,16 +26,13 @@ export const gpt5DefaultOptions = (modelID, options = {}) => {
|
|
|
26
26
|
// this, callers using the default model facade get reasoning summaries
|
|
27
27
|
// they cannot replay statelessly.
|
|
28
28
|
include: ["reasoning.encrypted_content"],
|
|
29
|
-
textVerbosity: options.textVerbosity === true && id.includes("gpt-5.") && !id.includes("codex") && !id.includes("-chat")
|
|
30
|
-
? "low"
|
|
31
|
-
: undefined,
|
|
32
29
|
});
|
|
33
30
|
};
|
|
34
|
-
export const openAIDefaultOptions = (modelID
|
|
35
|
-
export const withOpenAIOptions = (modelID, options
|
|
31
|
+
export const openAIDefaultOptions = (modelID) => mergeProviderOptions(openAIProviderOptions({ store: false }), gpt5DefaultOptions(modelID));
|
|
32
|
+
export const withOpenAIOptions = (modelID, options) => {
|
|
36
33
|
return {
|
|
37
34
|
...options,
|
|
38
|
-
providerOptions: mergeProviderOptions(openAIDefaultOptions(modelID
|
|
35
|
+
providerOptions: mergeProviderOptions(openAIDefaultOptions(modelID), options.providerOptions),
|
|
39
36
|
};
|
|
40
37
|
};
|
|
41
38
|
export * as OpenAIProviderOptions from "./openai-options.js";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
2
|
import type { Route, RouteDefaultsInput, CompactionOperations } from "../route/client.js";
|
|
3
3
|
import type { ProviderPackage } from "../provider-package.js";
|
|
4
|
-
import { ToolDefinition, type ModelID } from "../schema/index.js";
|
|
4
|
+
import { ToolDefinition, type ModelID, type OpenString } from "../schema/index.js";
|
|
5
5
|
import * as OpenAIResponses from "../protocols/openai-responses.js";
|
|
6
6
|
import { type OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
7
|
-
import { type OpenAIImageString } from "../protocols/openai-images.js";
|
|
8
7
|
export type { OpenAIOptionsInput, OpenAIResponseIncludable } from "./openai-options.js";
|
|
9
8
|
export type { OpenAIImageOptions } from "../protocols/openai-images.js";
|
|
9
|
+
export type { OpenAISpeechOptions } from "../protocols/openai-speech.js";
|
|
10
|
+
export type { OpenAITranscriptionOptions } from "../protocols/openai-transcription.js";
|
|
10
11
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
11
12
|
export declare const routes: (Route<{
|
|
12
13
|
readonly model: string;
|
|
@@ -24,6 +25,12 @@ export declare const routes: (Route<{
|
|
|
24
25
|
readonly image_url: {
|
|
25
26
|
readonly url: string;
|
|
26
27
|
};
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: "file";
|
|
30
|
+
readonly file: {
|
|
31
|
+
readonly filename: string;
|
|
32
|
+
readonly file_data: string;
|
|
33
|
+
};
|
|
27
34
|
})[];
|
|
28
35
|
} | {
|
|
29
36
|
readonly role: "user";
|
|
@@ -39,6 +46,12 @@ export declare const routes: (Route<{
|
|
|
39
46
|
readonly image_url: {
|
|
40
47
|
readonly url: string;
|
|
41
48
|
};
|
|
49
|
+
} | {
|
|
50
|
+
readonly type: "file";
|
|
51
|
+
readonly file: {
|
|
52
|
+
readonly filename: string;
|
|
53
|
+
readonly file_data: string;
|
|
54
|
+
};
|
|
42
55
|
})[];
|
|
43
56
|
} | {
|
|
44
57
|
readonly [x: string]: unknown;
|
|
@@ -178,8 +191,8 @@ export declare const routes: (Route<{
|
|
|
178
191
|
} | {
|
|
179
192
|
readonly type: "input_file";
|
|
180
193
|
readonly filename: string;
|
|
181
|
-
readonly detail?: string | undefined;
|
|
182
194
|
readonly file_data?: string | undefined;
|
|
195
|
+
readonly detail?: string | undefined;
|
|
183
196
|
readonly file_url?: string | undefined;
|
|
184
197
|
} | {
|
|
185
198
|
readonly type: "input_text";
|
|
@@ -215,8 +228,8 @@ export declare const routes: (Route<{
|
|
|
215
228
|
} | {
|
|
216
229
|
readonly type: "input_file";
|
|
217
230
|
readonly filename: string;
|
|
218
|
-
readonly detail?: string | undefined;
|
|
219
231
|
readonly file_data?: string | undefined;
|
|
232
|
+
readonly detail?: string | undefined;
|
|
220
233
|
readonly file_url?: string | undefined;
|
|
221
234
|
} | {
|
|
222
235
|
readonly type: "input_text";
|
|
@@ -251,8 +264,8 @@ export declare const routes: (Route<{
|
|
|
251
264
|
readonly type: "image_generation_call";
|
|
252
265
|
readonly status?: string | undefined;
|
|
253
266
|
readonly result?: string | null | undefined;
|
|
254
|
-
readonly revised_prompt?: string | null | undefined;
|
|
255
267
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
268
|
+
readonly revised_prompt?: string | null | undefined;
|
|
256
269
|
})[];
|
|
257
270
|
readonly model: string;
|
|
258
271
|
readonly stream: true;
|
|
@@ -279,9 +292,9 @@ export declare const routes: (Route<{
|
|
|
279
292
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
280
293
|
readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
281
294
|
readonly background?: "auto" | "opaque" | "transparent" | undefined;
|
|
295
|
+
readonly partial_images?: number | undefined;
|
|
282
296
|
readonly output_compression?: number | undefined;
|
|
283
297
|
readonly input_fidelity?: "low" | "high" | undefined;
|
|
284
|
-
readonly partial_images?: number | undefined;
|
|
285
298
|
} | {
|
|
286
299
|
readonly type: "namespace";
|
|
287
300
|
readonly name: string;
|
|
@@ -343,14 +356,14 @@ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
|
343
356
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
344
357
|
};
|
|
345
358
|
export interface ImageGenerationOptions {
|
|
346
|
-
readonly action?:
|
|
347
|
-
readonly background?:
|
|
348
|
-
readonly inputFidelity?:
|
|
359
|
+
readonly action?: OpenString<"auto" | "generate" | "edit">;
|
|
360
|
+
readonly background?: OpenString<"auto" | "opaque" | "transparent">;
|
|
361
|
+
readonly inputFidelity?: OpenString<"low" | "high">;
|
|
349
362
|
readonly outputCompression?: number;
|
|
350
|
-
readonly outputFormat?:
|
|
363
|
+
readonly outputFormat?: OpenString<"png" | "jpeg" | "webp">;
|
|
351
364
|
readonly partialImages?: number;
|
|
352
|
-
readonly quality?:
|
|
353
|
-
readonly size?:
|
|
365
|
+
readonly quality?: OpenString<"auto" | "low" | "medium" | "high" | "standard" | "hd">;
|
|
366
|
+
readonly size?: OpenString<"auto" | "256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "1792x1024" | "1024x1792">;
|
|
354
367
|
}
|
|
355
368
|
export declare const imageGeneration: (options?: ImageGenerationOptions) => ToolDefinition;
|
|
356
369
|
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
@@ -372,6 +385,8 @@ export declare const configure: (input?: Config) => {
|
|
|
372
385
|
}>;
|
|
373
386
|
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
|
|
374
387
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
388
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
389
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
375
390
|
configure: (input?: Config) => /*elided*/ any;
|
|
376
391
|
};
|
|
377
392
|
export declare const provider: {
|
|
@@ -386,6 +401,8 @@ export declare const provider: {
|
|
|
386
401
|
}>;
|
|
387
402
|
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
|
|
388
403
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
404
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
405
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
389
406
|
configure: (input?: Config) => {
|
|
390
407
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
391
408
|
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, {
|
|
@@ -398,6 +415,8 @@ export declare const provider: {
|
|
|
398
415
|
}>;
|
|
399
416
|
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
|
|
400
417
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
418
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
419
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
401
420
|
configure: /*elided*/ any;
|
|
402
421
|
};
|
|
403
422
|
};
|
|
@@ -409,3 +428,5 @@ export declare const responses: (id: string | ModelID) => import("../schema/opti
|
|
|
409
428
|
}>;
|
|
410
429
|
export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
|
|
411
430
|
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
431
|
+
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
432
|
+
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
package/dist/providers/openai.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { AuthOptions } from "../route/auth-options.js";
|
|
2
|
-
import {
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { HttpOptions, ProviderID, ToolDefinition, mergeHttpOptions, } from "../schema/index.js";
|
|
3
4
|
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
4
5
|
import * as OpenAIResponses from "../protocols/openai-responses.js";
|
|
5
6
|
import { withOpenAIOptions } from "./openai-options.js";
|
|
6
7
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
8
|
+
import { OpenAISpeech } from "../protocols/openai-speech.js";
|
|
9
|
+
import { OpenAITranscription } from "../protocols/openai-transcription.js";
|
|
7
10
|
export const id = ProviderID.make("openai");
|
|
8
11
|
export const routes = [OpenAIResponses.route, OpenAIChat.route];
|
|
9
12
|
export const imageGeneration = (options = {}) => ToolDefinition.make({
|
|
@@ -38,25 +41,28 @@ export const configure = (input = {}) => {
|
|
|
38
41
|
const chatRoute = configuredRoute(OpenAIChat.route, input);
|
|
39
42
|
const modelDefaults = defaults(input);
|
|
40
43
|
const responses = (id) => responsesRoute
|
|
41
|
-
.with(withOpenAIOptions(id, modelDefaults
|
|
44
|
+
.with(withOpenAIOptions(id, modelDefaults))
|
|
42
45
|
.model({ id });
|
|
43
46
|
const chat = (id) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({
|
|
44
47
|
id,
|
|
45
48
|
compatibility: { supportsPromptCacheKey: true },
|
|
46
49
|
});
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
50
|
+
const deployment = MediaRoute.deployment(input, auth(input));
|
|
51
|
+
const media = {
|
|
52
|
+
...deployment,
|
|
53
|
+
http: mergeHttpOptions(deployment.http, input.queryParams === undefined ? undefined : new HttpOptions({ query: input.queryParams })),
|
|
54
|
+
};
|
|
55
|
+
const image = (modelID) => OpenAIImages.model({ ...media, id: modelID });
|
|
56
|
+
const speech = (modelID) => OpenAISpeech.model({ ...media, id: modelID });
|
|
57
|
+
const transcription = (modelID) => OpenAITranscription.model({ ...media, id: modelID });
|
|
54
58
|
return {
|
|
55
59
|
id,
|
|
56
60
|
model: responses,
|
|
57
61
|
responses,
|
|
58
62
|
chat,
|
|
59
63
|
image,
|
|
64
|
+
speech,
|
|
65
|
+
transcription,
|
|
60
66
|
configure,
|
|
61
67
|
};
|
|
62
68
|
};
|
|
@@ -83,3 +89,5 @@ export const chatModel = (modelID, settings) => configure(config(settings)).chat
|
|
|
83
89
|
export const responses = provider.responses;
|
|
84
90
|
export const chat = provider.chat;
|
|
85
91
|
export const image = provider.image;
|
|
92
|
+
export const speech = provider.speech;
|
|
93
|
+
export const transcription = provider.transcription;
|
|
@@ -11,7 +11,7 @@ export const configure = (input = {}) => {
|
|
|
11
11
|
auth: AuthOptions.bearer(input, "OPENCODE_API_KEY"),
|
|
12
12
|
baseURL: input.baseURL ?? baseURL,
|
|
13
13
|
headers: input.headers,
|
|
14
|
-
http:
|
|
14
|
+
http: HttpOptions.make(input.http),
|
|
15
15
|
});
|
|
16
16
|
return { id, experimental: { evaluation }, configure };
|
|
17
17
|
};
|