@opencode/ai 2.0.14 → 2.0.16
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 +399 -56
- package/dist/experimental/evaluation-client.d.ts +1 -1
- package/dist/experimental/evaluation-client.js +39 -3
- package/dist/experimental/evaluation.d.ts +4 -4
- package/dist/experimental/evaluation.js +2 -2
- package/dist/experimental/system-one.d.ts +3 -3
- package/dist/experimental/system-one.js +40 -51
- package/dist/generation.d.ts +83 -0
- package/dist/generation.js +113 -0
- package/dist/image-client.d.ts +16 -7
- package/dist/image-client.js +29 -13
- package/dist/image.d.ts +1410 -81
- package/dist/image.js +97 -67
- package/dist/index.d.ts +17 -2
- package/dist/index.js +12 -1
- package/dist/llm.d.ts +9 -1
- package/dist/media-model.d.ts +44 -0
- package/dist/media-model.js +49 -0
- package/dist/media.d.ts +213 -0
- package/dist/media.js +227 -0
- package/dist/promise.d.ts +974 -0
- package/dist/promise.js +81 -0
- package/dist/protocols/alibaba-chat.d.ts +12 -0
- package/dist/protocols/alibaba-responses.d.ts +2 -2
- package/dist/protocols/anthropic-messages.js +8 -19
- package/dist/protocols/assemblyai-transcription.d.ts +40 -0
- package/dist/protocols/assemblyai-transcription.js +138 -0
- package/dist/protocols/bedrock-converse.d.ts +4 -4
- package/dist/protocols/bedrock-converse.js +6 -17
- package/dist/protocols/bfl-images.d.ts +32 -0
- package/dist/protocols/bfl-images.js +153 -0
- package/dist/protocols/cartesia-speech.d.ts +127 -0
- package/dist/protocols/cartesia-speech.js +126 -0
- package/dist/protocols/deepgram-speech.d.ts +119 -0
- package/dist/protocols/deepgram-speech.js +92 -0
- package/dist/protocols/deepgram-transcription.d.ts +25 -0
- package/dist/protocols/deepgram-transcription.js +129 -0
- package/dist/protocols/elevenlabs-speech.d.ts +122 -0
- package/dist/protocols/elevenlabs-speech.js +115 -0
- package/dist/protocols/fal-images.d.ts +24 -0
- package/dist/protocols/fal-images.js +114 -0
- package/dist/protocols/fal-video.d.ts +29 -0
- package/dist/protocols/fal-video.js +88 -0
- package/dist/protocols/gemini.d.ts +30 -9
- package/dist/protocols/gemini.js +45 -35
- package/dist/protocols/google-images.d.ts +9 -21
- package/dist/protocols/google-images.js +158 -133
- package/dist/protocols/google-speech.d.ts +130 -0
- package/dist/protocols/google-speech.js +84 -0
- package/dist/protocols/google-transcription.d.ts +173 -0
- package/dist/protocols/google-transcription.js +138 -0
- package/dist/protocols/google-video.d.ts +26 -0
- package/dist/protocols/google-video.js +158 -0
- package/dist/protocols/meta-images.d.ts +7 -12
- package/dist/protocols/meta-images.js +85 -66
- package/dist/protocols/meta-responses.d.ts +4 -4
- package/dist/protocols/meta-responses.js +1 -1
- package/dist/protocols/mistral-chat.js +7 -6
- package/dist/protocols/open-responses.d.ts +17 -9
- package/dist/protocols/open-responses.js +24 -14
- package/dist/protocols/openai-chat.d.ts +118 -1
- package/dist/protocols/openai-chat.js +125 -44
- 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 +128 -18
- package/dist/protocols/openai-images.js +177 -154
- package/dist/protocols/openai-responses.d.ts +15 -15
- package/dist/protocols/openai-responses.js +5 -6
- package/dist/protocols/openai-speech.d.ts +116 -0
- package/dist/protocols/openai-speech.js +98 -0
- package/dist/protocols/openai-transcription.d.ts +207 -0
- package/dist/protocols/openai-transcription.js +190 -0
- package/dist/protocols/replicate-images.d.ts +28 -0
- package/dist/protocols/replicate-images.js +133 -0
- package/dist/protocols/runway-video.d.ts +38 -0
- package/dist/protocols/runway-video.js +146 -0
- package/dist/protocols/shared.d.ts +27 -17
- package/dist/protocols/shared.js +52 -35
- package/dist/protocols/stability-images.d.ts +38 -0
- package/dist/protocols/stability-images.js +148 -0
- package/dist/protocols/utils/bedrock-media.d.ts +2 -3
- package/dist/protocols/utils/bedrock-media.js +4 -4
- package/dist/protocols/utils/fal-queue.d.ts +28 -0
- package/dist/protocols/utils/fal-queue.js +69 -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 +18 -0
- package/dist/protocols/utils/media-input.js +35 -0
- package/dist/protocols/utils/responses-compaction.js +6 -5
- package/dist/protocols/utils/speech-stream.d.ts +49 -0
- package/dist/protocols/utils/speech-stream.js +67 -0
- package/dist/protocols/utils/tool-schema.d.ts +2 -2
- package/dist/protocols/utils/tool-schema.js +40 -17
- package/dist/protocols/utils/tool-stream.d.ts +27 -3
- package/dist/protocols/xai-images.d.ts +9 -15
- package/dist/protocols/xai-images.js +75 -84
- package/dist/protocols/xai-responses.d.ts +2 -2
- package/dist/protocols/xai-video.d.ts +34 -0
- package/dist/protocols/xai-video.js +147 -0
- package/dist/protocols/zai-chat.d.ts +13 -1
- package/dist/protocols/zai-images.d.ts +9 -13
- package/dist/protocols/zai-images.js +59 -57
- package/dist/provider-error.js +3 -0
- package/dist/providers/alibaba.d.ts +14 -2
- package/dist/providers/amazon-bedrock-mantle.d.ts +14 -2
- package/dist/providers/amazon-bedrock.d.ts +2 -2
- package/dist/providers/assemblyai.d.ts +25 -0
- package/dist/providers/assemblyai.js +29 -0
- package/dist/providers/azure.d.ts +18 -6
- 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 +28 -0
- package/dist/providers/cartesia.d.ts +24 -0
- package/dist/providers/cartesia.js +22 -0
- package/dist/providers/cerebras.d.ts +24 -0
- package/dist/providers/cerebras.js +6 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts +30 -6
- package/dist/providers/cloudflare-workers-ai.d.ts +24 -0
- package/dist/providers/deepgram.d.ts +29 -0
- package/dist/providers/deepgram.js +31 -0
- package/dist/providers/deepinfra.d.ts +24 -0
- package/dist/providers/deepinfra.js +6 -1
- package/dist/providers/deepseek.d.ts +24 -0
- package/dist/providers/elevenlabs.d.ts +24 -0
- package/dist/providers/elevenlabs.js +28 -0
- package/dist/providers/fal.d.ts +29 -0
- package/dist/providers/fal.js +33 -0
- package/dist/providers/fireworks.d.ts +24 -0
- package/dist/providers/google-vertex-chat.d.ts +12 -0
- package/dist/providers/google-vertex-responses.d.ts +2 -2
- package/dist/providers/google-vertex.d.ts +10 -3
- package/dist/providers/google.d.ts +25 -3
- package/dist/providers/google.js +11 -2
- package/dist/providers/groq.d.ts +24 -0
- package/dist/providers/index.d.ts +10 -0
- package/dist/providers/index.js +10 -0
- package/dist/providers/meta.d.ts +14 -2
- package/dist/providers/minimax.d.ts +14 -2
- package/dist/providers/moonshot.d.ts +14 -2
- 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.d.ts +25 -3
- package/dist/providers/openai.js +10 -1
- package/dist/providers/openrouter.d.ts +67 -0
- package/dist/providers/openrouter.js +13 -1
- package/dist/providers/replicate.d.ts +25 -0
- package/dist/providers/replicate.js +22 -0
- package/dist/providers/runway.d.ts +24 -0
- package/dist/providers/runway.js +22 -0
- package/dist/providers/stability.d.ts +28 -0
- package/dist/providers/stability.js +23 -0
- package/dist/providers/togetherai.d.ts +24 -0
- package/dist/providers/vercel-ai-gateway.d.ts +41 -0
- package/dist/providers/vercel-ai-gateway.js +85 -0
- package/dist/providers/xai.d.ts +17 -0
- package/dist/providers/xai.js +5 -2
- package/dist/providers/zai-coding-plan.d.ts +15 -3
- package/dist/providers/zai.d.ts +13 -1
- package/dist/route/auth.d.ts +4 -1
- package/dist/route/auth.js +6 -0
- package/dist/route/client.d.ts +9 -1
- package/dist/route/endpoint.d.ts +10 -10
- package/dist/route/executor-service.d.ts +12 -0
- package/dist/route/executor-service.js +3 -0
- package/dist/route/executor.d.ts +4 -9
- package/dist/route/executor.js +3 -3
- package/dist/route/framing.d.ts +5 -1
- package/dist/route/framing.js +9 -0
- package/dist/route/index.d.ts +2 -0
- package/dist/route/index.js +2 -0
- package/dist/route/media-protocol.d.ts +158 -0
- package/dist/route/media-protocol.js +96 -0
- package/dist/route/media.d.ts +97 -0
- package/dist/route/media.js +236 -0
- package/dist/schema/errors.d.ts +13 -3
- package/dist/schema/errors.js +7 -0
- package/dist/schema/events.d.ts +557 -40
- package/dist/schema/events.js +35 -2
- package/dist/schema/messages.d.ts +95 -8
- package/dist/schema/messages.js +8 -6
- package/dist/schema/options.d.ts +6 -3
- package/dist/schema/options.js +6 -2
- package/dist/speech-client.d.ts +21 -0
- package/dist/speech-client.js +25 -0
- package/dist/speech.d.ts +1150 -0
- package/dist/speech.js +119 -0
- package/dist/testing.d.ts +72 -8
- package/dist/transcription-client.d.ts +28 -0
- package/dist/transcription-client.js +44 -0
- package/dist/transcription.d.ts +1504 -0
- package/dist/transcription.js +133 -0
- package/dist/utils/bytes.d.ts +1 -0
- package/dist/utils/bytes.js +10 -0
- package/dist/utils/media-type.d.ts +7 -0
- package/dist/utils/media-type.js +70 -0
- package/dist/utils/sanitize.js +3 -1
- package/dist/video-client.d.ts +28 -0
- package/dist/video-client.js +40 -0
- package/dist/video.d.ts +1359 -0
- package/dist/video.js +119 -0
- package/package.json +7 -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/image-input.d.ts +0 -21
- package/dist/protocols/utils/image-input.js +0 -20
|
@@ -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;
|
|
@@ -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;
|
|
@@ -7,6 +7,8 @@ import { type OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
|
7
7
|
import { type OpenAIImageString } from "../protocols/openai-images.js";
|
|
8
8
|
export type { OpenAIOptionsInput, OpenAIResponseIncludable } from "./openai-options.js";
|
|
9
9
|
export type { OpenAIImageOptions } from "../protocols/openai-images.js";
|
|
10
|
+
export type { OpenAISpeechOptions } from "../protocols/openai-speech.js";
|
|
11
|
+
export type { OpenAITranscriptionOptions } from "../protocols/openai-transcription.js";
|
|
10
12
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
11
13
|
export declare const routes: (Route<{
|
|
12
14
|
readonly model: string;
|
|
@@ -24,6 +26,12 @@ export declare const routes: (Route<{
|
|
|
24
26
|
readonly image_url: {
|
|
25
27
|
readonly url: string;
|
|
26
28
|
};
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: "file";
|
|
31
|
+
readonly file: {
|
|
32
|
+
readonly filename: string;
|
|
33
|
+
readonly file_data: string;
|
|
34
|
+
};
|
|
27
35
|
})[];
|
|
28
36
|
} | {
|
|
29
37
|
readonly role: "user";
|
|
@@ -39,6 +47,12 @@ export declare const routes: (Route<{
|
|
|
39
47
|
readonly image_url: {
|
|
40
48
|
readonly url: string;
|
|
41
49
|
};
|
|
50
|
+
} | {
|
|
51
|
+
readonly type: "file";
|
|
52
|
+
readonly file: {
|
|
53
|
+
readonly filename: string;
|
|
54
|
+
readonly file_data: string;
|
|
55
|
+
};
|
|
42
56
|
})[];
|
|
43
57
|
} | {
|
|
44
58
|
readonly [x: string]: unknown;
|
|
@@ -178,8 +192,8 @@ export declare const routes: (Route<{
|
|
|
178
192
|
} | {
|
|
179
193
|
readonly type: "input_file";
|
|
180
194
|
readonly filename: string;
|
|
181
|
-
readonly detail?: string | undefined;
|
|
182
195
|
readonly file_data?: string | undefined;
|
|
196
|
+
readonly detail?: string | undefined;
|
|
183
197
|
readonly file_url?: string | undefined;
|
|
184
198
|
} | {
|
|
185
199
|
readonly type: "input_text";
|
|
@@ -215,8 +229,8 @@ export declare const routes: (Route<{
|
|
|
215
229
|
} | {
|
|
216
230
|
readonly type: "input_file";
|
|
217
231
|
readonly filename: string;
|
|
218
|
-
readonly detail?: string | undefined;
|
|
219
232
|
readonly file_data?: string | undefined;
|
|
233
|
+
readonly detail?: string | undefined;
|
|
220
234
|
readonly file_url?: string | undefined;
|
|
221
235
|
} | {
|
|
222
236
|
readonly type: "input_text";
|
|
@@ -277,11 +291,11 @@ export declare const routes: (Route<{
|
|
|
277
291
|
readonly size?: string | undefined;
|
|
278
292
|
readonly action?: "generate" | "auto" | "edit" | undefined;
|
|
279
293
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
294
|
+
readonly partial_images?: number | undefined;
|
|
280
295
|
readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
281
296
|
readonly background?: "auto" | "opaque" | "transparent" | undefined;
|
|
282
297
|
readonly output_compression?: number | undefined;
|
|
283
298
|
readonly input_fidelity?: "low" | "high" | undefined;
|
|
284
|
-
readonly partial_images?: number | undefined;
|
|
285
299
|
} | {
|
|
286
300
|
readonly type: "namespace";
|
|
287
301
|
readonly name: string;
|
|
@@ -372,6 +386,8 @@ export declare const configure: (input?: Config) => {
|
|
|
372
386
|
}>;
|
|
373
387
|
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
|
|
374
388
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
389
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
390
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
375
391
|
configure: (input?: Config) => /*elided*/ any;
|
|
376
392
|
};
|
|
377
393
|
export declare const provider: {
|
|
@@ -386,6 +402,8 @@ export declare const provider: {
|
|
|
386
402
|
}>;
|
|
387
403
|
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
|
|
388
404
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
405
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
406
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
389
407
|
configure: (input?: Config) => {
|
|
390
408
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
391
409
|
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, {
|
|
@@ -398,6 +416,8 @@ export declare const provider: {
|
|
|
398
416
|
}>;
|
|
399
417
|
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
|
|
400
418
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
419
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
420
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
401
421
|
configure: /*elided*/ any;
|
|
402
422
|
};
|
|
403
423
|
};
|
|
@@ -409,3 +429,5 @@ export declare const responses: (id: string | ModelID) => import("../schema/opti
|
|
|
409
429
|
}>;
|
|
410
430
|
export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
|
|
411
431
|
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
432
|
+
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
433
|
+
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
package/dist/providers/openai.js
CHANGED
|
@@ -4,6 +4,8 @@ import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
|
4
4
|
import * as OpenAIResponses from "../protocols/openai-responses.js";
|
|
5
5
|
import { withOpenAIOptions } from "./openai-options.js";
|
|
6
6
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
7
|
+
import { OpenAISpeech } from "../protocols/openai-speech.js";
|
|
8
|
+
import { OpenAITranscription } from "../protocols/openai-transcription.js";
|
|
7
9
|
export const id = ProviderID.make("openai");
|
|
8
10
|
export const routes = [OpenAIResponses.route, OpenAIChat.route];
|
|
9
11
|
export const imageGeneration = (options = {}) => ToolDefinition.make({
|
|
@@ -44,19 +46,24 @@ export const configure = (input = {}) => {
|
|
|
44
46
|
id,
|
|
45
47
|
compatibility: { supportsPromptCacheKey: true },
|
|
46
48
|
});
|
|
47
|
-
const
|
|
49
|
+
const media = (modelID) => ({
|
|
48
50
|
id: modelID,
|
|
49
51
|
auth: auth(input),
|
|
50
52
|
baseURL: input.baseURL,
|
|
51
53
|
headers: input.headers,
|
|
52
54
|
http: mergeHttpOptions(input.http === undefined ? undefined : HttpOptions.make(input.http), input.queryParams === undefined ? undefined : new HttpOptions({ query: input.queryParams })),
|
|
53
55
|
});
|
|
56
|
+
const image = (modelID) => OpenAIImages.model(media(modelID));
|
|
57
|
+
const speech = (modelID) => OpenAISpeech.model(media(modelID));
|
|
58
|
+
const transcription = (modelID) => OpenAITranscription.model(media(modelID));
|
|
54
59
|
return {
|
|
55
60
|
id,
|
|
56
61
|
model: responses,
|
|
57
62
|
responses,
|
|
58
63
|
chat,
|
|
59
64
|
image,
|
|
65
|
+
speech,
|
|
66
|
+
transcription,
|
|
60
67
|
configure,
|
|
61
68
|
};
|
|
62
69
|
};
|
|
@@ -83,3 +90,5 @@ export const chatModel = (modelID, settings) => configure(config(settings)).chat
|
|
|
83
90
|
export const responses = provider.responses;
|
|
84
91
|
export const chat = provider.chat;
|
|
85
92
|
export const image = provider.image;
|
|
93
|
+
export const speech = provider.speech;
|
|
94
|
+
export const transcription = provider.transcription;
|
|
@@ -73,6 +73,13 @@ export interface OpenRouterOptions {
|
|
|
73
73
|
}>;
|
|
74
74
|
}
|
|
75
75
|
export type OpenRouterProviderOptionsInput = OpenRouterOptions;
|
|
76
|
+
export interface OpenRouterEvaluationOptions {
|
|
77
|
+
readonly [key: string]: unknown;
|
|
78
|
+
readonly provider?: OpenRouterProviderRouting;
|
|
79
|
+
readonly session_id?: string;
|
|
80
|
+
readonly trace?: Readonly<Record<string, unknown>>;
|
|
81
|
+
readonly user?: string;
|
|
82
|
+
}
|
|
76
83
|
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
77
84
|
readonly baseURL?: string;
|
|
78
85
|
readonly providerOptions?: OpenRouterProviderOptionsInput;
|
|
@@ -97,6 +104,12 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
|
|
|
97
104
|
readonly image_url: Schema.Struct<{
|
|
98
105
|
readonly url: Schema.String;
|
|
99
106
|
}>;
|
|
107
|
+
}>, Schema.Struct<{
|
|
108
|
+
readonly type: Schema.Literal<"file">;
|
|
109
|
+
readonly file: Schema.Struct<{
|
|
110
|
+
readonly filename: Schema.String;
|
|
111
|
+
readonly file_data: Schema.String;
|
|
112
|
+
}>;
|
|
100
113
|
}>]>>]>;
|
|
101
114
|
}>, Schema.Struct<{
|
|
102
115
|
readonly role: Schema.Literal<"user">;
|
|
@@ -112,6 +125,12 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
|
|
|
112
125
|
readonly image_url: Schema.Struct<{
|
|
113
126
|
readonly url: Schema.String;
|
|
114
127
|
}>;
|
|
128
|
+
}>, Schema.Struct<{
|
|
129
|
+
readonly type: Schema.Literal<"file">;
|
|
130
|
+
readonly file: Schema.Struct<{
|
|
131
|
+
readonly filename: Schema.String;
|
|
132
|
+
readonly file_data: Schema.String;
|
|
133
|
+
}>;
|
|
115
134
|
}>]>>]>;
|
|
116
135
|
}>, Schema.StructWithRest<Schema.Struct<{
|
|
117
136
|
readonly role: Schema.Literal<"assistant">;
|
|
@@ -195,6 +214,12 @@ export declare const protocol: Protocol<{
|
|
|
195
214
|
readonly image_url: {
|
|
196
215
|
readonly url: string;
|
|
197
216
|
};
|
|
217
|
+
} | {
|
|
218
|
+
readonly type: "file";
|
|
219
|
+
readonly file: {
|
|
220
|
+
readonly filename: string;
|
|
221
|
+
readonly file_data: string;
|
|
222
|
+
};
|
|
198
223
|
})[];
|
|
199
224
|
} | {
|
|
200
225
|
readonly role: "user";
|
|
@@ -210,6 +235,12 @@ export declare const protocol: Protocol<{
|
|
|
210
235
|
readonly image_url: {
|
|
211
236
|
readonly url: string;
|
|
212
237
|
};
|
|
238
|
+
} | {
|
|
239
|
+
readonly type: "file";
|
|
240
|
+
readonly file: {
|
|
241
|
+
readonly filename: string;
|
|
242
|
+
readonly file_data: string;
|
|
243
|
+
};
|
|
213
244
|
})[];
|
|
214
245
|
} | {
|
|
215
246
|
readonly [x: string]: unknown;
|
|
@@ -362,6 +393,12 @@ export declare const route: Route<{
|
|
|
362
393
|
readonly image_url: {
|
|
363
394
|
readonly url: string;
|
|
364
395
|
};
|
|
396
|
+
} | {
|
|
397
|
+
readonly type: "file";
|
|
398
|
+
readonly file: {
|
|
399
|
+
readonly filename: string;
|
|
400
|
+
readonly file_data: string;
|
|
401
|
+
};
|
|
365
402
|
})[];
|
|
366
403
|
} | {
|
|
367
404
|
readonly role: "user";
|
|
@@ -377,6 +414,12 @@ export declare const route: Route<{
|
|
|
377
414
|
readonly image_url: {
|
|
378
415
|
readonly url: string;
|
|
379
416
|
};
|
|
417
|
+
} | {
|
|
418
|
+
readonly type: "file";
|
|
419
|
+
readonly file: {
|
|
420
|
+
readonly filename: string;
|
|
421
|
+
readonly file_data: string;
|
|
422
|
+
};
|
|
380
423
|
})[];
|
|
381
424
|
} | {
|
|
382
425
|
readonly [x: string]: unknown;
|
|
@@ -462,6 +505,12 @@ export declare const routes: Route<{
|
|
|
462
505
|
readonly image_url: {
|
|
463
506
|
readonly url: string;
|
|
464
507
|
};
|
|
508
|
+
} | {
|
|
509
|
+
readonly type: "file";
|
|
510
|
+
readonly file: {
|
|
511
|
+
readonly filename: string;
|
|
512
|
+
readonly file_data: string;
|
|
513
|
+
};
|
|
465
514
|
})[];
|
|
466
515
|
} | {
|
|
467
516
|
readonly role: "user";
|
|
@@ -477,6 +526,12 @@ export declare const routes: Route<{
|
|
|
477
526
|
readonly image_url: {
|
|
478
527
|
readonly url: string;
|
|
479
528
|
};
|
|
529
|
+
} | {
|
|
530
|
+
readonly type: "file";
|
|
531
|
+
readonly file: {
|
|
532
|
+
readonly filename: string;
|
|
533
|
+
readonly file_data: string;
|
|
534
|
+
};
|
|
480
535
|
})[];
|
|
481
536
|
} | {
|
|
482
537
|
readonly [x: string]: unknown;
|
|
@@ -548,16 +603,28 @@ export declare const routes: Route<{
|
|
|
548
603
|
export declare const configure: (input?: LanguageModelOptions) => {
|
|
549
604
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
550
605
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions, import("../route/client.js").CompactionOperations | undefined>;
|
|
606
|
+
experimental: {
|
|
607
|
+
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<OpenRouterEvaluationOptions>;
|
|
608
|
+
};
|
|
551
609
|
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
552
610
|
};
|
|
553
611
|
export declare const provider: {
|
|
554
612
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
555
613
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions, import("../route/client.js").CompactionOperations | undefined>;
|
|
614
|
+
experimental: {
|
|
615
|
+
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<OpenRouterEvaluationOptions>;
|
|
616
|
+
};
|
|
556
617
|
configure: (input?: LanguageModelOptions) => {
|
|
557
618
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
558
619
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions, import("../route/client.js").CompactionOperations | undefined>;
|
|
620
|
+
experimental: {
|
|
621
|
+
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<OpenRouterEvaluationOptions>;
|
|
622
|
+
};
|
|
559
623
|
configure: /*elided*/ any;
|
|
560
624
|
};
|
|
561
625
|
};
|
|
626
|
+
export declare const experimental: {
|
|
627
|
+
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<OpenRouterEvaluationOptions>;
|
|
628
|
+
};
|
|
562
629
|
export declare const model: ProviderPackage.Definition<Settings, OpenRouterProviderOptionsInput>["model"];
|
|
563
630
|
export {};
|
|
@@ -3,7 +3,8 @@ import { Route } from "../route/client.js";
|
|
|
3
3
|
import { Endpoint } from "../route/endpoint.js";
|
|
4
4
|
import { Protocol } from "../route/protocol.js";
|
|
5
5
|
import { AuthOptions } from "../route/auth-options.js";
|
|
6
|
-
import { ProviderID } from "../schema/index.js";
|
|
6
|
+
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
7
|
+
import { SystemOne } from "../experimental/system-one.js";
|
|
7
8
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
8
9
|
import { newBreakpoints, ttlBucket } from "../protocols/utils/cache.js";
|
|
9
10
|
import { isRecord } from "../protocols/shared.js";
|
|
@@ -98,13 +99,24 @@ const configuredRoute = (input) => {
|
|
|
98
99
|
};
|
|
99
100
|
export const configure = (input = {}) => {
|
|
100
101
|
const route = configuredRoute(input);
|
|
102
|
+
const evaluation = (modelID) => SystemOne.model({
|
|
103
|
+
id: modelID,
|
|
104
|
+
provider: id,
|
|
105
|
+
providerMetadataKey: "openrouter",
|
|
106
|
+
auth: AuthOptions.bearer(input, "OPENROUTER_API_KEY"),
|
|
107
|
+
baseURL: input.baseURL ?? baseURL,
|
|
108
|
+
headers: input.headers,
|
|
109
|
+
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
110
|
+
});
|
|
101
111
|
return {
|
|
102
112
|
id,
|
|
103
113
|
model: (modelID) => route.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } }),
|
|
114
|
+
experimental: { evaluation },
|
|
104
115
|
configure,
|
|
105
116
|
};
|
|
106
117
|
};
|
|
107
118
|
export const provider = configure();
|
|
119
|
+
export const experimental = provider.experimental;
|
|
108
120
|
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
109
121
|
apiKey,
|
|
110
122
|
baseURL,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
|
+
export type { ReplicateImageOptions } from "../protocols/replicate-images.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
readonly baseURL?: string;
|
|
7
|
+
/** `{ Prefer: "wait=60" }` holds the submission open until the prediction finishes (up to 60 seconds). */
|
|
8
|
+
readonly headers?: Record<string, string>;
|
|
9
|
+
readonly http?: HttpOptions.Input;
|
|
10
|
+
};
|
|
11
|
+
export declare const configure: (input?: Config) => {
|
|
12
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
13
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/replicate-images.js").ReplicateImageOptions>;
|
|
14
|
+
configure: (input?: Config) => /*elided*/ any;
|
|
15
|
+
};
|
|
16
|
+
export declare const provider: {
|
|
17
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
18
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/replicate-images.js").ReplicateImageOptions>;
|
|
19
|
+
configure: (input?: Config) => {
|
|
20
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
21
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/replicate-images.js").ReplicateImageOptions>;
|
|
22
|
+
configure: /*elided*/ any;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/replicate-images.js").ReplicateImageOptions>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
3
|
+
import { DEFAULT_BASE_URL, ReplicateImages } from "../protocols/replicate-images.js";
|
|
4
|
+
export const id = ProviderID.make("replicate");
|
|
5
|
+
const baseURL = DEFAULT_BASE_URL;
|
|
6
|
+
const auth = (options) => AuthOptions.bearer(options, "REPLICATE_API_TOKEN");
|
|
7
|
+
export const configure = (input = {}) => {
|
|
8
|
+
const image = (modelID) => ReplicateImages.model({
|
|
9
|
+
id: modelID,
|
|
10
|
+
auth: auth(input),
|
|
11
|
+
baseURL: input.baseURL ?? baseURL,
|
|
12
|
+
headers: input.headers,
|
|
13
|
+
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
image,
|
|
18
|
+
configure,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const provider = configure();
|
|
22
|
+
export const image = provider.image;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
|
+
export type { RunwayVideoOptions } from "../protocols/runway-video.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
readonly baseURL?: string;
|
|
7
|
+
readonly headers?: Record<string, string>;
|
|
8
|
+
readonly http?: HttpOptions.Input;
|
|
9
|
+
};
|
|
10
|
+
export declare const configure: (input?: Config) => {
|
|
11
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
12
|
+
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/runway-video.js").RunwayVideoOptions>;
|
|
13
|
+
configure: (input?: Config) => /*elided*/ any;
|
|
14
|
+
};
|
|
15
|
+
export declare const provider: {
|
|
16
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
17
|
+
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/runway-video.js").RunwayVideoOptions>;
|
|
18
|
+
configure: (input?: Config) => {
|
|
19
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
20
|
+
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/runway-video.js").RunwayVideoOptions>;
|
|
21
|
+
configure: /*elided*/ any;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/runway-video.js").RunwayVideoOptions>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
3
|
+
import { DEFAULT_BASE_URL, RunwayVideo } from "../protocols/runway-video.js";
|
|
4
|
+
export const id = ProviderID.make("runway");
|
|
5
|
+
const baseURL = DEFAULT_BASE_URL;
|
|
6
|
+
const auth = (options) => AuthOptions.bearer(options, "RUNWAYML_API_SECRET");
|
|
7
|
+
export const configure = (input = {}) => {
|
|
8
|
+
const video = (modelID) => RunwayVideo.model({
|
|
9
|
+
id: modelID,
|
|
10
|
+
auth: auth(input),
|
|
11
|
+
baseURL: input.baseURL ?? baseURL,
|
|
12
|
+
headers: input.headers,
|
|
13
|
+
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
video,
|
|
18
|
+
configure,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const provider = configure();
|
|
22
|
+
export const video = provider.video;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
|
+
export type { StabilityImageOptions, StabilityUpscaleOptions } from "../protocols/stability-images.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
readonly baseURL?: string;
|
|
7
|
+
readonly headers?: Record<string, string>;
|
|
8
|
+
readonly http?: HttpOptions.Input;
|
|
9
|
+
};
|
|
10
|
+
export declare const configure: (input?: Config) => {
|
|
11
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
12
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityImageOptions>;
|
|
13
|
+
upscale: () => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityUpscaleOptions>;
|
|
14
|
+
configure: (input?: Config) => /*elided*/ any;
|
|
15
|
+
};
|
|
16
|
+
export declare const provider: {
|
|
17
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
18
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityImageOptions>;
|
|
19
|
+
upscale: () => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityUpscaleOptions>;
|
|
20
|
+
configure: (input?: Config) => {
|
|
21
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
22
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityImageOptions>;
|
|
23
|
+
upscale: () => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityUpscaleOptions>;
|
|
24
|
+
configure: /*elided*/ any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityImageOptions>;
|
|
28
|
+
export declare const upscale: () => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityUpscaleOptions>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
3
|
+
import { DEFAULT_BASE_URL, StabilityImages } from "../protocols/stability-images.js";
|
|
4
|
+
export const id = ProviderID.make("stability");
|
|
5
|
+
const baseURL = DEFAULT_BASE_URL;
|
|
6
|
+
const auth = (options) => AuthOptions.bearer(options, "STABILITY_API_KEY");
|
|
7
|
+
export const configure = (input = {}) => {
|
|
8
|
+
const deployment = {
|
|
9
|
+
auth: auth(input),
|
|
10
|
+
baseURL: input.baseURL ?? baseURL,
|
|
11
|
+
headers: input.headers,
|
|
12
|
+
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
id,
|
|
16
|
+
image: (modelID) => StabilityImages.model({ ...deployment, id: modelID }),
|
|
17
|
+
upscale: () => StabilityImages.upscaleModel(deployment),
|
|
18
|
+
configure,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const provider = configure();
|
|
22
|
+
export const image = provider.image;
|
|
23
|
+
export const upscale = provider.upscale;
|