From a1605062b8617d70868a93e8fbb075a1c74a2107 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 29 Jun 2026 14:29:45 +0800 Subject: [PATCH] feat: add openai-codex managed provider support --- README.md | 5 ++++- provider-registry.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ec49b17..2e177ed 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ You should see: - `xai` - `github-copilot` - `openai` +- `openai-codex` - `openrouter` - `deepseek` - `groq` @@ -199,6 +200,7 @@ Default ports: - `xiaomi-token-plan-ams` → `8809` - `xiaomi-token-plan-sgp` → `8810` - `kimi-coding` → `8811` +- `openai-codex` → `8812` ## Commands @@ -270,6 +272,8 @@ Each provider also has optional port/upstream overrides such as: - `PI_HEADROOM_OPENAI_PORT` - `PI_HEADROOM_OPENAI_UPSTREAM` +- `PI_HEADROOM_OPENAI_CODEX_PORT` +- `PI_HEADROOM_OPENAI_CODEX_UPSTREAM` - `PI_HEADROOM_ANTHROPIC_PORT` - `PI_HEADROOM_ANTHROPIC_UPSTREAM` - `PI_HEADROOM_OPENROUTER_PORT` @@ -285,7 +289,6 @@ These pi providers still need more provider-specific handling and are not yet ma - `cloudflare-ai-gateway` - `cloudflare-workers-ai` - `vercel-ai-gateway` -- `openai-codex` - `opencode` - `opencode-go` - `zai` diff --git a/provider-registry.ts b/provider-registry.ts index cb274aa..986fdce 100644 --- a/provider-registry.ts +++ b/provider-registry.ts @@ -8,6 +8,7 @@ const MANAGED_PROVIDERS = [ "xai", "github-copilot", "openai", + "openai-codex", "anthropic", "openrouter", "deepseek", @@ -257,6 +258,17 @@ const PROVIDER_SPECS: Record = { routedBaseStyle: "openai", extraEnv: OPENAI_FAMILY_ENV, }), + "openai-codex": makeSimpleProviderSpec({ + provider: "openai-codex", + displayName: "OpenAI Codex", + family: "openai", + preferredPortEnv: "PI_HEADROOM_OPENAI_CODEX_PORT", + defaultPreferredPort: 8812, + upstreamEnvKey: "OPENAI_TARGET_API_URL", + defaultUpstream: "https://api.openai.com", + routedBaseStyle: "openai", + extraEnv: OPENAI_FAMILY_ENV, + }), anthropic: makeSimpleProviderSpec({ provider: "anthropic", displayName: "Anthropic",