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
8 changes: 7 additions & 1 deletion packages/opencode/src/provider/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,12 +877,18 @@ export namespace Provider {
}
}

function normalizeFamily(model: ModelsDev.Model): string {
if (model.id.includes("codex")) return "gpt-codex"
if (model.family === "gpt-codex" && model.id.includes("-chat")) return "gpt-chat"
return model.family ?? ""
}

function fromModelsDevModel(provider: ModelsDev.Provider, model: ModelsDev.Model): Model {
const m: Model = {
id: ModelID.make(model.id),
providerID: ProviderID.make(provider.id),
name: model.name,
family: model.family,
family: normalizeFamily(model),
api: {
id: model.id,
url: model.provider?.api ?? provider.api!,
Expand Down
38 changes: 38 additions & 0 deletions packages/opencode/test/provider/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,44 @@ test("azure/gpt-5.3-codex is backfilled when provider metadata is stale", async
})
})

test("models.dev family normalization keeps chat and codex tracks separate", () => {
const info = Provider.fromModelsDevProvider({
id: "azure",
name: "Azure",
env: ["AZURE_API_KEY"],
npm: "@ai-sdk/azure",
models: {
"gpt-5.3-chat": {
id: "gpt-5.3-chat",
name: "GPT-5.3 Chat",
family: "gpt-codex",
release_date: "2026-03-03",
attachment: true,
reasoning: true,
temperature: false,
tool_call: true,
options: {},
limit: { context: 400000, output: 128000 },
},
"gpt-5.3-codex": {
id: "gpt-5.3-codex",
name: "GPT-5.3 Codex",
family: "gpt-codex",
release_date: "2026-02-24",
attachment: false,
reasoning: true,
temperature: false,
tool_call: true,
options: {},
limit: { context: 400000, output: 128000 },
},
},
})

expect(info.models["gpt-5.3-chat"].family).toBe("gpt-chat")
expect(info.models["gpt-5.3-codex"].family).toBe("gpt-codex")
})

test("provider loaded from config with apiKey option", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
Expand Down
Loading