@revojs/ai 0.2.21 → 0.2.22
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 +34 -7
- package/dist/index.d.ts +72 -1
- package/dist/index.js +63 -1
- package/dist/module/index.d.ts +5 -0
- package/dist/module/index.js +11 -4
- package/dist/providers/anthropic.d.ts +5 -26
- package/dist/providers/anthropic.js +5 -28
- package/dist/providers/deepseek.d.ts +5 -12
- package/dist/providers/deepseek.js +5 -14
- package/dist/providers/google.d.ts +5 -22
- package/dist/providers/google.js +5 -24
- package/dist/providers/moonshotai.d.ts +5 -18
- package/dist/providers/moonshotai.js +5 -20
- package/dist/providers/openai.d.ts +5 -26
- package/dist/providers/openai.js +6 -29
- package/dist/providers/opencode-go.d.ts +6 -97
- package/dist/providers/opencode-go.js +16 -100
- package/dist/providers/opencode.d.ts +5 -160
- package/dist/providers/opencode.js +20 -166
- package/dist/providers/xai.d.ts +5 -14
- package/dist/providers/xai.js +5 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -207,10 +207,37 @@ server-side `opencodeApiKey` variable. Supply a stable `x-opencode-session` head
|
|
|
207
207
|
for every request, normally the conversation ID. Caller headers cannot override
|
|
208
208
|
authorization, and Responses requests always use `store: false`.
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
210
|
+
Each model's protocol follows its models.dev `provider.npm`: `@ai-sdk/openai` uses Responses
|
|
211
|
+
(or Chat Completions when `provider.shape` is `completions`), `@ai-sdk/anthropic` uses
|
|
212
|
+
Anthropic Messages, and `@ai-sdk/openai-compatible` uses Chat Completions.
|
|
213
|
+
|
|
214
|
+
## Model catalogs
|
|
215
|
+
|
|
216
|
+
Every bundled provider takes its models from the [models.dev catalog](https://models.dev)
|
|
217
|
+
at runtime instead of a hard-coded list, so new models work as soon as models.dev lists
|
|
218
|
+
them, without a package release. IDs that models.dev does not list are rejected as unknown
|
|
219
|
+
models.
|
|
220
|
+
|
|
221
|
+
| Provider | models.dev ID | Protocol |
|
|
222
|
+
| ----------------------------------------- | ---------------- | ----------------------------------------------------------------- |
|
|
223
|
+
| `anthropic` | `anthropic` | Anthropic Messages |
|
|
224
|
+
| `openai` | `openai` | Responses |
|
|
225
|
+
| `deepseek`, `google`, `moonshotai`, `xai` | same as provider | Chat Completions (OpenAI-compatible endpoints) |
|
|
226
|
+
| `opencode` | `opencode` | Per model: Chat Completions, Responses, Messages or Google Models |
|
|
227
|
+
| `opencode-go` | `opencode-go` | Per model: Chat Completions, Responses or Messages |
|
|
228
|
+
|
|
229
|
+
`models()` returns the routable chat models as `Description`s (name, status, tool-call,
|
|
230
|
+
reasoning and attachment support, input/output modalities, limits and cost), so
|
|
231
|
+
applications can build model pickers and validate selections without hard-coded lists.
|
|
232
|
+
Filter on `status` (`deprecated`) and `toolCall` yourself.
|
|
233
|
+
|
|
234
|
+
The catalog is fetched once per isolate and cached. Configure it through the module's
|
|
235
|
+
`catalog` settings (defaults: `url` `https://models.dev/api.json?type=chat`, `maxAge`
|
|
236
|
+
3,600,000 ms, `timeout` 10,000 ms). A failed refresh keeps the previous catalog; without
|
|
237
|
+
one, provider setup throws.
|
|
238
|
+
|
|
239
|
+
Custom providers use the same mechanism: `useModelsDev(id, resolve)` returns `models`,
|
|
240
|
+
`textGenerate` and `textStream` for a models.dev provider, where `resolve(model, provider)`
|
|
241
|
+
returns the `TextProtocols` for a model or `undefined` to skip it.
|
|
242
|
+
`modelsDevProtocol(model, provider)` maps a model's AI SDK package to a protocol name.
|
|
243
|
+
Live availability and subscription limits stay controlled by the provider.
|
package/dist/index.d.ts
CHANGED
|
@@ -588,7 +588,72 @@ export type LanguageModelFilePart = Omit<LanguageModelFile, "providerMetadata" |
|
|
|
588
588
|
providerOptions?: Record<string, JSONObject>;
|
|
589
589
|
};
|
|
590
590
|
export type Protocol<TOptions, TResult> = (options: TOptions) => PromiseLike<TResult>;
|
|
591
|
+
export type Modality = "text" | "audio" | "image" | "video" | "pdf";
|
|
592
|
+
export type Status = "alpha" | "beta" | "deprecated";
|
|
593
|
+
export type ModelsDevCatalog = Record<string, ModelsDevProvider>;
|
|
594
|
+
export type ModelsDevProtocol = "chat-completions" | "responses" | "messages" | "google-models";
|
|
595
|
+
export interface Description {
|
|
596
|
+
id: string;
|
|
597
|
+
name: string;
|
|
598
|
+
family?: string;
|
|
599
|
+
status?: Status;
|
|
600
|
+
toolCall: boolean;
|
|
601
|
+
reasoning: boolean;
|
|
602
|
+
attachment: boolean;
|
|
603
|
+
input: Array<Modality>;
|
|
604
|
+
output: Array<Modality>;
|
|
605
|
+
contextTokens?: number;
|
|
606
|
+
outputTokens?: number;
|
|
607
|
+
cost?: Cost;
|
|
608
|
+
}
|
|
609
|
+
export interface Cost {
|
|
610
|
+
input: number;
|
|
611
|
+
output: number;
|
|
612
|
+
cacheRead?: number;
|
|
613
|
+
cacheWrite?: number;
|
|
614
|
+
}
|
|
615
|
+
export interface TextProtocols {
|
|
616
|
+
textGenerate: Protocol<LanguageModelCallOptions, LanguageModelGenerateResult>;
|
|
617
|
+
textStream: Protocol<LanguageModelCallOptions, LanguageModelStreamResult>;
|
|
618
|
+
}
|
|
619
|
+
export interface ModelsDevModel {
|
|
620
|
+
id: string;
|
|
621
|
+
name: string;
|
|
622
|
+
type?: string;
|
|
623
|
+
family?: string;
|
|
624
|
+
status?: Status;
|
|
625
|
+
tool_call: boolean;
|
|
626
|
+
reasoning: boolean;
|
|
627
|
+
attachment: boolean;
|
|
628
|
+
modalities?: {
|
|
629
|
+
input: Array<Modality>;
|
|
630
|
+
output: Array<Modality>;
|
|
631
|
+
};
|
|
632
|
+
limit?: {
|
|
633
|
+
context?: number;
|
|
634
|
+
output?: number;
|
|
635
|
+
};
|
|
636
|
+
cost?: {
|
|
637
|
+
input: number;
|
|
638
|
+
output: number;
|
|
639
|
+
cache_read?: number;
|
|
640
|
+
cache_write?: number;
|
|
641
|
+
};
|
|
642
|
+
provider?: {
|
|
643
|
+
npm?: string;
|
|
644
|
+
api?: string;
|
|
645
|
+
shape?: "responses" | "completions";
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
export interface ModelsDevProvider {
|
|
649
|
+
id: string;
|
|
650
|
+
name: string;
|
|
651
|
+
npm: string;
|
|
652
|
+
api?: string;
|
|
653
|
+
models: Record<string, ModelsDevModel>;
|
|
654
|
+
}
|
|
591
655
|
export interface ProviderConnection {
|
|
656
|
+
models?: () => PromiseLike<Array<Description>>;
|
|
592
657
|
textGenerate?: Record<string, Protocol<LanguageModelCallOptions, LanguageModelGenerateResult>>;
|
|
593
658
|
textStream?: Record<string, Protocol<LanguageModelCallOptions, LanguageModelStreamResult>>;
|
|
594
659
|
embed?: Record<string, Protocol<EmbeddingModelCallOptions, EmbeddingModelResult>>;
|
|
@@ -670,7 +735,7 @@ export interface SkillsUploadSkillResult {
|
|
|
670
735
|
warnings: Array<SharedWarning>;
|
|
671
736
|
}
|
|
672
737
|
export interface Provider {
|
|
673
|
-
setup: (scope: Scope) => ProviderConnection
|
|
738
|
+
setup: (scope: Scope) => Awaitable<ProviderConnection>;
|
|
674
739
|
}
|
|
675
740
|
export declare class ModelContextProtocolConnection {
|
|
676
741
|
readonly client: Client;
|
|
@@ -690,6 +755,12 @@ export declare function handleModelContextProtocol(scope: Scope, options?: Model
|
|
|
690
755
|
export declare function useModelContextProtocol(options: ModelContextProtocolConnectOptions): Promise<ModelContextProtocolConnection>;
|
|
691
756
|
export declare function defineProvider<TProvider extends Provider>(provider: TProvider): TProvider;
|
|
692
757
|
export declare function useAi<TSource extends Source<Provider> = typeof import("#providers").default>(scope: Scope): AiConnections<TSource>;
|
|
758
|
+
export declare function useModelsDev(id: string, resolve: (model: ModelsDevModel, provider: ModelsDevProvider) => TextProtocols | undefined): Promise<{
|
|
759
|
+
models: () => Promise<Description[]>;
|
|
760
|
+
textGenerate: Record<string, Protocol<LanguageModelCallOptions<string>, LanguageModelGenerateResult>>;
|
|
761
|
+
textStream: Record<string, Protocol<LanguageModelCallOptions<string>, LanguageModelStreamResult>>;
|
|
762
|
+
}>;
|
|
763
|
+
export declare function modelsDevProtocol(model: ModelsDevModel, provider: ModelsDevProvider): ModelsDevProtocol | undefined;
|
|
693
764
|
export declare function mergeHeaders(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string>;
|
|
694
765
|
export declare function postJson(url: string, body: unknown, options?: {
|
|
695
766
|
headers?: Record<string, string | undefined>;
|
package/dist/index.js
CHANGED
|
@@ -297,6 +297,7 @@ function useAi(scope) {
|
|
|
297
297
|
return protocol(options);
|
|
298
298
|
};
|
|
299
299
|
const provide = (name) => ({
|
|
300
|
+
models: () => invoke(name, "models", void 0),
|
|
300
301
|
textGenerate: (options) => invoke(name, "textGenerate", options),
|
|
301
302
|
textStream: (options) => invoke(name, "textStream", options),
|
|
302
303
|
embed: (options) => invoke(name, "embed", options),
|
|
@@ -310,6 +311,66 @@ function useAi(scope) {
|
|
|
310
311
|
});
|
|
311
312
|
return Object.fromEntries(names.map((name) => [name, provide(name)]));
|
|
312
313
|
}
|
|
314
|
+
async function useModelsDev(id, resolve) {
|
|
315
|
+
const now = Date.now();
|
|
316
|
+
if (!modelsDevCache.catalog || now - modelsDevCache.loadedAt >= config.catalog.maxAge) try {
|
|
317
|
+
const response = await globalThis.fetch(config.catalog.url, {
|
|
318
|
+
headers: { Accept: "application/json" },
|
|
319
|
+
signal: AbortSignal.timeout(config.catalog.timeout)
|
|
320
|
+
});
|
|
321
|
+
if (!response.ok) throw new Error(`models.dev responded with ${response.status}`);
|
|
322
|
+
const catalog = await response.json();
|
|
323
|
+
if (typeof catalog !== "object" || catalog === null || Array.isArray(catalog)) throw new Error("models.dev returned an unexpected catalog");
|
|
324
|
+
modelsDevCache.catalog = catalog;
|
|
325
|
+
modelsDevCache.loadedAt = now;
|
|
326
|
+
} catch (error) {
|
|
327
|
+
if (!modelsDevCache.catalog) throw new Error("The models.dev catalog is unavailable.", { cause: error });
|
|
328
|
+
}
|
|
329
|
+
const provider = modelsDevCache.catalog?.[id];
|
|
330
|
+
if (provider === void 0 || typeof provider.models !== "object" || provider.models === null) throw new Error(`models.dev has no provider "${id}".`);
|
|
331
|
+
const models = new Array();
|
|
332
|
+
const textGenerate = {};
|
|
333
|
+
const textStream = {};
|
|
334
|
+
for (const model of Object.values(provider.models)) {
|
|
335
|
+
if ((model.type ?? "chat") !== "chat" || !(model.modalities?.output ?? ["text"]).includes("text")) continue;
|
|
336
|
+
const protocols = resolve(model, provider);
|
|
337
|
+
if (protocols === void 0) continue;
|
|
338
|
+
const description = {
|
|
339
|
+
id: model.id,
|
|
340
|
+
name: model.name,
|
|
341
|
+
family: model.family,
|
|
342
|
+
status: model.status,
|
|
343
|
+
toolCall: model.tool_call === true,
|
|
344
|
+
reasoning: model.reasoning === true,
|
|
345
|
+
attachment: model.attachment === true,
|
|
346
|
+
input: model.modalities?.input ?? ["text"],
|
|
347
|
+
output: model.modalities?.output ?? ["text"],
|
|
348
|
+
contextTokens: model.limit?.context,
|
|
349
|
+
outputTokens: model.limit?.output
|
|
350
|
+
};
|
|
351
|
+
if (model.cost) description.cost = {
|
|
352
|
+
input: model.cost.input,
|
|
353
|
+
output: model.cost.output,
|
|
354
|
+
cacheRead: model.cost.cache_read,
|
|
355
|
+
cacheWrite: model.cost.cache_write
|
|
356
|
+
};
|
|
357
|
+
models.push(description);
|
|
358
|
+
textGenerate[model.id] = protocols.textGenerate;
|
|
359
|
+
textStream[model.id] = protocols.textStream;
|
|
360
|
+
}
|
|
361
|
+
return {
|
|
362
|
+
models: () => Promise.resolve(models),
|
|
363
|
+
textGenerate,
|
|
364
|
+
textStream
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function modelsDevProtocol(model, provider) {
|
|
368
|
+
const npm = model.provider?.npm ?? provider.npm;
|
|
369
|
+
if (npm === "@ai-sdk/anthropic") return "messages";
|
|
370
|
+
if (npm === "@ai-sdk/google") return "google-models";
|
|
371
|
+
if (npm === "@ai-sdk/openai") return model.provider?.shape === "completions" ? "chat-completions" : "responses";
|
|
372
|
+
if (npm === "@ai-sdk/openai-compatible") return "chat-completions";
|
|
373
|
+
}
|
|
313
374
|
function mergeHeaders(...headers) {
|
|
314
375
|
const merged = {};
|
|
315
376
|
for (const record of headers) for (const [name, value] of Object.entries(record ?? {})) if (value !== void 0) merged[name] = value;
|
|
@@ -358,5 +419,6 @@ function toStream(read) {
|
|
|
358
419
|
}
|
|
359
420
|
});
|
|
360
421
|
}
|
|
422
|
+
var modelsDevCache = { loadedAt: 0 };
|
|
361
423
|
//#endregion
|
|
362
|
-
export { ModelContextProtocolConnection, defineProvider, defineTool, handleModelContextProtocol, mergeHeaders, postJson, readDataFrames, toStream, useAi, useModelContextProtocol, useTools };
|
|
424
|
+
export { ModelContextProtocolConnection, defineProvider, defineTool, handleModelContextProtocol, mergeHeaders, modelsDevProtocol, postJson, readDataFrames, toStream, useAi, useModelContextProtocol, useModelsDev, useTools };
|
package/dist/module/index.d.ts
CHANGED
package/dist/module/index.js
CHANGED
|
@@ -3,10 +3,17 @@ import { defineModule, useModule } from "revojs/module";
|
|
|
3
3
|
//#region src/module/index.ts
|
|
4
4
|
var module_default = defineModule({
|
|
5
5
|
name: "ai",
|
|
6
|
-
config: () => ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
config: () => ({
|
|
7
|
+
catalog: {
|
|
8
|
+
url: "https://models.dev/api.json?type=chat",
|
|
9
|
+
maxAge: 36e5,
|
|
10
|
+
timeout: 1e4
|
|
11
|
+
},
|
|
12
|
+
modelContextProtocol: {
|
|
13
|
+
name: "revojs",
|
|
14
|
+
version: "1.0.0"
|
|
15
|
+
}
|
|
16
|
+
}),
|
|
10
17
|
modules: [server],
|
|
11
18
|
setup(config) {
|
|
12
19
|
const { fromModule } = useModule(import.meta.url);
|
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
setup: (scope: import("revojs").Scope) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"claude-opus-4-8": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
8
|
-
"claude-opus-4-7": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
9
|
-
"claude-opus-4-6": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
10
|
-
"claude-opus-4-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
11
|
-
"claude-sonnet-4-6": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
12
|
-
"claude-sonnet-4-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
13
|
-
"claude-haiku-4-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
14
|
-
};
|
|
15
|
-
textStream: {
|
|
16
|
-
"claude-sonnet-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
17
|
-
"claude-opus-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
18
|
-
"claude-fable-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
19
|
-
"claude-opus-4-8": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
20
|
-
"claude-opus-4-7": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
21
|
-
"claude-opus-4-6": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
22
|
-
"claude-opus-4-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
23
|
-
"claude-sonnet-4-6": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
24
|
-
"claude-sonnet-4-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
25
|
-
"claude-haiku-4-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
2
|
+
setup: (scope: import("revojs").Scope) => Promise<{
|
|
3
|
+
models: () => Promise<import("../index").Description[]>;
|
|
4
|
+
textGenerate: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>>;
|
|
5
|
+
textStream: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>>;
|
|
6
|
+
}>;
|
|
28
7
|
};
|
|
29
8
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineProvider } from "../index.js";
|
|
1
|
+
import { defineProvider, useModelsDev } from "../index.js";
|
|
2
2
|
import { messagesGenerateProtocol, messagesStreamProtocol } from "../protocols/anthropic-messages.js";
|
|
3
3
|
import { useVariables } from "revojs";
|
|
4
4
|
//#region src/providers/anthropic.ts
|
|
@@ -7,34 +7,11 @@ var anthropic_default = defineProvider({ setup: (scope) => {
|
|
|
7
7
|
baseURL: "https://api.anthropic.com/v1",
|
|
8
8
|
apiKey: useVariables(scope).anthropicApiKey
|
|
9
9
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
textGenerate: {
|
|
14
|
-
"claude-sonnet-5": messagesGenerate,
|
|
15
|
-
"claude-opus-5": messagesGenerate,
|
|
16
|
-
"claude-fable-5": messagesGenerate,
|
|
17
|
-
"claude-opus-4-8": messagesGenerate,
|
|
18
|
-
"claude-opus-4-7": messagesGenerate,
|
|
19
|
-
"claude-opus-4-6": messagesGenerate,
|
|
20
|
-
"claude-opus-4-5": messagesGenerate,
|
|
21
|
-
"claude-sonnet-4-6": messagesGenerate,
|
|
22
|
-
"claude-sonnet-4-5": messagesGenerate,
|
|
23
|
-
"claude-haiku-4-5": messagesGenerate
|
|
24
|
-
},
|
|
25
|
-
textStream: {
|
|
26
|
-
"claude-sonnet-5": messagesStream,
|
|
27
|
-
"claude-opus-5": messagesStream,
|
|
28
|
-
"claude-fable-5": messagesStream,
|
|
29
|
-
"claude-opus-4-8": messagesStream,
|
|
30
|
-
"claude-opus-4-7": messagesStream,
|
|
31
|
-
"claude-opus-4-6": messagesStream,
|
|
32
|
-
"claude-opus-4-5": messagesStream,
|
|
33
|
-
"claude-sonnet-4-6": messagesStream,
|
|
34
|
-
"claude-sonnet-4-5": messagesStream,
|
|
35
|
-
"claude-haiku-4-5": messagesStream
|
|
36
|
-
}
|
|
10
|
+
const protocols = {
|
|
11
|
+
textGenerate: messagesGenerateProtocol(config),
|
|
12
|
+
textStream: messagesStreamProtocol(config)
|
|
37
13
|
};
|
|
14
|
+
return useModelsDev("anthropic", () => protocols);
|
|
38
15
|
} });
|
|
39
16
|
//#endregion
|
|
40
17
|
export { anthropic_default as default };
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
setup: (scope: import("revojs").Scope) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
textStream: {
|
|
9
|
-
"deepseek-v4-pro": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
10
|
-
"deepseek-v4-flash": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
11
|
-
"deepseek-v4-flash-vision-exp": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
2
|
+
setup: (scope: import("revojs").Scope) => Promise<{
|
|
3
|
+
models: () => Promise<import("../index").Description[]>;
|
|
4
|
+
textGenerate: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>>;
|
|
5
|
+
textStream: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>>;
|
|
6
|
+
}>;
|
|
14
7
|
};
|
|
15
8
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineProvider } from "../index.js";
|
|
1
|
+
import { defineProvider, useModelsDev } from "../index.js";
|
|
2
2
|
import { chatCompletionsGenerateProtocol, chatCompletionsStreamProtocol } from "../protocols/openai-chat-completions.js";
|
|
3
3
|
import { useVariables } from "revojs";
|
|
4
4
|
//#region src/providers/deepseek.ts
|
|
@@ -7,20 +7,11 @@ var deepseek_default = defineProvider({ setup: (scope) => {
|
|
|
7
7
|
baseURL: "https://api.deepseek.com/v1",
|
|
8
8
|
apiKey: useVariables(scope).deepseekApiKey
|
|
9
9
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
textGenerate: {
|
|
14
|
-
"deepseek-v4-pro": chatCompletionsGenerate,
|
|
15
|
-
"deepseek-v4-flash": chatCompletionsGenerate,
|
|
16
|
-
"deepseek-v4-flash-vision-exp": chatCompletionsGenerate
|
|
17
|
-
},
|
|
18
|
-
textStream: {
|
|
19
|
-
"deepseek-v4-pro": chatCompletionsStream,
|
|
20
|
-
"deepseek-v4-flash": chatCompletionsStream,
|
|
21
|
-
"deepseek-v4-flash-vision-exp": chatCompletionsStream
|
|
22
|
-
}
|
|
10
|
+
const protocols = {
|
|
11
|
+
textGenerate: chatCompletionsGenerateProtocol(config),
|
|
12
|
+
textStream: chatCompletionsStreamProtocol(config)
|
|
23
13
|
};
|
|
14
|
+
return useModelsDev("deepseek", () => protocols);
|
|
24
15
|
} });
|
|
25
16
|
//#endregion
|
|
26
17
|
export { deepseek_default as default };
|
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
setup: (scope: import("revojs").Scope) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"gemini-3.5-flash-lite": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
8
|
-
"gemini-3.1-pro-preview": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
9
|
-
"gemini-2.5-pro": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
10
|
-
"gemini-2.5-flash": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
11
|
-
"gemini-2.5-flash-lite": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
12
|
-
};
|
|
13
|
-
textStream: {
|
|
14
|
-
"gemini-3.7-flash": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
15
|
-
"gemini-3.6-flash": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
16
|
-
"gemini-3.5-flash": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
17
|
-
"gemini-3.5-flash-lite": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
18
|
-
"gemini-3.1-pro-preview": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
19
|
-
"gemini-2.5-pro": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
20
|
-
"gemini-2.5-flash": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
21
|
-
"gemini-2.5-flash-lite": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
2
|
+
setup: (scope: import("revojs").Scope) => Promise<{
|
|
3
|
+
models: () => Promise<import("../index").Description[]>;
|
|
4
|
+
textGenerate: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>>;
|
|
5
|
+
textStream: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>>;
|
|
6
|
+
}>;
|
|
24
7
|
};
|
|
25
8
|
export default _default;
|
package/dist/providers/google.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineProvider } from "../index.js";
|
|
1
|
+
import { defineProvider, useModelsDev } from "../index.js";
|
|
2
2
|
import { chatCompletionsGenerateProtocol, chatCompletionsStreamProtocol } from "../protocols/openai-chat-completions.js";
|
|
3
3
|
import { useVariables } from "revojs";
|
|
4
4
|
//#region src/providers/google.ts
|
|
@@ -7,30 +7,11 @@ var google_default = defineProvider({ setup: (scope) => {
|
|
|
7
7
|
baseURL: "https://generativelanguage.googleapis.com/v1beta/openai",
|
|
8
8
|
apiKey: useVariables(scope).googleApiKey
|
|
9
9
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
textGenerate: {
|
|
14
|
-
"gemini-3.7-flash": chatCompletionsGenerate,
|
|
15
|
-
"gemini-3.6-flash": chatCompletionsGenerate,
|
|
16
|
-
"gemini-3.5-flash": chatCompletionsGenerate,
|
|
17
|
-
"gemini-3.5-flash-lite": chatCompletionsGenerate,
|
|
18
|
-
"gemini-3.1-pro-preview": chatCompletionsGenerate,
|
|
19
|
-
"gemini-2.5-pro": chatCompletionsGenerate,
|
|
20
|
-
"gemini-2.5-flash": chatCompletionsGenerate,
|
|
21
|
-
"gemini-2.5-flash-lite": chatCompletionsGenerate
|
|
22
|
-
},
|
|
23
|
-
textStream: {
|
|
24
|
-
"gemini-3.7-flash": chatCompletionsStream,
|
|
25
|
-
"gemini-3.6-flash": chatCompletionsStream,
|
|
26
|
-
"gemini-3.5-flash": chatCompletionsStream,
|
|
27
|
-
"gemini-3.5-flash-lite": chatCompletionsStream,
|
|
28
|
-
"gemini-3.1-pro-preview": chatCompletionsStream,
|
|
29
|
-
"gemini-2.5-pro": chatCompletionsStream,
|
|
30
|
-
"gemini-2.5-flash": chatCompletionsStream,
|
|
31
|
-
"gemini-2.5-flash-lite": chatCompletionsStream
|
|
32
|
-
}
|
|
10
|
+
const protocols = {
|
|
11
|
+
textGenerate: chatCompletionsGenerateProtocol(config),
|
|
12
|
+
textStream: chatCompletionsStreamProtocol(config)
|
|
33
13
|
};
|
|
14
|
+
return useModelsDev("google", () => protocols);
|
|
34
15
|
} });
|
|
35
16
|
//#endregion
|
|
36
17
|
export { google_default as default };
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
setup: (scope: import("revojs").Scope) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"kimi-k2.6": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
8
|
-
"kimi-k2-thinking": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
9
|
-
"kimi-k2-thinking-turbo": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
10
|
-
};
|
|
11
|
-
textStream: {
|
|
12
|
-
"kimi-k3": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
13
|
-
"kimi-k2.7-code": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
14
|
-
"kimi-k2.7-code-highspeed": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
15
|
-
"kimi-k2.6": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
16
|
-
"kimi-k2-thinking": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
17
|
-
"kimi-k2-thinking-turbo": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
2
|
+
setup: (scope: import("revojs").Scope) => Promise<{
|
|
3
|
+
models: () => Promise<import("../index").Description[]>;
|
|
4
|
+
textGenerate: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>>;
|
|
5
|
+
textStream: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>>;
|
|
6
|
+
}>;
|
|
20
7
|
};
|
|
21
8
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineProvider } from "../index.js";
|
|
1
|
+
import { defineProvider, useModelsDev } from "../index.js";
|
|
2
2
|
import { chatCompletionsGenerateProtocol, chatCompletionsStreamProtocol } from "../protocols/openai-chat-completions.js";
|
|
3
3
|
import { useVariables } from "revojs";
|
|
4
4
|
//#region src/providers/moonshotai.ts
|
|
@@ -7,26 +7,11 @@ var moonshotai_default = defineProvider({ setup: (scope) => {
|
|
|
7
7
|
baseURL: "https://api.moonshot.ai/v1",
|
|
8
8
|
apiKey: useVariables(scope).moonshotaiApiKey
|
|
9
9
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
textGenerate: {
|
|
14
|
-
"kimi-k3": chatCompletionsGenerate,
|
|
15
|
-
"kimi-k2.7-code": chatCompletionsGenerate,
|
|
16
|
-
"kimi-k2.7-code-highspeed": chatCompletionsGenerate,
|
|
17
|
-
"kimi-k2.6": chatCompletionsGenerate,
|
|
18
|
-
"kimi-k2-thinking": chatCompletionsGenerate,
|
|
19
|
-
"kimi-k2-thinking-turbo": chatCompletionsGenerate
|
|
20
|
-
},
|
|
21
|
-
textStream: {
|
|
22
|
-
"kimi-k3": chatCompletionsStream,
|
|
23
|
-
"kimi-k2.7-code": chatCompletionsStream,
|
|
24
|
-
"kimi-k2.7-code-highspeed": chatCompletionsStream,
|
|
25
|
-
"kimi-k2.6": chatCompletionsStream,
|
|
26
|
-
"kimi-k2-thinking": chatCompletionsStream,
|
|
27
|
-
"kimi-k2-thinking-turbo": chatCompletionsStream
|
|
28
|
-
}
|
|
10
|
+
const protocols = {
|
|
11
|
+
textGenerate: chatCompletionsGenerateProtocol(config),
|
|
12
|
+
textStream: chatCompletionsStreamProtocol(config)
|
|
29
13
|
};
|
|
14
|
+
return useModelsDev("moonshotai", () => protocols);
|
|
30
15
|
} });
|
|
31
16
|
//#endregion
|
|
32
17
|
export { moonshotai_default as default };
|
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
setup: (scope: import("revojs").Scope) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"gpt-5.2": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
8
|
-
"gpt-5.1": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
9
|
-
"gpt-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
10
|
-
"gpt-5-mini": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
11
|
-
"gpt-5-nano": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
12
|
-
"gpt-4.1": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
13
|
-
"gpt-4o": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>;
|
|
14
|
-
};
|
|
15
|
-
textStream: {
|
|
16
|
-
"gpt-5.6": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
17
|
-
"gpt-5.5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
18
|
-
"gpt-5.4": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
19
|
-
"gpt-5.2": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
20
|
-
"gpt-5.1": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
21
|
-
"gpt-5": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
22
|
-
"gpt-5-mini": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
23
|
-
"gpt-5-nano": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
24
|
-
"gpt-4.1": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
25
|
-
"gpt-4o": import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
2
|
+
setup: (scope: import("revojs").Scope) => Promise<{
|
|
3
|
+
models: () => Promise<import("../index").Description[]>;
|
|
4
|
+
textGenerate: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelGenerateResult>>;
|
|
5
|
+
textStream: Record<string, import("../index").Protocol<import("../index").LanguageModelCallOptions<string>, import("../index").LanguageModelStreamResult>>;
|
|
6
|
+
}>;
|
|
28
7
|
};
|
|
29
8
|
export default _default;
|
package/dist/providers/openai.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineProvider } from "../index.js";
|
|
2
|
-
import {
|
|
1
|
+
import { defineProvider, useModelsDev } from "../index.js";
|
|
2
|
+
import { responsesGenerateProtocol, responsesStreamProtocol } from "../protocols/openai-responses.js";
|
|
3
3
|
import { useVariables } from "revojs";
|
|
4
4
|
//#region src/providers/openai.ts
|
|
5
5
|
var openai_default = defineProvider({ setup: (scope) => {
|
|
@@ -7,34 +7,11 @@ var openai_default = defineProvider({ setup: (scope) => {
|
|
|
7
7
|
baseURL: "https://api.openai.com/v1",
|
|
8
8
|
apiKey: useVariables(scope).openaiApiKey
|
|
9
9
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
textGenerate: {
|
|
14
|
-
"gpt-5.6": chatCompletionsGenerate,
|
|
15
|
-
"gpt-5.5": chatCompletionsGenerate,
|
|
16
|
-
"gpt-5.4": chatCompletionsGenerate,
|
|
17
|
-
"gpt-5.2": chatCompletionsGenerate,
|
|
18
|
-
"gpt-5.1": chatCompletionsGenerate,
|
|
19
|
-
"gpt-5": chatCompletionsGenerate,
|
|
20
|
-
"gpt-5-mini": chatCompletionsGenerate,
|
|
21
|
-
"gpt-5-nano": chatCompletionsGenerate,
|
|
22
|
-
"gpt-4.1": chatCompletionsGenerate,
|
|
23
|
-
"gpt-4o": chatCompletionsGenerate
|
|
24
|
-
},
|
|
25
|
-
textStream: {
|
|
26
|
-
"gpt-5.6": chatCompletionsStream,
|
|
27
|
-
"gpt-5.5": chatCompletionsStream,
|
|
28
|
-
"gpt-5.4": chatCompletionsStream,
|
|
29
|
-
"gpt-5.2": chatCompletionsStream,
|
|
30
|
-
"gpt-5.1": chatCompletionsStream,
|
|
31
|
-
"gpt-5": chatCompletionsStream,
|
|
32
|
-
"gpt-5-mini": chatCompletionsStream,
|
|
33
|
-
"gpt-5-nano": chatCompletionsStream,
|
|
34
|
-
"gpt-4.1": chatCompletionsStream,
|
|
35
|
-
"gpt-4o": chatCompletionsStream
|
|
36
|
-
}
|
|
10
|
+
const protocols = {
|
|
11
|
+
textGenerate: responsesGenerateProtocol(config),
|
|
12
|
+
textStream: responsesStreamProtocol(config)
|
|
37
13
|
};
|
|
14
|
+
return useModelsDev("openai", () => protocols);
|
|
38
15
|
} });
|
|
39
16
|
//#endregion
|
|
40
17
|
export { openai_default as default };
|