@opencode/ai 0.0.0-dev-21253 → 0.0.0-dev-21259
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 +0 -1
- package/dist/protocols/alibaba-chat.js +0 -1
- package/dist/protocols/openai-chat.js +10 -39
- package/dist/protocols/venice-chat.d.ts +0 -1
- package/dist/protocols/venice-chat.js +0 -1
- package/dist/protocols/zai-chat.d.ts +0 -1
- package/dist/protocols/zai-chat.js +0 -1
- package/dist/providers/cerebras.js +0 -1
- package/dist/providers/cohere.js +0 -1
- package/dist/providers/deepinfra.js +0 -1
- package/dist/providers/deepseek.js +1 -1
- package/dist/providers/groq.js +0 -1
- package/dist/providers/meta.js +1 -1
- package/dist/providers/minimax.js +1 -1
- package/dist/providers/moonshot.js +0 -1
- package/dist/providers/togetherai.js +1 -1
- package/package.json +3 -3
|
@@ -29,7 +29,6 @@ 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
|
-
supportsStore: false;
|
|
33
32
|
supportsStrictMode: false;
|
|
34
33
|
reasoningField: string;
|
|
35
34
|
zaiToolStream: false;
|
|
@@ -549,43 +549,18 @@ const detectMaxTokensField = (provider, baseURL) => {
|
|
|
549
549
|
return "max_tokens";
|
|
550
550
|
return "max_completion_tokens";
|
|
551
551
|
};
|
|
552
|
+
// `store` defaults to false on OpenAI and Azure, but org-level logging can still
|
|
553
|
+
// store requests that omit it, so send an explicit `store: false` there. Strict
|
|
554
|
+
// OpenAI-style APIs reject the field with a 400, so omit it everywhere else.
|
|
552
555
|
const detectSupportsStore = (provider, baseURL) => {
|
|
553
556
|
const p = provider.toLowerCase();
|
|
554
557
|
const url = (baseURL ?? "").toLowerCase();
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
p === "zhipuai-coding-plan" ||
|
|
562
|
-
url.includes("api.z.ai") ||
|
|
563
|
-
url.includes("open.bigmodel.cn");
|
|
564
|
-
const isDeepSeek = p === "deepseek" || url.includes("deepseek.com");
|
|
565
|
-
const isCerebras = p === "cerebras" || url.includes("cerebras.ai");
|
|
566
|
-
const isXai = p === "xai" || url.includes("api.x.ai");
|
|
567
|
-
const isChutes = p === "chutes" || url.includes("chutes.ai");
|
|
568
|
-
const isCloudflareWorkersAI = p === "cloudflare-workers-ai" || url.includes("api.cloudflare.com");
|
|
569
|
-
const isCloudflareAiGateway = p === "cloudflare-ai-gateway" || url.includes("gateway.ai.cloudflare.com");
|
|
570
|
-
const isVercelAiGateway = p === "vercel-ai-gateway" || url.includes("ai-gateway.vercel.sh") || url.includes("vercel.sh");
|
|
571
|
-
const isAntLing = p === "ant-ling" || url.includes("api.ant-ling.com");
|
|
572
|
-
const isOpencode = p === "opencode" || url.includes("opencode.ai");
|
|
573
|
-
const isGemini = url.includes("generativelanguage.googleapis.com");
|
|
574
|
-
const isNonStandard = isGemini ||
|
|
575
|
-
isNvidia ||
|
|
576
|
-
isCerebras ||
|
|
577
|
-
isXai ||
|
|
578
|
-
isTogether ||
|
|
579
|
-
isChutes ||
|
|
580
|
-
isDeepSeek ||
|
|
581
|
-
isZai ||
|
|
582
|
-
isMoonshot ||
|
|
583
|
-
isOpencode ||
|
|
584
|
-
isCloudflareWorkersAI ||
|
|
585
|
-
isCloudflareAiGateway ||
|
|
586
|
-
isVercelAiGateway ||
|
|
587
|
-
isAntLing;
|
|
588
|
-
return !isNonStandard;
|
|
558
|
+
return (p === "openai" ||
|
|
559
|
+
p === "azure" ||
|
|
560
|
+
url.includes("api.openai.com") ||
|
|
561
|
+
url.includes(".openai.azure.com") ||
|
|
562
|
+
url.includes(".cognitiveservices.azure.com") ||
|
|
563
|
+
url.includes(".services.ai.azure.com"));
|
|
589
564
|
};
|
|
590
565
|
const detectSupportsUsageInStreaming = () => true;
|
|
591
566
|
const detectSupportsStrictMode = (provider, baseURL) => {
|
|
@@ -620,11 +595,7 @@ const lowerOptions = (request, supportsStore) => {
|
|
|
620
595
|
// (x-session-affinity, x-grok-conv-id, ...) is unaffected.
|
|
621
596
|
const cacheKey = (request.model.compatibility?.supportsPromptCacheKey ?? false) ? ProviderShared.promptCacheKey(request) : undefined;
|
|
622
597
|
return {
|
|
623
|
-
...(supportsStore
|
|
624
|
-
// For providers that support `store`, ensure stateless `store:false` is sent
|
|
625
|
-
// even when no explicit `providerOptions.store` was supplied, mirroring the
|
|
626
|
-
// native OpenAI Chat default. Non-standard providers omit `store` entirely.
|
|
627
|
-
...(supportsStore && options.store === undefined ? { store: false } : {}),
|
|
598
|
+
...(supportsStore ? { store: options.store ?? false } : {}),
|
|
628
599
|
...(cacheKey ? { prompt_cache_key: cacheKey } : {}),
|
|
629
600
|
...(options.reasoningEffort ? { reasoning_effort: options.reasoningEffort } : {}),
|
|
630
601
|
};
|
|
@@ -260,7 +260,6 @@ const onHalt = Effect.fn("VeniceChat.onHalt")(function* (state) {
|
|
|
260
260
|
});
|
|
261
261
|
export const compatibility = {
|
|
262
262
|
maxTokensField: "max_completion_tokens",
|
|
263
|
-
supportsStore: false,
|
|
264
263
|
supportsPromptCacheKey: true,
|
|
265
264
|
};
|
|
266
265
|
export const protocol = Protocol.make({
|
|
@@ -39,7 +39,6 @@ const fromRequest = Effect.fn("ZAIChat.fromRequest")(function* (request) {
|
|
|
39
39
|
});
|
|
40
40
|
export const compatibility = {
|
|
41
41
|
maxTokensField: "max_tokens",
|
|
42
|
-
supportsStore: false,
|
|
43
42
|
supportsStrictMode: false,
|
|
44
43
|
reasoningField: "reasoning_content",
|
|
45
44
|
zaiToolStream: false,
|
package/dist/providers/cohere.js
CHANGED
|
@@ -25,7 +25,7 @@ export const configure = (input = {}) => {
|
|
|
25
25
|
id,
|
|
26
26
|
model: (modelID) => configured.model({
|
|
27
27
|
id: modelID,
|
|
28
|
-
compatibility: { maxTokensField: "max_tokens"
|
|
28
|
+
compatibility: { maxTokensField: "max_tokens" },
|
|
29
29
|
}),
|
|
30
30
|
configure,
|
|
31
31
|
};
|
package/dist/providers/groq.js
CHANGED
package/dist/providers/meta.js
CHANGED
|
@@ -79,7 +79,7 @@ export const configure = (input = {}) => {
|
|
|
79
79
|
const responses = (modelID) => configuredResponses.model({ id: modelID });
|
|
80
80
|
const chat = (modelID) => configuredChat.model({
|
|
81
81
|
id: modelID,
|
|
82
|
-
compatibility: { maxTokensField: "max_completion_tokens",
|
|
82
|
+
compatibility: { maxTokensField: "max_completion_tokens", supportsPromptCacheKey: true },
|
|
83
83
|
});
|
|
84
84
|
const messages = (modelID) => configuredMessages.model({
|
|
85
85
|
id: modelID,
|
|
@@ -70,7 +70,7 @@ export const configure = (input = {}) => {
|
|
|
70
70
|
const messages = (modelID) => messagesRoute.with(defaults).model({ id: modelID });
|
|
71
71
|
const chat = (modelID) => chatRoute.with(defaults).model({
|
|
72
72
|
id: modelID,
|
|
73
|
-
compatibility: {
|
|
73
|
+
compatibility: { supportsStrictMode: false },
|
|
74
74
|
});
|
|
75
75
|
const responses = (modelID) => responsesRoute.with(defaults).model({ id: modelID });
|
|
76
76
|
return { id, model: messages, messages, chat, responses, configure };
|
|
@@ -25,7 +25,7 @@ export const configure = (input = {}) => {
|
|
|
25
25
|
id,
|
|
26
26
|
model: (modelID) => configured.model({
|
|
27
27
|
id: modelID,
|
|
28
|
-
compatibility: { maxTokensField: "max_tokens",
|
|
28
|
+
compatibility: { maxTokensField: "max_tokens", supportsStrictMode: false },
|
|
29
29
|
}),
|
|
30
30
|
configure,
|
|
31
31
|
};
|
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-21259",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.1",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-21259",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-21259",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.1",
|
|
50
50
|
"google-auth-library": "10.5.0"
|