mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
Apply PR #11311: fix(tui): add handling for codex model served from openrouter to include xhigh reasoning mode
This commit is contained in:
@@ -353,6 +353,7 @@ export namespace ProviderTransform {
|
||||
switch (model.api.npm) {
|
||||
case "@openrouter/ai-sdk-provider":
|
||||
if (!model.id.includes("gpt") && !model.id.includes("gemini-3")) return {}
|
||||
|
||||
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
||||
|
||||
// TODO: YOU CANNOT SET max_tokens if this is set!!!
|
||||
@@ -393,6 +394,12 @@ export namespace ProviderTransform {
|
||||
case "@ai-sdk/deepinfra":
|
||||
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/deepinfra
|
||||
case "@ai-sdk/openai-compatible":
|
||||
// Following logic for the `@ai-sdk/openai` case
|
||||
if (id.includes("codex")) {
|
||||
if (id.includes("5.2")) return Object.fromEntries([...WIDELY_SUPPORTED_EFFORTS, "xhigh"].map((effort) => [effort, { reasoning: { effort } }]))
|
||||
return Object.fromEntries(WIDELY_SUPPORTED_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
||||
}
|
||||
|
||||
// When using openai-compatible SDK with Claude/Anthropic models,
|
||||
// we must use snake_case (budget_tokens) as the SDK doesn't convert parameter names
|
||||
// and the OpenAI-compatible API spec uses snake_case
|
||||
|
||||
Reference in New Issue
Block a user