feat: Codex OpenAI API key and base URL overrides from Settings#1174
feat: Codex OpenAI API key and base URL overrides from Settings#1174sohamnandi77 wants to merge 1 commit intopingdotgg:mainfrom
Conversation
- Introduced CodexOpenAiEnvOverrides service to manage OpenAI API key and base URL. - Updated CodexAdapter to utilize OpenAI environment overrides during session initialization. - Enhanced server and client layers to integrate CodexOpenAiEnvOverrides. - Added UI components for configuring OpenAI API key and base URL in app settings. - Implemented WebSocket methods for setting OpenAI environment variables.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
What Changed
CodexOpenAiEnvOverridesservice that holds optionalOPENAI_API_KEYandOPENAI_BASE_URLoverrides. These are passed into the Codex app-server process environment when starting a session, so users can point Codex at a different API endpoint or use a different key without changing system env.codexSetOpenAiEnvso the web app can push overrides to the server; the server does not persist the API key.https://api.openai.com/v1) and OPENAI_API_KEY. Values are stored on the device only and synced to the server on change (debounced). Copy updated to say these settings let you “customize how Codex connects.”CodexSetOpenAiEnvInput/CodexSetOpenAiEnvResultschemas andNativeApi.server.setCodexOpenAiEnvfor desktop/web.Why
Users need to use custom OpenAI-compatible endpoints or keys (e.g. proxy, different region, or alternate provider). Today that requires setting env vars before starting T3 Code. This keeps behavior predictable (overrides apply only to new sessions, API key not stored server-side) while making it configurable from the UI.
UI Changes
Before
After
Checklist
Note
Add Codex OpenAI API key and base URL overrides via Settings UI and WebSocket API
CodexOpenAiEnvOverridesservice (CodexOpenAiEnvOverrides.ts) that stores API key and base URL overrides in an in-memoryRefon the server.codex.setOpenAiEnvWebSocket method (ws.ts) so clients can update overrides at runtime; the server handler is wired in wsServer.ts.OPENAI_BASE_URLandOPENAI_API_KEY; values are persisted in app settings and synced to the server via a newCodexOpenAiEnvSynccomponent in __root.tsx.OPENAI_API_KEY/OPENAI_BASE_URLenv vars to the spawnedcodex app-serverchild process.OPENAI_API_KEYandOPENAI_BASE_URLset via the Settings UI will override any ambient env vars inherited by the child process for each new session.Macroscope summarized 9317ef8.