Skip to content

Commit cea38ce

Browse files
Apply PR #11311: fix(tui): add handling for codex model served from openrouter to include xhigh reasoning mode
2 parents b7117ed + 19b8c55 commit cea38ce

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/opencode/src/provider/transform.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ export namespace ProviderTransform {
354354
switch (model.api.npm) {
355355
case "@openrouter/ai-sdk-provider":
356356
if (!model.id.includes("gpt") && !model.id.includes("gemini-3")) return {}
357+
357358
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
358359

359360
// TODO: YOU CANNOT SET max_tokens if this is set!!!
@@ -394,6 +395,12 @@ export namespace ProviderTransform {
394395
case "@ai-sdk/deepinfra":
395396
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/deepinfra
396397
case "@ai-sdk/openai-compatible":
398+
// Following logic for the `@ai-sdk/openai` case
399+
if (id.includes("codex")) {
400+
if (id.includes("5.2")) return Object.fromEntries([...WIDELY_SUPPORTED_EFFORTS, "xhigh"].map((effort) => [effort, { reasoning: { effort } }]))
401+
return Object.fromEntries(WIDELY_SUPPORTED_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
402+
}
403+
397404
// When using openai-compatible SDK with Claude/Anthropic models,
398405
// we must use snake_case (budget_tokens) as the SDK doesn't convert parameter names
399406
// and the OpenAI-compatible API spec uses snake_case

0 commit comments

Comments
 (0)