@opencode/ai 0.0.0-dev-791 → 0.0.0-dev-800
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-responses.js +1 -1
- 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.js +3 -1
- package/dist/providers/amazon-bedrock-mantle.js +1 -1
- package/dist/providers/azure.js +1 -1
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/cohere.js +1 -1
- package/dist/providers/deepinfra.js +1 -1
- package/dist/providers/digitalocean.js +1 -3
- package/dist/providers/fireworks.js +1 -1
- package/dist/providers/groq.js +1 -1
- package/dist/providers/meta.js +2 -1
- package/dist/providers/minimax.js +1 -1
- package/dist/providers/moonshot.js +1 -2
- package/dist/providers/openai.js +1 -1
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/togetherai.js +2 -1
- package/dist/providers/venice.js +7 -1
- package/dist/providers/zai-coding-plan.js +7 -1
- package/dist/providers/zai.js +7 -1
- package/dist/schema/options.d.ts +64 -7
- package/dist/schema/options.js +4 -10
- 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 }
|
|
@@ -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);
|
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 },
|
|
@@ -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,
|
|
@@ -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));
|
package/dist/providers/azure.js
CHANGED
|
@@ -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,
|
package/dist/providers/cohere.js
CHANGED
|
@@ -55,9 +55,7 @@ export const configure = (input = {}) => {
|
|
|
55
55
|
const image = (modelID, providerOptions) => OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions });
|
|
56
56
|
const chat = (modelID) => configured.model({
|
|
57
57
|
id: modelID,
|
|
58
|
-
|
|
59
|
-
supportsPromptCacheKey: true,
|
|
60
|
-
},
|
|
58
|
+
capabilities: { promptCacheKey: true },
|
|
61
59
|
});
|
|
62
60
|
return {
|
|
63
61
|
id,
|
|
@@ -18,7 +18,7 @@ export const configure = (input = {}) => {
|
|
|
18
18
|
const configured = route.with(bearerRouteDefaults(input, "FIREWORKS_API_KEY", baseURL));
|
|
19
19
|
return {
|
|
20
20
|
id,
|
|
21
|
-
model: (modelID) => configured.model({ id: modelID,
|
|
21
|
+
model: (modelID) => configured.model({ id: modelID, capabilities: { promptCacheKey: true } }),
|
|
22
22
|
configure,
|
|
23
23
|
};
|
|
24
24
|
};
|
package/dist/providers/groq.js
CHANGED
package/dist/providers/meta.js
CHANGED
|
@@ -74,7 +74,8 @@ export const configure = (input = {}) => {
|
|
|
74
74
|
const responses = (modelID) => configuredResponses.model({ id: modelID });
|
|
75
75
|
const chat = (modelID) => configuredChat.model({
|
|
76
76
|
id: modelID,
|
|
77
|
-
compatibility: { maxTokensField: "max_completion_tokens"
|
|
77
|
+
compatibility: { maxTokensField: "max_completion_tokens" },
|
|
78
|
+
capabilities: { promptCacheKey: true },
|
|
78
79
|
});
|
|
79
80
|
const messages = (modelID) => configuredMessages.model({
|
|
80
81
|
id: modelID,
|
|
@@ -70,7 +70,7 @@ export const configure = (input = {}) => {
|
|
|
70
70
|
});
|
|
71
71
|
const chat = (modelID) => chatRoute.with(defaults).model({
|
|
72
72
|
id: modelID,
|
|
73
|
-
|
|
73
|
+
capabilities: { tools: { strict: false } },
|
|
74
74
|
});
|
|
75
75
|
const responses = (modelID) => responsesRoute.with(defaults).model({ id: modelID });
|
|
76
76
|
const media = MediaRoute.deployment(input, defaults.auth);
|
|
@@ -56,11 +56,10 @@ export const configure = (input = {}) => {
|
|
|
56
56
|
id: modelID,
|
|
57
57
|
compatibility: {
|
|
58
58
|
maxTokensField: "max_tokens",
|
|
59
|
-
supportsStrictMode: false,
|
|
60
|
-
supportsPromptCacheKey: true,
|
|
61
59
|
sanitizer: "moonshot",
|
|
62
60
|
reasoningField: "reasoning_content",
|
|
63
61
|
},
|
|
62
|
+
capabilities: { tools: { strict: false }, promptCacheKey: true },
|
|
64
63
|
});
|
|
65
64
|
const messages = (modelID) => messagesRoute.with(defaults).model({
|
|
66
65
|
id: modelID,
|
package/dist/providers/openai.js
CHANGED
|
@@ -44,7 +44,7 @@ export const configure = (input = {}) => {
|
|
|
44
44
|
const responses = (id) => responsesRoute.with(withOpenAIOptions(id, modelDefaults)).model({ id });
|
|
45
45
|
const chat = (id) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({
|
|
46
46
|
id,
|
|
47
|
-
|
|
47
|
+
capabilities: { promptCacheKey: true },
|
|
48
48
|
});
|
|
49
49
|
const deployment = MediaRoute.deployment(input, auth(input));
|
|
50
50
|
const media = {
|
|
@@ -159,7 +159,7 @@ export const configure = (input = {}) => {
|
|
|
159
159
|
compatibility: { mediaInput: "state" },
|
|
160
160
|
providerOptions,
|
|
161
161
|
});
|
|
162
|
-
const chat = (modelID) => chatRoute.model({ id: modelID,
|
|
162
|
+
const chat = (modelID) => chatRoute.model({ id: modelID, capabilities: { promptCacheKey: true } });
|
|
163
163
|
return {
|
|
164
164
|
id,
|
|
165
165
|
model: chat,
|
|
@@ -20,7 +20,8 @@ export const configure = (input = {}) => {
|
|
|
20
20
|
id,
|
|
21
21
|
model: (modelID) => configured.model({
|
|
22
22
|
id: modelID,
|
|
23
|
-
compatibility: { maxTokensField: "max_tokens"
|
|
23
|
+
compatibility: { maxTokensField: "max_tokens" },
|
|
24
|
+
capabilities: { tools: { strict: false } },
|
|
24
25
|
}),
|
|
25
26
|
configure,
|
|
26
27
|
};
|
package/dist/providers/venice.js
CHANGED
|
@@ -32,7 +32,13 @@ export const configure = (input = {}) => {
|
|
|
32
32
|
endpoint: { baseURL: endpoint ?? baseURL, query: queryParams },
|
|
33
33
|
auth: AuthOptions.bearer(input, "VENICE_API_KEY"),
|
|
34
34
|
};
|
|
35
|
-
const chat = (modelID) => route
|
|
35
|
+
const chat = (modelID) => route
|
|
36
|
+
.with(options)
|
|
37
|
+
.model({
|
|
38
|
+
id: modelID,
|
|
39
|
+
compatibility: VeniceChat.compatibility,
|
|
40
|
+
capabilities: VeniceChat.capabilities,
|
|
41
|
+
});
|
|
36
42
|
const responses = (modelID) => responsesRoute.with(options).model({ id: modelID });
|
|
37
43
|
return { id, model: chat, chat, responses, configure };
|
|
38
44
|
};
|
|
@@ -37,7 +37,13 @@ const responsesRoute = Route.make({
|
|
|
37
37
|
export const routes = [chatRoute, messagesRoute, responsesRoute];
|
|
38
38
|
export const configure = (input = {}) => {
|
|
39
39
|
const defaults = bearerRouteDefaults(input, "ZAI_API_KEY");
|
|
40
|
-
const chat = (modelID) => chatRoute
|
|
40
|
+
const chat = (modelID) => chatRoute
|
|
41
|
+
.with(defaults)
|
|
42
|
+
.model({
|
|
43
|
+
id: modelID,
|
|
44
|
+
compatibility: ZAIChat.compatibility,
|
|
45
|
+
capabilities: ZAIChat.capabilities,
|
|
46
|
+
});
|
|
41
47
|
const messages = (modelID) => messagesRoute
|
|
42
48
|
.with(defaults)
|
|
43
49
|
.model({ id: modelID, compatibility: { requireSignature: false } });
|
package/dist/providers/zai.js
CHANGED
|
@@ -18,7 +18,13 @@ const chatRoute = Route.make({
|
|
|
18
18
|
export const routes = [chatRoute];
|
|
19
19
|
export const configure = (input = {}) => {
|
|
20
20
|
const defaults = bearerRouteDefaults(input, "ZAI_API_KEY");
|
|
21
|
-
const chat = (modelID) => chatRoute
|
|
21
|
+
const chat = (modelID) => chatRoute
|
|
22
|
+
.with(defaults)
|
|
23
|
+
.model({
|
|
24
|
+
id: modelID,
|
|
25
|
+
compatibility: ZAIChat.compatibility,
|
|
26
|
+
capabilities: ZAIChat.capabilities,
|
|
27
|
+
});
|
|
22
28
|
const media = MediaRoute.deployment(input, defaults.auth);
|
|
23
29
|
const image = (modelID, providerOptions) => ZAIImages.model({ ...media, id: modelID, providerOptions });
|
|
24
30
|
return {
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -98,19 +98,12 @@ declare const LanguageModelCompatibility_base: Schema.Class<LanguageModelCompati
|
|
|
98
98
|
readonly maxTokensField: Schema.optional<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>;
|
|
99
99
|
readonly requireFinishReason: Schema.optional<Schema.Boolean>;
|
|
100
100
|
readonly requireAssistantAfterTool: Schema.optional<Schema.Boolean>;
|
|
101
|
-
readonly supportsStore: Schema.optional<Schema.Boolean>;
|
|
102
|
-
/** Request usage in the stream with `stream_options.include_usage`. Defaults to true. */
|
|
103
|
-
readonly streamUsage: Schema.optional<Schema.Boolean>;
|
|
104
|
-
readonly supportsStrictMode: Schema.optional<Schema.Boolean>;
|
|
105
|
-
readonly supportsPromptCacheKey: Schema.optional<Schema.Boolean>;
|
|
106
101
|
/** Prompt-cache marker syntax the endpoint accepts. Overrides the route default; both send `cache_control`, and `alibaba` skips tool definitions. */
|
|
107
102
|
readonly cacheFormat: Schema.optional<Schema.Literals<readonly ["anthropic", "alibaba"]>>;
|
|
108
103
|
readonly zaiToolStream: Schema.optional<Schema.Boolean>;
|
|
109
104
|
readonly requireSignature: Schema.optional<Schema.Boolean>;
|
|
110
105
|
/** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
|
|
111
106
|
readonly supportsThinkingBlockBinding: Schema.optional<Schema.Boolean>;
|
|
112
|
-
/** Supports per-message effort updates. Overrides model-ID detection. */
|
|
113
|
-
readonly supportsEffortUpdates: Schema.optional<Schema.Boolean>;
|
|
114
107
|
}>, {}>;
|
|
115
108
|
export declare class LanguageModelCompatibility extends LanguageModelCompatibility_base {
|
|
116
109
|
}
|
|
@@ -119,12 +112,75 @@ export declare namespace LanguageModelCompatibility {
|
|
|
119
112
|
/** Normalize model/upstream compatibility metadata without projecting requests. */
|
|
120
113
|
const make: (input: Input) => LanguageModelCompatibility;
|
|
121
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* What the model accepts on its API: models.dev v2 `capabilities` in camelCase, with the API's own overrides merged in.
|
|
117
|
+
* Unset fields keep the protocol default, which may still guess from the provider, base URL or model ID.
|
|
118
|
+
*/
|
|
119
|
+
export interface Capabilities {
|
|
120
|
+
readonly tools?: {
|
|
121
|
+
readonly supported?: boolean;
|
|
122
|
+
/** Accepts `strict` on function tools. OpenAI Chat detects it from the provider when unset. */
|
|
123
|
+
readonly strict?: boolean;
|
|
124
|
+
readonly choice?: ReadonlyArray<"auto" | "none" | "required" | "tool">;
|
|
125
|
+
readonly search?: boolean;
|
|
126
|
+
/** Input formats accepted by custom (free-form) tools. */
|
|
127
|
+
readonly freeform?: ReadonlyArray<"text" | "lark" | "regex">;
|
|
128
|
+
/** Accepts a changed tool list mid-conversation. */
|
|
129
|
+
readonly updates?: boolean;
|
|
130
|
+
};
|
|
131
|
+
readonly reasoning?: {
|
|
132
|
+
readonly supported?: boolean;
|
|
133
|
+
readonly default?: {
|
|
134
|
+
readonly type: "toggle";
|
|
135
|
+
readonly value: boolean;
|
|
136
|
+
} | {
|
|
137
|
+
readonly type: "effort";
|
|
138
|
+
readonly value: ReasoningEffort;
|
|
139
|
+
} | {
|
|
140
|
+
readonly type: "budget";
|
|
141
|
+
readonly value: number;
|
|
142
|
+
};
|
|
143
|
+
readonly toggle?: boolean;
|
|
144
|
+
readonly effort?: ReadonlyArray<ReasoningEffort>;
|
|
145
|
+
readonly budget?: {
|
|
146
|
+
readonly min?: number;
|
|
147
|
+
readonly max?: number;
|
|
148
|
+
};
|
|
149
|
+
/** Accepts per-message effort updates. Detected from the model ID when unset. */
|
|
150
|
+
readonly updates?: boolean;
|
|
151
|
+
};
|
|
152
|
+
readonly cache?: false | {
|
|
153
|
+
readonly implicit?: true | {
|
|
154
|
+
readonly ttl?: ReadonlyArray<CacheTTL>;
|
|
155
|
+
readonly minTokens?: number;
|
|
156
|
+
};
|
|
157
|
+
readonly explicit?: true | {
|
|
158
|
+
readonly ttl?: ReadonlyArray<CacheTTL>;
|
|
159
|
+
readonly maxBreakpoints?: number;
|
|
160
|
+
readonly targets?: ReadonlyArray<"tools" | "system" | "messages">;
|
|
161
|
+
readonly minTokens?: number;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
readonly structuredOutput?: boolean;
|
|
165
|
+
readonly temperature?: boolean;
|
|
166
|
+
readonly topP?: boolean;
|
|
167
|
+
readonly topK?: boolean;
|
|
168
|
+
/** Accepts mid-conversation system messages. Anthropic Messages detects it from the model ID when unset. */
|
|
169
|
+
readonly systemUpdates?: boolean;
|
|
170
|
+
/** Accepts `store`. OpenAI Chat detects it from the provider when unset. */
|
|
171
|
+
readonly store?: boolean;
|
|
172
|
+
/** Accepts `stream_options.include_usage`. OpenAI Chat defaults to true. */
|
|
173
|
+
readonly streamUsage?: boolean;
|
|
174
|
+
readonly promptCacheKey?: boolean;
|
|
175
|
+
readonly serviceTier?: ReadonlyArray<OpenString<"flex" | "priority" | "fast" | "ultrafast" | "standby">>;
|
|
176
|
+
}
|
|
122
177
|
export declare class LanguageModel<Options extends ProviderOptions = ProviderOptions, Compact extends CompactionOperations | undefined = CompactionOperations | undefined> {
|
|
123
178
|
protected readonly _ProviderOptions: Options;
|
|
124
179
|
readonly id: ModelID;
|
|
125
180
|
readonly provider: ProviderID;
|
|
126
181
|
readonly route: AnyRoute<Compact>;
|
|
127
182
|
readonly defaults?: LanguageModelDefaults;
|
|
183
|
+
readonly capabilities?: Capabilities;
|
|
128
184
|
readonly compatibility?: LanguageModelCompatibility;
|
|
129
185
|
constructor(input: LanguageModel.ConstructorInput<Compact>);
|
|
130
186
|
static make<Options extends ProviderOptions = ProviderOptions, Compact extends CompactionOperations | undefined = CompactionOperations | undefined>(input: LanguageModel.Input<Compact>): LanguageModel<Options, Compact>;
|
|
@@ -143,6 +199,7 @@ export declare namespace LanguageModel {
|
|
|
143
199
|
readonly provider: ProviderID;
|
|
144
200
|
readonly route: AnyRoute<Compact>;
|
|
145
201
|
readonly defaults?: LanguageModelDefaults;
|
|
202
|
+
readonly capabilities?: Capabilities;
|
|
146
203
|
readonly compatibility?: LanguageModelCompatibility;
|
|
147
204
|
};
|
|
148
205
|
type Input<Compact extends CompactionOperations | undefined = CompactionOperations | undefined> = Omit<ConstructorInput<Compact>, "id" | "provider" | "compatibility"> & {
|
package/dist/schema/options.js
CHANGED
|
@@ -91,22 +91,12 @@ export class LanguageModelCompatibility extends Schema.Class("LLM.LanguageModelC
|
|
|
91
91
|
maxTokensField: Schema.optional(LanguageModelMaxTokensFieldCompatibility),
|
|
92
92
|
requireFinishReason: Schema.optional(Schema.Boolean),
|
|
93
93
|
requireAssistantAfterTool: Schema.optional(Schema.Boolean),
|
|
94
|
-
supportsStore: Schema.optional(Schema.Boolean),
|
|
95
|
-
/** Request usage in the stream with `stream_options.include_usage`. Defaults to true. */
|
|
96
|
-
streamUsage: Schema.optional(Schema.Boolean),
|
|
97
|
-
supportsStrictMode: Schema.optional(Schema.Boolean),
|
|
98
|
-
// Accepts `prompt_cache_key` in the request body. Chat omits the key unless
|
|
99
|
-
// this is true; other protocols omit it only when this is false.
|
|
100
|
-
// Session-affinity headers still flow regardless.
|
|
101
|
-
supportsPromptCacheKey: Schema.optional(Schema.Boolean),
|
|
102
94
|
/** Prompt-cache marker syntax the endpoint accepts. Overrides the route default; both send `cache_control`, and `alibaba` skips tool definitions. */
|
|
103
95
|
cacheFormat: Schema.optional(LanguageModelCacheFormatCompatibility),
|
|
104
96
|
zaiToolStream: Schema.optional(Schema.Boolean),
|
|
105
97
|
requireSignature: Schema.optional(Schema.Boolean),
|
|
106
98
|
/** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
|
|
107
99
|
supportsThinkingBlockBinding: Schema.optional(Schema.Boolean),
|
|
108
|
-
/** Supports per-message effort updates. Overrides model-ID detection. */
|
|
109
|
-
supportsEffortUpdates: Schema.optional(Schema.Boolean),
|
|
110
100
|
}) {
|
|
111
101
|
}
|
|
112
102
|
(function (LanguageModelCompatibility) {
|
|
@@ -118,12 +108,14 @@ export class LanguageModel {
|
|
|
118
108
|
provider;
|
|
119
109
|
route;
|
|
120
110
|
defaults;
|
|
111
|
+
capabilities;
|
|
121
112
|
compatibility;
|
|
122
113
|
constructor(input) {
|
|
123
114
|
this.id = input.id;
|
|
124
115
|
this.provider = input.provider;
|
|
125
116
|
this.route = input.route;
|
|
126
117
|
this.defaults = input.defaults;
|
|
118
|
+
this.capabilities = input.capabilities;
|
|
127
119
|
this.compatibility = input.compatibility;
|
|
128
120
|
}
|
|
129
121
|
static make(input) {
|
|
@@ -132,6 +124,7 @@ export class LanguageModel {
|
|
|
132
124
|
provider: ProviderID.make(input.provider),
|
|
133
125
|
route: input.route,
|
|
134
126
|
defaults: input.defaults,
|
|
127
|
+
capabilities: input.capabilities,
|
|
135
128
|
compatibility: input.compatibility === undefined ? undefined : LanguageModelCompatibility.make(input.compatibility),
|
|
136
129
|
});
|
|
137
130
|
}
|
|
@@ -141,6 +134,7 @@ export class LanguageModel {
|
|
|
141
134
|
provider: model.provider,
|
|
142
135
|
route: model.route,
|
|
143
136
|
defaults: model.defaults,
|
|
137
|
+
capabilities: model.capabilities,
|
|
144
138
|
compatibility: model.compatibility,
|
|
145
139
|
};
|
|
146
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-800",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
"devDependencies": {
|
|
521
521
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
522
522
|
"@effect/platform-node": "4.1.0",
|
|
523
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
523
|
+
"@opencode/http-recorder": "0.0.0-dev-800",
|
|
524
524
|
"@tsconfig/bun": "1.0.9",
|
|
525
525
|
"@types/bun": "1.4.3",
|
|
526
526
|
"@typescript/native": "npm:typescript@7.1.0-beta",
|
|
@@ -530,7 +530,7 @@
|
|
|
530
530
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
531
531
|
"@smithy/eventstream-codec": "4.2.14",
|
|
532
532
|
"@smithy/util-utf8": "4.2.2",
|
|
533
|
-
"@opencode/schema": "0.0.0-dev-
|
|
533
|
+
"@opencode/schema": "0.0.0-dev-800",
|
|
534
534
|
"aws4fetch": "1.0.20",
|
|
535
535
|
"effect": "4.1.0",
|
|
536
536
|
"google-auth-library": "10.5.0"
|