Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/opencode/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,12 @@ export namespace ProviderTransform {
result["reasoningEffort"] = "medium"
}

// Only set textVerbosity for non-chat gpt-5.x models
// Chat models (e.g. gpt-5.2-chat-latest) only support "medium" verbosity
if (
input.model.api.id.includes("gpt-5.") &&
!input.model.api.id.includes("codex") &&
!input.model.api.id.includes("-chat") &&
input.model.providerID !== "azure"
) {
result["textVerbosity"] = "low"
Expand Down
72 changes: 72 additions & 0 deletions packages/opencode/test/provider/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,78 @@ describe("ProviderTransform.options - setCacheKey", () => {
})
})

describe("ProviderTransform.options - gpt-5 textVerbosity", () => {
const sessionID = "test-session-123"

const createGpt5Model = (apiId: string) =>
({
id: `openai/${apiId}`,
providerID: "openai",
api: {
id: apiId,
url: "https://api.openai.com",
npm: "@ai-sdk/openai",
},
name: apiId,
capabilities: {
temperature: true,
reasoning: true,
attachment: true,
toolcall: true,
input: { text: true, audio: false, image: true, video: false, pdf: false },
output: { text: true, audio: false, image: false, video: false, pdf: false },
interleaved: false,
},
cost: { input: 0.03, output: 0.06, cache: { read: 0.001, write: 0.002 } },
limit: { context: 128000, output: 4096 },
status: "active",
options: {},
headers: {},
}) as any

test("gpt-5.2 should have textVerbosity set to low", () => {
const model = createGpt5Model("gpt-5.2")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBe("low")
})

test("gpt-5.1 should have textVerbosity set to low", () => {
const model = createGpt5Model("gpt-5.1")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBe("low")
})

test("gpt-5.2-chat-latest should NOT have textVerbosity set (only supports medium)", () => {
const model = createGpt5Model("gpt-5.2-chat-latest")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})

test("gpt-5.1-chat-latest should NOT have textVerbosity set (only supports medium)", () => {
const model = createGpt5Model("gpt-5.1-chat-latest")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})

test("gpt-5.2-chat should NOT have textVerbosity set", () => {
const model = createGpt5Model("gpt-5.2-chat")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})

test("gpt-5-chat should NOT have textVerbosity set", () => {
const model = createGpt5Model("gpt-5-chat")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})

test("gpt-5.2-codex should NOT have textVerbosity set (codex models excluded)", () => {
const model = createGpt5Model("gpt-5.2-codex")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})
})

describe("ProviderTransform.maxOutputTokens", () => {
test("returns 32k when modelLimit > 32k", () => {
const modelLimit = 100000
Expand Down
Loading