fix: ensure gpt-5.2-codex has variants

This commit is contained in:
Aiden Cline
2026-01-09 19:15:50 -06:00
parent e342795bd0
commit b03172d723
2 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
import type { Hooks, PluginInput } from "@opencode-ai/plugin"
import { Log } from "../util/log"
import { OAUTH_DUMMY_KEY } from "../auth"
import { ProviderTransform } from "../provider/transform"
const log = Log.create({ service: "plugin.codex" })
@@ -321,7 +322,7 @@ export async function CodexAuthPlugin(input: PluginInput): Promise<Hooks> {
}
if (!provider.models["gpt-5.2-codex"]) {
provider.models["gpt-5.2-codex"] = {
const model = {
id: "gpt-5.2-codex",
providerID: "openai",
api: {
@@ -337,13 +338,18 @@ export async function CodexAuthPlugin(input: PluginInput): Promise<Hooks> {
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, output: 0, cache: { read: 0, write: 0 } },
limit: { context: 400000, output: 128000 },
status: "active",
status: "active" as const,
options: {},
headers: {},
release_date: "2025-12-18",
variants: {} as Record<string, Record<string, any>>,
}
model.variants = ProviderTransform.variants(model)
provider.models["gpt-5.2-codex"] = model
}
// Zero out costs for Codex (included with ChatGPT subscription)

View File

@@ -318,7 +318,7 @@ export namespace ProviderTransform {
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/openai
if (id === "gpt-5-pro") return {}
const openaiEfforts = iife(() => {
if (id.includes("codex")) return WIDELY_SUPPORTED_EFFORTS
if (id.includes("codex") && !id.includes("5.2")) return WIDELY_SUPPORTED_EFFORTS
const arr = [...WIDELY_SUPPORTED_EFFORTS]
if (id.includes("gpt-5-") || id === "gpt-5") {
arr.unshift("minimal")