feat(cli): exclude ChatGPT subscriptions from explicit prompt cache breakpoints

This commit is contained in:
chrarnoldus
2026-08-10 12:49:48 +00:00
parent ee8b1ebffc
commit 2e5199a40d
3 changed files with 82 additions and 6 deletions
@@ -3162,6 +3162,70 @@ describe("ProviderTransform.message - cache control on gateway", () => {
},
})
})
test("openai gpt-5.6 with ChatGPT subscription (zero cost) does not apply promptCacheBreakpoint", () => {
const model = createModel({
providerID: "openai",
api: {
id: "gpt-5.6",
url: "https://api.openai.com/v1",
npm: "@ai-sdk/openai",
},
id: "gpt-5.6",
cost: {
input: 0,
output: 0,
cache: { read: 0, write: 0 },
},
})
const msgs = [
{
role: "system",
content: "You are a helpful assistant",
},
{
role: "user",
content: "Hello",
},
] as any[]
const result = ProviderTransform.message(msgs, model, {}) as any[]
expect(result[0].providerOptions?.openai?.promptCacheBreakpoint).toBeUndefined()
expect(result[1].providerOptions?.openai?.promptCacheBreakpoint).toBeUndefined()
})
test("openai gpt-5.6 with ChatGPT backend endpoint does not apply promptCacheBreakpoint", () => {
const model = createModel({
providerID: "openai",
api: {
id: "gpt-5.6",
url: "https://chatgpt.com/backend-api/codex/responses",
npm: "@ai-sdk/openai",
},
id: "gpt-5.6",
cost: {
input: 0.002,
output: 0.008,
cache: { read: 0.0005, write: 0.002 },
},
})
const msgs = [
{
role: "system",
content: "You are a helpful assistant",
},
{
role: "user",
content: "Hello",
},
] as any[]
const result = ProviderTransform.message(msgs, model, {}) as any[]
expect(result[0].providerOptions?.openai?.promptCacheBreakpoint).toBeUndefined()
expect(result[1].providerOptions?.openai?.promptCacheBreakpoint).toBeUndefined()
})
// kilocode_change end
})