summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-08-12 17:37:15 -0400
committerDax Raad <[email protected]>2025-08-12 17:37:15 -0400
commit5785ded6e2a8607d8eff9f94b2f70caebb2cfec6 (patch)
treee7992810e1d1e1c7bfc6ee3b21968f89049e3e5e
parentd1876e30311a563d09b13c8236cbb335abc65d8d (diff)
downloadopencode-5785ded6e2a8607d8eff9f94b2f70caebb2cfec6.tar.gz
opencode-5785ded6e2a8607d8eff9f94b2f70caebb2cfec6.zip
add openai prompt cache key
-rw-r--r--packages/opencode/src/global/index.ts2
-rw-r--r--packages/opencode/src/provider/transform.ts35
-rw-r--r--packages/opencode/src/session/index.ts4
3 files changed, 14 insertions, 27 deletions
diff --git a/packages/opencode/src/global/index.ts b/packages/opencode/src/global/index.ts
index 4cfaf03a5..b5379347b 100644
--- a/packages/opencode/src/global/index.ts
+++ b/packages/opencode/src/global/index.ts
@@ -28,7 +28,7 @@ await Promise.all([
fs.mkdir(Global.Path.bin, { recursive: true }),
])
-const CACHE_VERSION = "7"
+const CACHE_VERSION = "8"
const version = await Bun.file(path.join(Global.Path.cache, "version"))
.text()
diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts
index c0591a69f..8428c2477 100644
--- a/packages/opencode/src/provider/transform.ts
+++ b/packages/opencode/src/provider/transform.ts
@@ -83,32 +83,19 @@ export namespace ProviderTransform {
return undefined
}
- export function options(providerID: string, modelID: string): Record<string, any> | undefined {
+ export function options(providerID: string, modelID: string, sessionID: string): Record<string, any> | undefined {
+ const result: Record<string, any> = {}
+
+ if (providerID === "openai") {
+ result["promptCacheKey"] = sessionID
+ }
+
if (modelID.includes("gpt-5")) {
- if (providerID === "azure") {
- return {
- reasoningEffort: "minimal",
- }
- }
- return {
- reasoningEffort: "minimal",
- textVerbosity: "low",
- // reasoningSummary: "auto",
- // include: ["reasoning.encrypted_content"],
+ result["reasoningEffort"] = "minimal"
+ if (providerID !== "azure") {
+ result["textVerbosity"] = "low"
}
}
- // if (modelID.includes("claude")) {
- // return {
- // thinking: {
- // type: "enabled",
- // budgetTokens: 32000,
- // },
- // }
- // }
- // if (_providerID === "bedrock") {
- // return {
- // reasoningConfig: { type: "enabled", budgetTokens: 32000 },
- // }
- // }
+ return result
}
}
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 182e16170..85b067efc 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -674,7 +674,7 @@ export namespace Session {
providerOptions: {
[input.providerID]: {
...small.info.options,
- ...ProviderTransform.options(input.providerID, small.info.id),
+ ...ProviderTransform.options(input.providerID, small.info.id, input.sessionID),
},
},
messages: [
@@ -868,7 +868,7 @@ export namespace Session {
: undefined,
topP: agent.topP ?? ProviderTransform.topP(input.providerID, input.modelID),
options: {
- ...ProviderTransform.options(input.providerID, input.modelID),
+ ...ProviderTransform.options(input.providerID, input.modelID, input.sessionID),
...model.info.options,
...agent.options,
},