@providerkit/core 0.29.1 → 0.31.0
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 +58 -9
- package/THIRD_PARTY_NOTICES +144 -0
- package/dist/auth/chatgpt-models.js.map +1 -1
- package/dist/auth/oauth.d.ts.map +1 -1
- package/dist/auth/oauth.js.map +1 -1
- package/dist/capability.js.map +1 -1
- package/dist/context.d.ts +4 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +19 -5
- package/dist/context.js.map +1 -1
- package/dist/decisions.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +29 -2
- package/dist/errors.js.map +1 -1
- package/dist/fallback.d.ts +3 -0
- package/dist/fallback.d.ts.map +1 -1
- package/dist/fallback.js +9 -5
- package/dist/fallback.js.map +1 -1
- package/dist/gate.js.map +1 -1
- package/dist/hosted/anthropic.d.ts +30 -0
- package/dist/hosted/anthropic.d.ts.map +1 -0
- package/dist/hosted/anthropic.js +465 -0
- package/dist/hosted/anthropic.js.map +1 -0
- package/dist/hosted/gemini.d.ts +22 -0
- package/dist/hosted/gemini.d.ts.map +1 -0
- package/dist/hosted/gemini.js +440 -0
- package/dist/hosted/gemini.js.map +1 -0
- package/dist/hosted/openai.d.ts +33 -0
- package/dist/hosted/openai.d.ts.map +1 -0
- package/dist/hosted/openai.js +107 -0
- package/dist/hosted/openai.js.map +1 -0
- package/dist/hosted/responses.d.ts +28 -0
- package/dist/hosted/responses.d.ts.map +1 -0
- package/dist/hosted/responses.js +358 -0
- package/dist/hosted/responses.js.map +1 -0
- package/dist/hosted/shared.d.ts +107 -0
- package/dist/hosted/shared.d.ts.map +1 -0
- package/dist/hosted/shared.js +264 -0
- package/dist/hosted/shared.js.map +1 -0
- package/dist/hosted/types.d.ts +191 -0
- package/dist/hosted/types.d.ts.map +1 -0
- package/dist/hosted/types.js +10 -0
- package/dist/hosted/types.js.map +1 -0
- package/dist/hosted.d.ts +33 -0
- package/dist/hosted.d.ts.map +1 -0
- package/dist/hosted.js +61 -0
- package/dist/hosted.js.map +1 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/key-pool.d.ts.map +1 -1
- package/dist/key-pool.js.map +1 -1
- package/dist/presets.d.ts +36 -5
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +32 -8
- package/dist/presets.js.map +1 -1
- package/dist/providers/anthropic.d.ts +75 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +207 -135
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/deepgram-transcription.d.ts +24 -0
- package/dist/providers/deepgram-transcription.d.ts.map +1 -0
- package/dist/providers/deepgram-transcription.js +84 -0
- package/dist/providers/deepgram-transcription.js.map +1 -0
- package/dist/providers/factory.d.ts +10 -0
- package/dist/providers/factory.d.ts.map +1 -1
- package/dist/providers/factory.js +31 -23
- package/dist/providers/factory.js.map +1 -1
- package/dist/providers/gemini.d.ts +123 -1
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +114 -54
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/hosted-codecs.d.ts +10 -0
- package/dist/providers/hosted-codecs.d.ts.map +1 -0
- package/dist/providers/hosted-codecs.js +8 -0
- package/dist/providers/hosted-codecs.js.map +1 -0
- package/dist/providers/openai-transcription.d.ts +21 -0
- package/dist/providers/openai-transcription.d.ts.map +1 -0
- package/dist/providers/openai-transcription.js +144 -0
- package/dist/providers/openai-transcription.js.map +1 -0
- package/dist/providers/openai.d.ts +69 -0
- package/dist/providers/openai.d.ts.map +1 -1
- package/dist/providers/openai.js +38 -14
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/responses.d.ts +123 -0
- package/dist/providers/responses.d.ts.map +1 -1
- package/dist/providers/responses.js +57 -22
- package/dist/providers/responses.js.map +1 -1
- package/dist/providers/speech-factory.js.map +1 -1
- package/dist/providers/transcription-factory.d.ts +30 -0
- package/dist/providers/transcription-factory.d.ts.map +1 -0
- package/dist/providers/transcription-factory.js +38 -0
- package/dist/providers/transcription-factory.js.map +1 -0
- package/dist/registry.d.ts +3 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +8 -4
- package/dist/registry.js.map +1 -1
- package/dist/retry.js.map +1 -1
- package/dist/speech-core.d.ts +2 -17
- package/dist/speech-core.d.ts.map +1 -1
- package/dist/speech-core.js +10 -50
- package/dist/speech-core.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js.map +1 -1
- package/dist/transcription-core.d.ts +146 -0
- package/dist/transcription-core.d.ts.map +1 -0
- package/dist/transcription-core.js +193 -0
- package/dist/transcription-core.js.map +1 -0
- package/dist/transcription.d.ts +7 -0
- package/dist/transcription.d.ts.map +1 -0
- package/dist/transcription.js +12 -0
- package/dist/transcription.js.map +1 -0
- package/dist/transport.d.ts +26 -0
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +57 -2
- package/dist/transport.js.map +1 -1
- package/dist/turn.d.ts +10 -1
- package/dist/turn.d.ts.map +1 -1
- package/dist/turn.js +53 -1
- package/dist/turn.js.map +1 -1
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/usage.d.ts +10 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +40 -2
- package/dist/usage.js.map +1 -1
- package/dist/watchdog.d.ts +6 -0
- package/dist/watchdog.d.ts.map +1 -1
- package/dist/watchdog.js +10 -2
- package/dist/watchdog.js.map +1 -1
- package/package.json +14 -5
- package/src/context.ts +21 -5
- package/src/errors.ts +35 -2
- package/src/fallback.ts +21 -6
- package/src/hosted/anthropic.ts +512 -0
- package/src/hosted/gemini.ts +510 -0
- package/src/hosted/openai.ts +137 -0
- package/src/hosted/responses.ts +420 -0
- package/src/hosted/shared.ts +341 -0
- package/src/hosted/types.ts +214 -0
- package/src/hosted.ts +101 -0
- package/src/index.ts +64 -7
- package/src/presets.ts +54 -8
- package/src/providers/anthropic.ts +252 -143
- package/src/providers/deepgram-transcription.ts +109 -0
- package/src/providers/factory.ts +127 -82
- package/src/providers/gemini.ts +184 -60
- package/src/providers/hosted-codecs.ts +29 -0
- package/src/providers/openai-transcription.ts +177 -0
- package/src/providers/openai.ts +52 -15
- package/src/providers/responses.ts +93 -24
- package/src/providers/transcription-factory.ts +68 -0
- package/src/registry.ts +14 -4
- package/src/speech-core.ts +9 -47
- package/src/transcription-core.ts +345 -0
- package/src/transcription.ts +24 -0
- package/src/transport.ts +77 -3
- package/src/turn.ts +55 -1
- package/src/types.ts +62 -1
- package/src/usage.ts +32 -2
- package/src/watchdog.ts +12 -2
package/src/index.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
export * from "./types.ts";
|
|
2
|
+
export * from "./hosted/types.ts";
|
|
2
3
|
export * from "./turn.ts";
|
|
3
4
|
export * from "./errors.ts";
|
|
4
5
|
export * from "./retry.ts";
|
|
5
|
-
export
|
|
6
|
+
export {
|
|
7
|
+
DEFAULT_FALLBACK_COOLDOWNS,
|
|
8
|
+
FallbackPool,
|
|
9
|
+
NoAvailableProviderError,
|
|
10
|
+
withConfiguredFallbacks,
|
|
11
|
+
withFallbackProviders,
|
|
12
|
+
type FallbackOptions,
|
|
13
|
+
type FallbackSpec,
|
|
14
|
+
type FallbackCandidate,
|
|
15
|
+
type ProviderFallbackConfig,
|
|
16
|
+
type Cooldown,
|
|
17
|
+
type CooldownStore,
|
|
18
|
+
type FallbackProvider,
|
|
19
|
+
} from "./fallback.ts";
|
|
6
20
|
export * from "./key-pool.ts";
|
|
7
21
|
export * from "./watchdog.ts";
|
|
8
22
|
export * from "./gate.ts";
|
|
@@ -31,10 +45,53 @@ export * from "./image.ts";
|
|
|
31
45
|
export * from "./capability.ts";
|
|
32
46
|
export * from "./attribution.ts";
|
|
33
47
|
export * from "./presets.ts";
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
export {
|
|
49
|
+
createAnthropicProvider,
|
|
50
|
+
toAnthropicMessages,
|
|
51
|
+
type AnthropicConfig,
|
|
52
|
+
} from "./providers/anthropic.ts";
|
|
53
|
+
export {
|
|
54
|
+
createOpenAIProvider,
|
|
55
|
+
toOpenAIMessages,
|
|
56
|
+
effortParams,
|
|
57
|
+
openRouterCostUsd,
|
|
58
|
+
openRouterHostFor,
|
|
59
|
+
type OpenAIConfig,
|
|
60
|
+
type EffortDialect,
|
|
61
|
+
} from "./providers/openai.ts";
|
|
62
|
+
export {
|
|
63
|
+
createResponsesProvider,
|
|
64
|
+
toResponsesInput,
|
|
65
|
+
type ResponsesConfig,
|
|
66
|
+
} from "./providers/responses.ts";
|
|
67
|
+
export {
|
|
68
|
+
createGeminiProvider,
|
|
69
|
+
toGeminiContents,
|
|
70
|
+
antigravityUserAgent,
|
|
71
|
+
antigravitySessionId,
|
|
72
|
+
resolveAntigravityWireModel,
|
|
73
|
+
type GeminiConfig,
|
|
74
|
+
type GeminiContent,
|
|
75
|
+
} from "./providers/gemini.ts";
|
|
38
76
|
export * from "./providers/zai.ts";
|
|
39
|
-
export
|
|
40
|
-
|
|
77
|
+
export {
|
|
78
|
+
createPresetProvider,
|
|
79
|
+
presetAdapter,
|
|
80
|
+
OPENCODE_CLI_USER_AGENT,
|
|
81
|
+
OPENCODE_PUBLIC_API_KEY,
|
|
82
|
+
isZenFreeModel,
|
|
83
|
+
forgeOpenCodeSessionId,
|
|
84
|
+
type PresetProviderConfig,
|
|
85
|
+
type PresetAdapterConfig,
|
|
86
|
+
} from "./providers/factory.ts";
|
|
87
|
+
export {
|
|
88
|
+
createRegistry,
|
|
89
|
+
type ConnectionCredential,
|
|
90
|
+
type ConnectionConfig,
|
|
91
|
+
type RegistryCooldownInfo,
|
|
92
|
+
type RegistryOptions,
|
|
93
|
+
type ViewOptions,
|
|
94
|
+
type CandidateStatus,
|
|
95
|
+
type ConnectionStatus,
|
|
96
|
+
type Registry,
|
|
97
|
+
} from "./registry.ts";
|
package/src/presets.ts
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type { ImageLimits } from "./image.ts";
|
|
22
22
|
import type { SpeechFormat, SpeechShape } from "./speech-core.ts";
|
|
23
|
+
import type { TranscriptionShape } from "./transcription-core.ts";
|
|
23
24
|
|
|
24
25
|
export type PresetShape = "anthropic" | "openai" | "responses" | "gemini";
|
|
25
26
|
|
|
@@ -79,6 +80,22 @@ export interface PresetSpeech {
|
|
|
79
80
|
defaultFormat?: SpeechFormat;
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
* What a preset's endpoint can do besides chat: turn a recording into text. Absent means it
|
|
85
|
+
* cannot, or that nobody has read its documentation yet. `createTranscriptionProvider` (from
|
|
86
|
+
* `@providerkit/core/transcription`) is what reads this. Like `PresetSpeech`, these are facts
|
|
87
|
+
* about the vendor's own host, and none of them follow a caller who sets `baseUrl`.
|
|
88
|
+
*/
|
|
89
|
+
export interface PresetTranscription {
|
|
90
|
+
shape: TranscriptionShape;
|
|
91
|
+
/** Defaults to the preset's own `baseUrl`. */
|
|
92
|
+
baseUrl?: string;
|
|
93
|
+
/** The model the vendor recommends, when it names one. */
|
|
94
|
+
defaultModel?: string;
|
|
95
|
+
/** Representative model ids, as in `ProviderPreset.models`. */
|
|
96
|
+
models?: readonly string[];
|
|
97
|
+
}
|
|
98
|
+
|
|
82
99
|
export interface ProviderPreset {
|
|
83
100
|
/** Adapter wire format. */
|
|
84
101
|
shape: PresetShape;
|
|
@@ -136,6 +153,8 @@ export interface ProviderPreset {
|
|
|
136
153
|
noSampling?: boolean;
|
|
137
154
|
/** Text to speech on this endpoint. See `PresetSpeech`. */
|
|
138
155
|
speech?: PresetSpeech;
|
|
156
|
+
/** Speech to text on this endpoint. See `PresetTranscription`. */
|
|
157
|
+
transcription?: PresetTranscription;
|
|
139
158
|
}
|
|
140
159
|
|
|
141
160
|
export const PROVIDER_PRESETS = {
|
|
@@ -181,6 +200,21 @@ export const PROVIDER_PRESETS = {
|
|
|
181
200
|
],
|
|
182
201
|
maxInputChars: 4096,
|
|
183
202
|
},
|
|
203
|
+
// Source: OpenAI's speech-to-text guide and transcription reference, read 2026-11-11. The
|
|
204
|
+
// guide recommends `gpt-transcribe`, and says the other four shut down on 2027-02-26. Only
|
|
205
|
+
// `gpt-4o-transcribe-diarize` labels speakers, and only Whisper gives timed segments without
|
|
206
|
+
// them. Remove the four ids after that date.
|
|
207
|
+
transcription: {
|
|
208
|
+
shape: "openai",
|
|
209
|
+
defaultModel: "gpt-transcribe",
|
|
210
|
+
models: [
|
|
211
|
+
"gpt-transcribe",
|
|
212
|
+
"gpt-4o-transcribe",
|
|
213
|
+
"gpt-4o-mini-transcribe",
|
|
214
|
+
"gpt-4o-transcribe-diarize",
|
|
215
|
+
"whisper-1",
|
|
216
|
+
],
|
|
217
|
+
},
|
|
184
218
|
},
|
|
185
219
|
google: {
|
|
186
220
|
// Native Generative Language REST — the adapter authenticates with
|
|
@@ -477,8 +511,14 @@ export const PROVIDER_PRESETS = {
|
|
|
477
511
|
*
|
|
478
512
|
* Measured 2026-09-27 on /chat/completions: a call without
|
|
479
513
|
* `x-opencode-session` is refused. `mimo-v2.6-flash` passes plain text,
|
|
480
|
-
* `reasoning_effort: "none"
|
|
481
|
-
*
|
|
514
|
+
* `reasoning_effort: "none"` and tool calls; `glm-5.3-flash` 400s on a tool
|
|
515
|
+
* without a description and on a `thinking` field.
|
|
516
|
+
*
|
|
517
|
+
* Measured 2026-11-11 with a live key: `mimo-v2.5` is retired (every call
|
|
518
|
+
* answers 410 `ModelDeprecated`), and `mimo-v2.6-flash` ignores a strict
|
|
519
|
+
* json_schema `response_format` and answers with the schema itself, on Go and
|
|
520
|
+
* on OpenRouter. `glm-5.3-flash`, `qwen3.8-flash` and `longcat-2.0` fill the
|
|
521
|
+
* schema in, with an image input too.
|
|
482
522
|
*
|
|
483
523
|
* Go serves three wires, and `routes` picks one from the model id (cc-proxy's
|
|
484
524
|
* table, from Go's own docs): `minimax-` and `qwen` on Anthropic /messages
|
|
@@ -505,7 +545,6 @@ export const PROVIDER_PRESETS = {
|
|
|
505
545
|
defaultModel: "mimo-v2.6-flash",
|
|
506
546
|
models: [
|
|
507
547
|
"mimo-v2.6-flash",
|
|
508
|
-
"mimo-v2.5",
|
|
509
548
|
"glm-5.3-flash",
|
|
510
549
|
"qwen3.8-flash",
|
|
511
550
|
"longcat-2.0",
|
|
@@ -535,11 +574,13 @@ export const PROVIDER_PRESETS = {
|
|
|
535
574
|
},
|
|
536
575
|
],
|
|
537
576
|
// Cheapest first, each with its own monthly limit ($60, qwen3.8-flash $30).
|
|
538
|
-
// All
|
|
539
|
-
// 2026-09-27; longcat-2.0 ignores reasoning "none", so it goes last.
|
|
540
|
-
//
|
|
541
|
-
//
|
|
542
|
-
|
|
577
|
+
// All four passed plain text, a described tool call and json_schema on
|
|
578
|
+
// 2026-09-27; longcat-2.0 ignores reasoning "none", so it goes last. On
|
|
579
|
+
// 2026-11-11 mimo-v2.6-flash no longer filled a strict json_schema (see
|
|
580
|
+
// above), so a caller that needs one names its own `models`. DeepSeek is
|
|
581
|
+
// left out: on Go it needs the workspace's Global regions privacy setting,
|
|
582
|
+
// and answers 500 without it.
|
|
583
|
+
rotation: ["mimo-v2.6-flash", "glm-5.3-flash", "qwen3.8-flash", "longcat-2.0"],
|
|
543
584
|
},
|
|
544
585
|
/**
|
|
545
586
|
* OpenCode Zen: free and pay-as-you-go models on `https://opencode.ai/zen/v1`,
|
|
@@ -836,3 +877,8 @@ export const PRESET_IDS = Object.keys(PROVIDER_PRESETS) as ProviderPresetId[];
|
|
|
836
877
|
|
|
837
878
|
/** The presets that can speak, for a screen that offers exactly those. */
|
|
838
879
|
export const SPEECH_PRESET_IDS = PRESET_IDS.filter((id) => "speech" in PROVIDER_PRESETS[id]);
|
|
880
|
+
|
|
881
|
+
/** The presets that can transcribe, for a screen that offers exactly those. */
|
|
882
|
+
export const TRANSCRIPTION_PRESET_IDS = PRESET_IDS.filter(
|
|
883
|
+
(id) => "transcription" in PROVIDER_PRESETS[id],
|
|
884
|
+
);
|