From 7796a677a27af43abc92969df6d1023a33798be0 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Sun, 26 Jul 2026 17:29:41 +0000 Subject: [PATCH] feat: add OpenAI Codex provider metadata --- packages/core/src/schema.ts | 2 +- packages/core/test/schema.test.ts | 18 +++++++++++++++++- providers/openai-codex/logo.svg | 3 +++ providers/openai-codex/models/gpt-5.5.toml | 13 +++++++++++++ .../openai-codex/models/gpt-5.6-luna.toml | 14 ++++++++++++++ providers/openai-codex/models/gpt-5.6-sol.toml | 14 ++++++++++++++ .../openai-codex/models/gpt-5.6-terra.toml | 14 ++++++++++++++ providers/openai-codex/provider.toml | 9 +++++++++ 8 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 providers/openai-codex/logo.svg create mode 100644 providers/openai-codex/models/gpt-5.5.toml create mode 100644 providers/openai-codex/models/gpt-5.6-luna.toml create mode 100644 providers/openai-codex/models/gpt-5.6-sol.toml create mode 100644 providers/openai-codex/models/gpt-5.6-terra.toml create mode 100644 providers/openai-codex/provider.toml diff --git a/packages/core/src/schema.ts b/packages/core/src/schema.ts index d4816e8a200..4d510afb520 100644 --- a/packages/core/src/schema.ts +++ b/packages/core/src/schema.ts @@ -347,7 +347,7 @@ export type Model = z.infer; export const Provider = z .object({ id: z.string(), - env: z.array(z.string()).min(1, "Provider env cannot be empty"), + env: z.array(z.string()), npm: z.string().min(1, "Provider npm module cannot be empty"), api: z.string().optional(), name: z.string().min(1, "Provider name cannot be empty"), diff --git a/packages/core/test/schema.test.ts b/packages/core/test/schema.test.ts index 26ea791c1da..f414c747082 100644 --- a/packages/core/test/schema.test.ts +++ b/packages/core/test/schema.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "bun:test"; import { z } from "zod"; -import { AuthoredModel } from "../src/index.js"; +import { AuthoredModel, Provider } from "../src/index.js"; type AuthoredModelData = z.infer; @@ -31,6 +31,22 @@ describe("model schema", () => { }); }); +describe("provider schema", () => { + test("accepts OAuth-only providers without environment credentials", () => { + expect( + Provider.safeParse({ + id: "openai-codex", + name: "OpenAI Codex", + env: [], + npm: "@ai-sdk/openai", + api: "https://chatgpt.com/backend-api/codex", + doc: "https://github.com/openai/codex", + models: {}, + }).success, + ).toBe(true); + }); +}); + function baseModel(overrides: Partial) { return { id: "example/model", diff --git a/providers/openai-codex/logo.svg b/providers/openai-codex/logo.svg new file mode 100644 index 00000000000..296aa7ef6c2 --- /dev/null +++ b/providers/openai-codex/logo.svg @@ -0,0 +1,3 @@ + + + diff --git a/providers/openai-codex/models/gpt-5.5.toml b/providers/openai-codex/models/gpt-5.5.toml new file mode 100644 index 00000000000..4fd211a222a --- /dev/null +++ b/providers/openai-codex/models/gpt-5.5.toml @@ -0,0 +1,13 @@ +# Codex exposes a 272K usable input window for GPT-5.5. The 400K total keeps +# the model's separate 128K output allowance explicit. +# https://github.com/anomalyco/models.dev/issues/3183 +base_model = "openai/gpt-5.5" +reasoning_options = [{ type = "effort", values = ["none", "low", "medium", "high", "xhigh"] }] + +[limit] +context = 400_000 +input = 272_000 +output = 128_000 + +[experimental.modes.fast] +provider = { body = { service_tier = "priority" } } diff --git a/providers/openai-codex/models/gpt-5.6-luna.toml b/providers/openai-codex/models/gpt-5.6-luna.toml new file mode 100644 index 00000000000..831f854d129 --- /dev/null +++ b/providers/openai-codex/models/gpt-5.6-luna.toml @@ -0,0 +1,14 @@ +# OpenAI corrected the Codex GPT-5.6 window to 272K in 0.144.6. The 400K total +# keeps the model's separate 128K output allowance explicit. +# https://github.com/openai/codex/releases/tag/rust-v0.144.6 +# https://github.com/openai/codex/blob/rust-v0.145.0/codex-rs/models-manager/models.json +base_model = "openai/gpt-5.6-luna" +reasoning_options = [{ type = "effort", values = ["none", "low", "medium", "high", "xhigh", "max"] }] + +[limit] +context = 400_000 +input = 272_000 +output = 128_000 + +[experimental.modes.fast] +provider = { body = { service_tier = "priority" } } diff --git a/providers/openai-codex/models/gpt-5.6-sol.toml b/providers/openai-codex/models/gpt-5.6-sol.toml new file mode 100644 index 00000000000..d28bab0659d --- /dev/null +++ b/providers/openai-codex/models/gpt-5.6-sol.toml @@ -0,0 +1,14 @@ +# OpenAI corrected the Codex GPT-5.6 window to 272K in 0.144.6. The 400K total +# keeps the model's separate 128K output allowance explicit. +# https://github.com/openai/codex/releases/tag/rust-v0.144.6 +# https://github.com/openai/codex/blob/rust-v0.145.0/codex-rs/models-manager/models.json +base_model = "openai/gpt-5.6-sol" +reasoning_options = [{ type = "effort", values = ["none", "low", "medium", "high", "xhigh", "max"] }] + +[limit] +context = 400_000 +input = 272_000 +output = 128_000 + +[experimental.modes.fast] +provider = { body = { service_tier = "priority" } } diff --git a/providers/openai-codex/models/gpt-5.6-terra.toml b/providers/openai-codex/models/gpt-5.6-terra.toml new file mode 100644 index 00000000000..07d0cf5a6ca --- /dev/null +++ b/providers/openai-codex/models/gpt-5.6-terra.toml @@ -0,0 +1,14 @@ +# OpenAI corrected the Codex GPT-5.6 window to 272K in 0.144.6. The 400K total +# keeps the model's separate 128K output allowance explicit. +# https://github.com/openai/codex/releases/tag/rust-v0.144.6 +# https://github.com/openai/codex/blob/rust-v0.145.0/codex-rs/models-manager/models.json +base_model = "openai/gpt-5.6-terra" +reasoning_options = [{ type = "effort", values = ["none", "low", "medium", "high", "xhigh", "max"] }] + +[limit] +context = 400_000 +input = 272_000 +output = 128_000 + +[experimental.modes.fast] +provider = { body = { service_tier = "priority" } } diff --git a/providers/openai-codex/provider.toml b/providers/openai-codex/provider.toml new file mode 100644 index 00000000000..55184589528 --- /dev/null +++ b/providers/openai-codex/provider.toml @@ -0,0 +1,9 @@ +# ChatGPT subscription models served by the Codex backend use limits that differ +# from direct OpenAI API access. This provider intentionally has no API-key env. +# https://github.com/openai/codex/releases/tag/rust-v0.144.6 +# https://github.com/openai/codex/blob/rust-v0.145.0/codex-rs/models-manager/models.json +name = "OpenAI Codex" +env = [] +npm = "@ai-sdk/openai" +doc = "https://github.com/openai/codex" +api = "https://chatgpt.com/backend-api/codex"