@opencode/ai 0.0.0-dev-794 → 0.0.0-dev-821
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/protocols/alibaba-chat.d.ts +5 -1
- package/dist/protocols/alibaba-chat.js +1 -1
- package/dist/protocols/anthropic-messages.js +6 -4
- package/dist/protocols/openai-chat.js +4 -4
- package/dist/protocols/openai-compatible-responses.js +1 -1
- package/dist/protocols/openai-responses.js +2 -2
- package/dist/protocols/shared.js +1 -1
- package/dist/protocols/venice-chat.d.ts +3 -1
- package/dist/protocols/venice-chat.js +2 -2
- package/dist/protocols/zai-chat.d.ts +5 -1
- package/dist/protocols/zai-chat.js +1 -1
- package/dist/providers/alibaba.d.ts +3 -3
- package/dist/providers/alibaba.js +3 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +3 -3
- package/dist/providers/amazon-bedrock-mantle.js +2 -2
- package/dist/providers/amazon-bedrock.d.ts +6 -7
- package/dist/providers/anthropic-compatible.d.ts +5 -6
- package/dist/providers/anthropic.d.ts +6 -7
- package/dist/providers/azure.d.ts +3 -3
- package/dist/providers/azure.js +2 -2
- package/dist/providers/baseten.d.ts +3 -3
- package/dist/providers/cerebras.d.ts +3 -3
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts +12 -13
- package/dist/providers/cloudflare-workers-ai.d.ts +3 -3
- package/dist/providers/cohere.d.ts +3 -3
- package/dist/providers/cohere.js +1 -1
- package/dist/providers/deepinfra.d.ts +3 -3
- package/dist/providers/deepinfra.js +1 -1
- package/dist/providers/deepseek.d.ts +3 -3
- package/dist/providers/digitalocean.d.ts +3 -3
- package/dist/providers/digitalocean.js +2 -4
- package/dist/providers/fireworks.d.ts +3 -3
- package/dist/providers/fireworks.js +1 -1
- package/dist/providers/google-vertex-chat.d.ts +3 -3
- package/dist/providers/google-vertex-interactions.d.ts +3 -3
- package/dist/providers/google-vertex-messages.d.ts +3 -3
- package/dist/providers/google-vertex-mistral.d.ts +3 -3
- package/dist/providers/google-vertex-responses.d.ts +3 -3
- package/dist/providers/google-vertex-responses.js +1 -1
- package/dist/providers/google-vertex-shared.d.ts +3 -2
- package/dist/providers/google-vertex.d.ts +3 -3
- package/dist/providers/google.d.ts +13 -14
- package/dist/providers/groq.d.ts +3 -3
- package/dist/providers/groq.js +1 -1
- package/dist/providers/meta.d.ts +3 -3
- package/dist/providers/meta.js +4 -3
- package/dist/providers/minimax.d.ts +3 -3
- package/dist/providers/minimax.js +2 -2
- package/dist/providers/mistral.d.ts +8 -9
- package/dist/providers/moonshot.d.ts +3 -3
- package/dist/providers/moonshot.js +1 -2
- package/dist/providers/openai-compatible-responses.d.ts +5 -6
- package/dist/providers/openai-compatible.d.ts +5 -6
- package/dist/providers/openai-compatible.js +1 -1
- package/dist/providers/openai.d.ts +3 -3
- package/dist/providers/openai.js +2 -2
- package/dist/providers/openrouter.d.ts +3 -3
- package/dist/providers/openrouter.js +3 -3
- package/dist/providers/settings.d.ts +1 -1
- package/dist/providers/togetherai.d.ts +3 -3
- package/dist/providers/togetherai.js +2 -1
- package/dist/providers/venice.d.ts +3 -3
- package/dist/providers/venice.js +6 -2
- package/dist/providers/vercel-ai-gateway.d.ts +3 -3
- package/dist/providers/vercel-ai-gateway.js +3 -3
- package/dist/providers/xai.d.ts +3 -3
- package/dist/providers/xai.js +1 -1
- package/dist/providers/zai-coding-plan.d.ts +3 -3
- package/dist/providers/zai-coding-plan.js +5 -1
- package/dist/providers/zai.d.ts +3 -3
- package/dist/providers/zai.js +5 -1
- package/dist/public.d.ts +1 -1
- package/dist/route/client.d.ts +8 -9
- package/dist/route/client.js +10 -18
- package/dist/route/index.d.ts +1 -1
- package/dist/schema/options.d.ts +70 -11
- package/dist/schema/options.js +18 -14
- package/package.json +3 -3
|
@@ -29,10 +29,14 @@ declare const Options: Schema.Struct<{
|
|
|
29
29
|
export type OptionsInput = typeof Options.Type;
|
|
30
30
|
export declare const compatibility: {
|
|
31
31
|
maxTokensField: "max_completion_tokens";
|
|
32
|
-
supportsStrictMode: false;
|
|
33
32
|
reasoningField: string;
|
|
34
33
|
zaiToolStream: false;
|
|
35
34
|
};
|
|
35
|
+
export declare const capabilities: {
|
|
36
|
+
tools: {
|
|
37
|
+
strict: false;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
36
40
|
export declare const protocol: Protocol<{
|
|
37
41
|
readonly model: string;
|
|
38
42
|
readonly messages: readonly ({
|
|
@@ -29,10 +29,10 @@ const Options = Schema.Struct({
|
|
|
29
29
|
});
|
|
30
30
|
export const compatibility = {
|
|
31
31
|
maxTokensField: "max_completion_tokens",
|
|
32
|
-
supportsStrictMode: false,
|
|
33
32
|
reasoningField: "reasoning_content",
|
|
34
33
|
zaiToolStream: false,
|
|
35
34
|
};
|
|
35
|
+
export const capabilities = { tools: { strict: false } };
|
|
36
36
|
export const protocol = Protocol.make({
|
|
37
37
|
id: "alibaba-chat",
|
|
38
38
|
body: {
|
|
@@ -595,6 +595,9 @@ const requireThinkingSignature = (request) => {
|
|
|
595
595
|
};
|
|
596
596
|
// Opus 4.8 and every Claude 5 model accept mid-conversation system messages; later versions inherit support.
|
|
597
597
|
const supportsNativeSystemUpdates = (request) => {
|
|
598
|
+
const override = request.model.capabilities?.systemUpdates;
|
|
599
|
+
if (override !== undefined)
|
|
600
|
+
return override;
|
|
598
601
|
const version = claudeVersion(request.model.id);
|
|
599
602
|
if (version === undefined)
|
|
600
603
|
return false;
|
|
@@ -756,15 +759,14 @@ const lowerMessages = Effect.fnUntraced(function* (request, breakpoints) {
|
|
|
756
759
|
yield* releaseHeld();
|
|
757
760
|
return messages;
|
|
758
761
|
});
|
|
759
|
-
//
|
|
760
|
-
// `
|
|
761
|
-
// only reads `request.model.compatibility`.
|
|
762
|
+
// The model-ID checks below are fallbacks for models that leave `capabilities.reasoning.updates`,
|
|
763
|
+
// `capabilities.systemUpdates` and `compatibility.supportsThinkingBlockBinding` unset.
|
|
762
764
|
const isThinkingOff = Schema.is(AnthropicThinkingDisabled);
|
|
763
765
|
// Per-turn effort started with Claude Opus 5 and every Claude 5.1 model; later versions of any family inherit it.
|
|
764
766
|
const supportsEffortUpdates = (request) => {
|
|
765
767
|
if (isThinkingOff(request.providerOptions?.thinking))
|
|
766
768
|
return false;
|
|
767
|
-
const override = request.model.
|
|
769
|
+
const override = request.model.capabilities?.reasoning?.updates;
|
|
768
770
|
if (override !== undefined)
|
|
769
771
|
return override;
|
|
770
772
|
const version = claudeVersion(request.model.id);
|
|
@@ -646,7 +646,7 @@ const lowerOptions = (request, supportsStore, hasActiveTools) => {
|
|
|
646
646
|
// Default off: strict providers 400 on unknown body fields, so only send
|
|
647
647
|
// the key where compatibility explicitly allows it. Header-based affinity
|
|
648
648
|
// (x-session-affinity, x-grok-conv-id, ...) is unaffected.
|
|
649
|
-
const cacheKey = (request.model.
|
|
649
|
+
const cacheKey = (request.model.capabilities?.promptCacheKey ?? false) ? ProviderShared.promptCacheKey(request) : undefined;
|
|
650
650
|
return {
|
|
651
651
|
...(supportsStore ? { store: options.store ?? false } : {}),
|
|
652
652
|
...(cacheKey ? { prompt_cache_key: cacheKey } : {}),
|
|
@@ -671,8 +671,8 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (reques
|
|
|
671
671
|
const baseURL = request.model.route.endpoint.baseURL;
|
|
672
672
|
const detectedMaxTokensField = detectMaxTokensField(provider, baseURL);
|
|
673
673
|
const maxTokensField = request.model.compatibility?.maxTokensField ?? detectedMaxTokensField;
|
|
674
|
-
const supportsStore = request.model.
|
|
675
|
-
const supportsStrictMode = request.model.
|
|
674
|
+
const supportsStore = request.model.capabilities?.store ?? detectSupportsStore(provider, baseURL);
|
|
675
|
+
const supportsStrictMode = request.model.capabilities?.tools?.strict ?? detectSupportsStrictMode(provider, baseURL);
|
|
676
676
|
const zaiToolStream = request.model.compatibility?.zaiToolStream ?? detectZaiToolStream(provider, baseURL, request.model.id);
|
|
677
677
|
const hasHistory = hasToolHistory(request.messages);
|
|
678
678
|
const hasActiveTools = flattened.tools.length > 0;
|
|
@@ -688,7 +688,7 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (reques
|
|
|
688
688
|
: flattened.tools.map((tool) => lowerTool(tool, lowering, supportsStrictMode, custom.get(tool.name))),
|
|
689
689
|
tool_choice: hasActiveTools && request.toolChoice ? yield* lowerToolChoice(request.toolChoice, custom) : undefined,
|
|
690
690
|
stream: true,
|
|
691
|
-
...((request.model.
|
|
691
|
+
...((request.model.capabilities?.streamUsage ?? true) ? { stream_options: { include_usage: true } } : {}),
|
|
692
692
|
...(zaiToolStream && hasActiveTools ? { tool_stream: true } : {}),
|
|
693
693
|
...(maxTokensField === "max_completion_tokens"
|
|
694
694
|
? { max_completion_tokens: request.maxTokens }
|
|
@@ -13,6 +13,6 @@ export const route = Route.make({
|
|
|
13
13
|
protocol: OpenResponses.protocol,
|
|
14
14
|
endpoint: Endpoint.path(OpenResponses.PATH),
|
|
15
15
|
transport: OpenResponses.httpTransport,
|
|
16
|
-
|
|
16
|
+
options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
|
|
17
17
|
});
|
|
18
18
|
export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
|
|
@@ -132,7 +132,7 @@ const supportsEffortUpdates = (request) => {
|
|
|
132
132
|
return false;
|
|
133
133
|
if (Schema.is(Schema.Struct({ mode: Schema.Literal("pro") }))(request.http?.body?.reasoning))
|
|
134
134
|
return false;
|
|
135
|
-
const override = request.model.
|
|
135
|
+
const override = request.model.capabilities?.reasoning?.updates;
|
|
136
136
|
if (override !== undefined)
|
|
137
137
|
return override;
|
|
138
138
|
const match = /(?:^|\/)gpt-(\d+)(?:\.\d+)?(?:-|$)/i.exec(request.model.id);
|
|
@@ -291,6 +291,6 @@ export const route = Route.make({
|
|
|
291
291
|
endpoint,
|
|
292
292
|
auth,
|
|
293
293
|
transport,
|
|
294
|
-
|
|
294
|
+
options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
|
|
295
295
|
});
|
|
296
296
|
export * as OpenAIResponses from "./openai-responses.js";
|
package/dist/protocols/shared.js
CHANGED
|
@@ -46,7 +46,7 @@ export const knownString = () => Schema.declare((value) => typeof value === "str
|
|
|
46
46
|
export const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
47
47
|
// Body-level `prompt_cache_key` is off when caching is disabled or the model
|
|
48
48
|
// explicitly rejects the field. Header-based affinity is unaffected.
|
|
49
|
-
export const sendsPromptCacheKey = (request) => request.cache !== "none" && request.model.
|
|
49
|
+
export const sendsPromptCacheKey = (request) => request.cache !== "none" && request.model.capabilities?.promptCacheKey !== false;
|
|
50
50
|
// OpenAI limits `prompt_cache_key` to 64 chars; DeepSeek and Zai inherit the same
|
|
51
51
|
// limit via their OpenAI-compatible APIs. Clamp with unicode-aware slicing.
|
|
52
52
|
export const promptCacheKey = (request) => {
|
|
@@ -48,7 +48,9 @@ interface State {
|
|
|
48
48
|
}
|
|
49
49
|
export declare const compatibility: {
|
|
50
50
|
maxTokensField: "max_completion_tokens";
|
|
51
|
-
|
|
51
|
+
};
|
|
52
|
+
export declare const capabilities: {
|
|
53
|
+
promptCacheKey: true;
|
|
52
54
|
};
|
|
53
55
|
export declare const protocol: Protocol<{
|
|
54
56
|
readonly model: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
2
|
import { Protocol } from "../route/protocol.js";
|
|
3
|
-
import { AIError, LLMEvent } from "../schema/index.js";
|
|
3
|
+
import { AIError, LLMEvent, } from "../schema/index.js";
|
|
4
4
|
import { classifyProviderFailure } from "../provider-error.js";
|
|
5
5
|
import { OpenAIChat } from "./openai-chat.js";
|
|
6
6
|
import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js";
|
|
@@ -261,8 +261,8 @@ const onHalt = Effect.fn("VeniceChat.onHalt")(function* (state) {
|
|
|
261
261
|
});
|
|
262
262
|
export const compatibility = {
|
|
263
263
|
maxTokensField: "max_completion_tokens",
|
|
264
|
-
supportsPromptCacheKey: true,
|
|
265
264
|
};
|
|
265
|
+
export const capabilities = { promptCacheKey: true };
|
|
266
266
|
export const protocol = Protocol.make({
|
|
267
267
|
id: "venice-chat",
|
|
268
268
|
body: { schema: Body, from: fromRequest },
|
|
@@ -21,10 +21,14 @@ declare const Options: Schema.Struct<{
|
|
|
21
21
|
export type OptionsInput = typeof Options.Type;
|
|
22
22
|
export declare const compatibility: {
|
|
23
23
|
maxTokensField: "max_tokens";
|
|
24
|
-
supportsStrictMode: false;
|
|
25
24
|
reasoningField: string;
|
|
26
25
|
zaiToolStream: false;
|
|
27
26
|
};
|
|
27
|
+
export declare const capabilities: {
|
|
28
|
+
tools: {
|
|
29
|
+
strict: false;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
28
32
|
export declare const protocol: Protocol<{
|
|
29
33
|
readonly model: string;
|
|
30
34
|
readonly messages: readonly ({
|
|
@@ -44,10 +44,10 @@ const fromRequest = Effect.fn("ZAIChat.fromRequest")(function* (request) {
|
|
|
44
44
|
});
|
|
45
45
|
export const compatibility = {
|
|
46
46
|
maxTokensField: "max_tokens",
|
|
47
|
-
supportsStrictMode: false,
|
|
48
47
|
reasoningField: "reasoning_content",
|
|
49
48
|
zaiToolStream: false,
|
|
50
49
|
};
|
|
50
|
+
export const capabilities = { tools: { strict: false } };
|
|
51
51
|
export const protocol = Protocol.make({
|
|
52
52
|
id: "zai-chat",
|
|
53
53
|
body: { schema: Body, from: fromRequest },
|
|
@@ -3,8 +3,8 @@ import { AlibabaChat } from "../protocols/alibaba-chat.js";
|
|
|
3
3
|
import { AlibabaMessages } from "../protocols/alibaba-messages.js";
|
|
4
4
|
import { AlibabaResponses } from "../protocols/alibaba-responses.js";
|
|
5
5
|
import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js";
|
|
6
|
-
import { Route
|
|
7
|
-
import { ToolDefinition, type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
6
|
+
import { Route } from "../route/client.js";
|
|
7
|
+
import { ToolDefinition, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
8
8
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
9
9
|
export type Region = "ap-southeast-1" | "cn-beijing" | "cn-hongkong" | "us-east-1" | "eu-central-1" | "ap-northeast-1" | (string & {});
|
|
10
10
|
export type ChatOptionsInput = AlibabaChat.OptionsInput;
|
|
@@ -18,7 +18,7 @@ type Location = AtLeastOne<{
|
|
|
18
18
|
}> & {
|
|
19
19
|
readonly workspaceID?: string;
|
|
20
20
|
};
|
|
21
|
-
export type Config = Location & Omit<
|
|
21
|
+
export type Config = Location & Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
22
22
|
readonly providerOptions?: ChatOptionsInput | MessagesOptionsInput | ResponsesOptionsInput;
|
|
23
23
|
};
|
|
24
24
|
export type Settings<Options = ChatOptionsInput> = Location & ProviderPackage.Settings & Options & {
|
|
@@ -60,7 +60,9 @@ export const configure = (input) => {
|
|
|
60
60
|
}
|
|
61
61
|
const opts = { ...rest, auth: AuthOptions.bearer(input, ["DASHSCOPE_API_KEY", "ALIBABA_API_KEY"]) };
|
|
62
62
|
const common = { ...opts, endpoint: { baseURL: baseURL ?? `https://${host}/compatible-mode/v1` } };
|
|
63
|
-
const chat = (id) => chatRoute
|
|
63
|
+
const chat = (id) => chatRoute
|
|
64
|
+
.with(common)
|
|
65
|
+
.model({ id, compatibility: AlibabaChat.compatibility, capabilities: AlibabaChat.capabilities });
|
|
64
66
|
const messages = (id) => messagesRoute
|
|
65
67
|
.with({
|
|
66
68
|
...opts,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Route
|
|
1
|
+
import { Route } from "../route/client.js";
|
|
2
2
|
import type { ProviderPackage } from "../provider-package.js";
|
|
3
3
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
4
4
|
import { type Credentials } from "../protocols/utils/bedrock-auth.js";
|
|
5
|
-
import { type ModelID } from "../schema/index.js";
|
|
5
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
6
6
|
import { type OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
7
7
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
8
8
|
export type OpenAIOptionsInput = OpenAIProviderOptionsInput;
|
|
9
9
|
export type MessagesOptionsInput = AnthropicMessages.ProviderOptionsInput;
|
|
10
|
-
export type Config = Omit<
|
|
10
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & {
|
|
11
11
|
/** Bedrock API key. Falls back to `AWS_BEARER_TOKEN_BEDROCK`; bearer auth takes precedence over SigV4. */
|
|
12
12
|
readonly apiKey?: string;
|
|
13
13
|
/** `sigv4` ignores `apiKey` fallbacks from the environment; `bearer` requires a token. */
|
|
@@ -15,7 +15,7 @@ const responsesRoute = Route.make({
|
|
|
15
15
|
protocol: OpenResponses.protocol,
|
|
16
16
|
endpoint: Endpoint.path(OpenResponses.PATH),
|
|
17
17
|
transport: OpenResponses.httpTransport,
|
|
18
|
-
|
|
18
|
+
options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
|
|
19
19
|
});
|
|
20
20
|
const chatRoute = OpenAIChat.route.with({
|
|
21
21
|
id: "bedrock-mantle-chat",
|
|
@@ -32,7 +32,7 @@ const messagesRoute = Route.make({
|
|
|
32
32
|
supportsEffortUpdates: (request) => {
|
|
33
33
|
if (!(AnthropicMessages.protocol.supportsEffortUpdates?.(request) ?? false))
|
|
34
34
|
return false;
|
|
35
|
-
if (request.model.
|
|
35
|
+
if (request.model.capabilities?.reasoning?.updates !== undefined)
|
|
36
36
|
return true;
|
|
37
37
|
const version = claudeVersion(request.model.id);
|
|
38
38
|
return version !== undefined && (version.major > 5 || (version.major === 5 && version.minor >= 1));
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { RouteDefaultsInput } from "../route/client.js";
|
|
2
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
3
|
-
import { type ModelID } from "../schema/index.js";
|
|
2
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
4
3
|
import * as BedrockConverse from "../protocols/bedrock-converse.js";
|
|
5
4
|
import type { BedrockCredentials } from "../protocols/bedrock-converse.js";
|
|
6
5
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config =
|
|
6
|
+
export type Config = RequestOptions & {
|
|
8
7
|
/** Bedrock API key. Falls back to `AWS_BEARER_TOKEN_BEDROCK`; bearer auth takes precedence over SigV4. */
|
|
9
8
|
readonly apiKey?: string;
|
|
10
9
|
/** `sigv4` ignores `apiKey` fallbacks from the environment; `bearer` requires a token. */
|
|
@@ -29,7 +28,7 @@ export type Settings = ProviderPackage.Settings & BedrockConverse.OptionsInput &
|
|
|
29
28
|
readonly region?: string;
|
|
30
29
|
readonly topP?: number;
|
|
31
30
|
};
|
|
32
|
-
export declare const routes: import("../route
|
|
31
|
+
export declare const routes: import("../route.js").Route<{
|
|
33
32
|
readonly modelId: string;
|
|
34
33
|
readonly messages: readonly ({
|
|
35
34
|
readonly role: "user";
|
|
@@ -178,15 +177,15 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
178
177
|
}, import("../route/transport/http.js").HttpPrepared<{
|
|
179
178
|
readonly [x: string]: unknown;
|
|
180
179
|
readonly rawBody: string;
|
|
181
|
-
}>, import("../route
|
|
180
|
+
}>, import("../route.js").CompactionOperations | undefined>[];
|
|
182
181
|
export declare const configure: (input?: Config) => {
|
|
183
182
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
184
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route
|
|
183
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
185
184
|
configure: typeof configure;
|
|
186
185
|
};
|
|
187
186
|
export declare const provider: {
|
|
188
187
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
189
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route
|
|
188
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
190
189
|
configure: typeof configure;
|
|
191
190
|
};
|
|
192
191
|
export declare const model: ProviderPackage.Model<Settings, BedrockConverse.OptionsInput>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
3
3
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
-
import type
|
|
5
|
-
import { type ModelID } from "../schema/index.js";
|
|
4
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
6
5
|
export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
|
|
7
6
|
export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
|
|
8
7
|
export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
|
|
9
8
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
10
|
-
export type Config =
|
|
9
|
+
export type Config = RequestOptions & ProviderAuthOption<"optional"> & {
|
|
11
10
|
readonly provider?: string;
|
|
12
11
|
readonly baseURL: string;
|
|
13
12
|
readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
|
|
@@ -22,7 +21,7 @@ export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOpti
|
|
|
22
21
|
readonly baseURL: string;
|
|
23
22
|
readonly provider?: string;
|
|
24
23
|
};
|
|
25
|
-
export declare const routes: import("../route
|
|
24
|
+
export declare const routes: import("../route.js").Route<{
|
|
26
25
|
readonly context_management?: {
|
|
27
26
|
readonly edits: readonly {
|
|
28
27
|
readonly type: "compact_20260112";
|
|
@@ -329,10 +328,10 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
329
328
|
} | undefined;
|
|
330
329
|
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
331
330
|
readonly speed?: import("../schema/options.js").OpenString<"fast" | "standard"> | undefined;
|
|
332
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
331
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>[];
|
|
333
332
|
export declare const configure: (input: Config) => {
|
|
334
333
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
335
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route
|
|
334
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
336
335
|
configure: typeof configure;
|
|
337
336
|
};
|
|
338
337
|
export declare const provider: {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type { RouteDefaultsInput } from "../route/client.js";
|
|
2
1
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
2
|
import type { ProviderPackage } from "../provider-package.js";
|
|
4
|
-
import { type ModelID } from "../schema/index.js";
|
|
3
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
5
4
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
6
5
|
export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
|
|
7
6
|
export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
|
|
8
7
|
export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
|
|
9
8
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
10
|
-
export declare const routes: import("../route
|
|
9
|
+
export declare const routes: import("../route.js").Route<{
|
|
11
10
|
readonly context_management?: {
|
|
12
11
|
readonly edits: readonly {
|
|
13
12
|
readonly type: "compact_20260112";
|
|
@@ -314,8 +313,8 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
314
313
|
} | undefined;
|
|
315
314
|
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
316
315
|
readonly speed?: import("../schema/options.js").OpenString<"fast" | "standard"> | undefined;
|
|
317
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
318
|
-
export type Config =
|
|
316
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>[];
|
|
317
|
+
export type Config = RequestOptions & ProviderAuthOption<"optional"> & {
|
|
319
318
|
readonly baseURL?: string;
|
|
320
319
|
readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
|
|
321
320
|
};
|
|
@@ -330,12 +329,12 @@ export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOpti
|
|
|
330
329
|
};
|
|
331
330
|
export declare const configure: (input?: Config) => {
|
|
332
331
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
333
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route
|
|
332
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
334
333
|
configure: typeof configure;
|
|
335
334
|
};
|
|
336
335
|
export declare const provider: {
|
|
337
336
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
338
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route
|
|
337
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
339
338
|
configure: typeof configure;
|
|
340
339
|
};
|
|
341
340
|
export declare const model: ProviderPackage.Model<Settings, AnthropicMessages.ProviderOptionsInput>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import type { Route,
|
|
2
|
+
import type { Route, CompactionOperations } from "../route/client.js";
|
|
3
3
|
import type { ProviderPackage } from "../provider-package.js";
|
|
4
|
-
import { type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
6
6
|
import { type OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
7
7
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -9,7 +9,7 @@ type AzureURL = AtLeastOne<{
|
|
|
9
9
|
readonly resourceName: string;
|
|
10
10
|
readonly baseURL: string;
|
|
11
11
|
}>;
|
|
12
|
-
export type Config = AzureURL &
|
|
12
|
+
export type Config = AzureURL & RequestOptions & ProviderAuthOption<"optional"> & {
|
|
13
13
|
readonly apiVersion?: string;
|
|
14
14
|
readonly queryParams?: Record<string, string>;
|
|
15
15
|
readonly useDeploymentBasedUrls?: boolean;
|
package/dist/providers/azure.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Auth } from "../route/auth.js";
|
|
|
2
2
|
import { AuthOptions } from "../route/auth-options.js";
|
|
3
3
|
import { Endpoint } from "../route/endpoint.js";
|
|
4
4
|
import { MediaRoute } from "../route/media.js";
|
|
5
|
-
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
5
|
+
import { ProviderConfigurationError, ProviderID, } from "../schema/index.js";
|
|
6
6
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
7
7
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
8
8
|
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
@@ -78,7 +78,7 @@ export const configure = (input) => {
|
|
|
78
78
|
.model({ id: modelID });
|
|
79
79
|
const chat = (modelID) => configuredRoute(chatRoute, input, modelID)
|
|
80
80
|
.with(withOpenAIOptions(modelID, modelDefaults))
|
|
81
|
-
.model({ id: modelID,
|
|
81
|
+
.model({ id: modelID, capabilities: { promptCacheKey: true } });
|
|
82
82
|
const messages = (modelID) => messagesRoute
|
|
83
83
|
.with({
|
|
84
84
|
...modelDefaults,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config = Omit<
|
|
7
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID } from "../schema/index.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config = Omit<
|
|
7
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Config, Redacted } from "effect";
|
|
2
2
|
import type { ProviderPackage } from "../provider-package.js";
|
|
3
3
|
import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
-
import type
|
|
5
|
-
import { type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
6
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
7
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
8
7
|
export declare const authEnvVars: readonly ["CLOUDFLARE_API_TOKEN", "CF_AIG_TOKEN"];
|
|
@@ -18,7 +17,7 @@ type GatewayOptions = {
|
|
|
18
17
|
readonly skipCache?: boolean;
|
|
19
18
|
readonly collectLog?: boolean;
|
|
20
19
|
};
|
|
21
|
-
export type Config = GatewayURL & GatewayOptions & Omit<
|
|
20
|
+
export type Config = GatewayURL & GatewayOptions & Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
22
21
|
readonly gatewayApiKey?: string | Redacted.Redacted | Config.Config<string | Redacted.Redacted>;
|
|
23
22
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
24
23
|
};
|
|
@@ -29,7 +28,7 @@ export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & G
|
|
|
29
28
|
export declare const baseURL: (input: GatewayURL) => string;
|
|
30
29
|
/** The Run API (`/ai/run`) next to the OpenAI-compatible `/ai/v1` base. */
|
|
31
30
|
export declare const runBaseURL: (input: GatewayURL) => string;
|
|
32
|
-
export declare const responsesRoute: import("../route
|
|
31
|
+
export declare const responsesRoute: import("../route.js").Route<{
|
|
33
32
|
readonly model: string;
|
|
34
33
|
readonly input: readonly ({
|
|
35
34
|
readonly type: "configuration_update";
|
|
@@ -262,7 +261,7 @@ export declare const responsesRoute: import("../route/client.js").Route<{
|
|
|
262
261
|
endpoint: import("../route/client.js").CompactOperation;
|
|
263
262
|
trigger: import("../route/client.js").TriggerCompactOperation;
|
|
264
263
|
}>;
|
|
265
|
-
export declare const messagesRoute: import("../route
|
|
264
|
+
export declare const messagesRoute: import("../route.js").Route<{
|
|
266
265
|
readonly context_management?: {
|
|
267
266
|
readonly edits: readonly {
|
|
268
267
|
readonly type: "compact_20260112";
|
|
@@ -569,8 +568,8 @@ export declare const messagesRoute: import("../route/client.js").Route<{
|
|
|
569
568
|
} | undefined;
|
|
570
569
|
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
571
570
|
readonly speed?: import("../schema/options.js").OpenString<"fast" | "standard"> | undefined;
|
|
572
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
573
|
-
export declare const route: import("../route
|
|
571
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>;
|
|
572
|
+
export declare const route: import("../route.js").Route<{
|
|
574
573
|
readonly model: string;
|
|
575
574
|
readonly messages: readonly ({
|
|
576
575
|
readonly role: "system";
|
|
@@ -743,8 +742,8 @@ export declare const route: import("../route/client.js").Route<{
|
|
|
743
742
|
readonly presence_penalty?: number | undefined;
|
|
744
743
|
readonly seed?: number | undefined;
|
|
745
744
|
readonly stop?: readonly string[] | undefined;
|
|
746
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
747
|
-
export declare const routes: (import("../route
|
|
745
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>;
|
|
746
|
+
export declare const routes: (import("../route.js").Route<{
|
|
748
747
|
readonly context_management?: {
|
|
749
748
|
readonly edits: readonly {
|
|
750
749
|
readonly type: "compact_20260112";
|
|
@@ -1051,7 +1050,7 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
1051
1050
|
} | undefined;
|
|
1052
1051
|
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
1053
1052
|
readonly speed?: import("../schema/options.js").OpenString<"fast" | "standard"> | undefined;
|
|
1054
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
1053
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined> | import("../route.js").Route<{
|
|
1055
1054
|
readonly model: string;
|
|
1056
1055
|
readonly messages: readonly ({
|
|
1057
1056
|
readonly role: "system";
|
|
@@ -1224,7 +1223,7 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
1224
1223
|
readonly presence_penalty?: number | undefined;
|
|
1225
1224
|
readonly seed?: number | undefined;
|
|
1226
1225
|
readonly stop?: readonly string[] | undefined;
|
|
1227
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
1226
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined> | import("../route.js").Route<{
|
|
1228
1227
|
readonly model: string;
|
|
1229
1228
|
readonly input: readonly ({
|
|
1230
1229
|
readonly type: "configuration_update";
|
|
@@ -1463,12 +1462,12 @@ export declare const configure: (input: Config) => {
|
|
|
1463
1462
|
endpoint: import("../route/client.js").CompactOperation;
|
|
1464
1463
|
trigger: import("../route/client.js").TriggerCompactOperation;
|
|
1465
1464
|
}>;
|
|
1466
|
-
chat: (value: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route
|
|
1465
|
+
chat: (value: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
1467
1466
|
responses: (value: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, {
|
|
1468
1467
|
endpoint: import("../route/client.js").CompactOperation;
|
|
1469
1468
|
trigger: import("../route/client.js").TriggerCompactOperation;
|
|
1470
1469
|
}>;
|
|
1471
|
-
messages: (value: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route
|
|
1470
|
+
messages: (value: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
1472
1471
|
decision: (value: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
1473
1472
|
configure: typeof configure;
|
|
1474
1473
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
7
|
export declare const authEnvVars: readonly ["CLOUDFLARE_API_KEY", "CLOUDFLARE_WORKERS_AI_TOKEN", "CLOUDFLARE_API_TOKEN"];
|
|
@@ -9,7 +9,7 @@ type WorkersAIURL = AtLeastOne<{
|
|
|
9
9
|
readonly accountId: string;
|
|
10
10
|
readonly baseURL: string;
|
|
11
11
|
}>;
|
|
12
|
-
export type Config = WorkersAIURL & Omit<
|
|
12
|
+
export type Config = WorkersAIURL & Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
13
13
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
14
14
|
};
|
|
15
15
|
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & WorkersAIURL & {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { CohereChat } from "../protocols/cohere-chat.js";
|
|
2
|
-
import { Route
|
|
2
|
+
import { Route } from "../route/client.js";
|
|
3
3
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
-
import { type ModelID, type OpenString } from "../schema/index.js";
|
|
4
|
+
import { type ModelID, type OpenString, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { ProviderPackage } from "../provider-package.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
7
|
export type ChatOptionsInput = {
|
|
8
8
|
readonly reasoningEffort?: OpenString<"none" | "high">;
|
|
9
9
|
};
|
|
10
10
|
export type ProviderOptions = CohereChat.ProviderOptionsInput & ChatOptionsInput;
|
|
11
|
-
export type Config = Omit<
|
|
11
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
12
12
|
readonly baseURL?: string;
|
|
13
13
|
readonly providerOptions?: ProviderOptions;
|
|
14
14
|
};
|
package/dist/providers/cohere.js
CHANGED