@opencode/ai 0.0.0-dev-19635 → 0.0.0-dev-19637
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/openai-chat.js +4 -1
- package/dist/providers/azure.js +1 -1
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/deepinfra.js +1 -1
- package/dist/providers/fireworks.js +1 -1
- package/dist/providers/meta.js +1 -1
- package/dist/providers/moonshot.js +1 -0
- package/dist/providers/openai.js +4 -1
- package/dist/providers/openrouter.js +1 -1
- package/dist/schema/options.d.ts +1 -0
- package/dist/schema/options.js +3 -0
- package/package.json +3 -3
|
@@ -560,7 +560,10 @@ const detectZaiToolStream = (provider, baseURL, modelID) => {
|
|
|
560
560
|
};
|
|
561
561
|
const lowerOptions = (request, supportsStore) => {
|
|
562
562
|
const options = OpenAIOptions.resolve(request);
|
|
563
|
-
|
|
563
|
+
// Default off: strict providers 400 on unknown body fields, so only send
|
|
564
|
+
// the key where compatibility explicitly allows it. Header-based affinity
|
|
565
|
+
// (x-session-affinity, x-grok-conv-id, ...) is unaffected.
|
|
566
|
+
const cacheKey = (request.model.compatibility?.supportsPromptCacheKey ?? false) ? ProviderShared.promptCacheKey(request) : undefined;
|
|
564
567
|
return {
|
|
565
568
|
...(supportsStore && options.store !== undefined ? { store: options.store } : {}),
|
|
566
569
|
// For providers that support `store`, ensure stateless `store:false` is sent
|
package/dist/providers/azure.js
CHANGED
|
@@ -81,7 +81,7 @@ export const configure = (input) => {
|
|
|
81
81
|
.model({ id: modelID });
|
|
82
82
|
const chat = (modelID) => configuredRoute(chatRoute, input, modelID)
|
|
83
83
|
.with(withOpenAIOptions(modelID, modelDefaults))
|
|
84
|
-
.model({ id: modelID });
|
|
84
|
+
.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } });
|
|
85
85
|
return {
|
|
86
86
|
id,
|
|
87
87
|
model: responses,
|
|
@@ -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", reasoningField: "reasoning", supportsStore: false },
|
|
28
|
+
compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning", supportsStore: false, supportsPromptCacheKey: true },
|
|
29
29
|
}),
|
|
30
30
|
configure,
|
|
31
31
|
};
|
|
@@ -28,7 +28,7 @@ export const configure = (input = {}) => {
|
|
|
28
28
|
id,
|
|
29
29
|
model: (modelID) => configured.model({
|
|
30
30
|
id: modelID,
|
|
31
|
-
compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", supportsStore: false },
|
|
31
|
+
compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", supportsStore: false, supportsPromptCacheKey: true },
|
|
32
32
|
}),
|
|
33
33
|
configure,
|
|
34
34
|
};
|
package/dist/providers/meta.js
CHANGED
|
@@ -78,7 +78,7 @@ export const configure = (input = {}) => {
|
|
|
78
78
|
const responses = (modelID) => configuredResponses.model({ id: modelID });
|
|
79
79
|
const chat = (modelID) => configuredChat.model({
|
|
80
80
|
id: modelID,
|
|
81
|
-
compatibility: { maxTokensField: "max_completion_tokens", supportsStore: false },
|
|
81
|
+
compatibility: { maxTokensField: "max_completion_tokens", supportsStore: false, supportsPromptCacheKey: true },
|
|
82
82
|
});
|
|
83
83
|
const messages = (modelID) => configuredMessages.model({
|
|
84
84
|
id: modelID,
|
package/dist/providers/openai.js
CHANGED
|
@@ -40,7 +40,10 @@ export const configure = (input = {}) => {
|
|
|
40
40
|
const responses = (id) => responsesRoute
|
|
41
41
|
.with(withOpenAIOptions(id, modelDefaults, { textVerbosity: true }))
|
|
42
42
|
.model({ id });
|
|
43
|
-
const chat = (id) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({
|
|
43
|
+
const chat = (id) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({
|
|
44
|
+
id,
|
|
45
|
+
compatibility: { supportsPromptCacheKey: true },
|
|
46
|
+
});
|
|
44
47
|
const image = (modelID) => OpenAIImages.model({
|
|
45
48
|
id: modelID,
|
|
46
49
|
auth: auth(input),
|
|
@@ -100,7 +100,7 @@ export const configure = (input = {}) => {
|
|
|
100
100
|
const route = configuredRoute(input);
|
|
101
101
|
return {
|
|
102
102
|
id,
|
|
103
|
-
model: (modelID) => route.model({ id: modelID }),
|
|
103
|
+
model: (modelID) => route.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } }),
|
|
104
104
|
configure,
|
|
105
105
|
};
|
|
106
106
|
};
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ declare const LanguageModelCompatibility_base: Schema.Class<LanguageModelCompati
|
|
|
83
83
|
readonly supportsStore: Schema.optional<Schema.Boolean>;
|
|
84
84
|
readonly supportsUsageInStreaming: Schema.optional<Schema.Boolean>;
|
|
85
85
|
readonly supportsStrictMode: Schema.optional<Schema.Boolean>;
|
|
86
|
+
readonly supportsPromptCacheKey: Schema.optional<Schema.Boolean>;
|
|
86
87
|
readonly zaiToolStream: Schema.optional<Schema.Boolean>;
|
|
87
88
|
readonly requireSignature: Schema.optional<Schema.Boolean>;
|
|
88
89
|
/** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
|
package/dist/schema/options.js
CHANGED
|
@@ -109,6 +109,9 @@ export class LanguageModelCompatibility extends Schema.Class("LLM.LanguageModelC
|
|
|
109
109
|
supportsStore: Schema.optional(Schema.Boolean),
|
|
110
110
|
supportsUsageInStreaming: Schema.optional(Schema.Boolean),
|
|
111
111
|
supportsStrictMode: Schema.optional(Schema.Boolean),
|
|
112
|
+
// Accepts `prompt_cache_key` in the Chat Completions body. Chat omits the
|
|
113
|
+
// key unless this is set; session-affinity headers still flow regardless.
|
|
114
|
+
supportsPromptCacheKey: Schema.optional(Schema.Boolean),
|
|
112
115
|
zaiToolStream: Schema.optional(Schema.Boolean),
|
|
113
116
|
requireSignature: Schema.optional(Schema.Boolean),
|
|
114
117
|
/** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
|
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-19637",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
32
32
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
33
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
33
|
+
"@opencode/http-recorder": "0.0.0-dev-19637",
|
|
34
34
|
"@tsconfig/bun": "1.0.9",
|
|
35
35
|
"@types/bun": "1.4.0",
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
41
41
|
"@smithy/eventstream-codec": "4.2.14",
|
|
42
42
|
"@smithy/util-utf8": "4.2.2",
|
|
43
|
-
"@opencode/schema": "0.0.0-dev-
|
|
43
|
+
"@opencode/schema": "0.0.0-dev-19637",
|
|
44
44
|
"aws4fetch": "1.0.20",
|
|
45
45
|
"effect": "4.0.0-rc.112",
|
|
46
46
|
"google-auth-library": "10.5.0"
|