-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add native OpenAI provider support for Codex Mini model (#5386) #6931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add codex-mini-latest model definition with proper pricing (.5/M input, /M output) - Implement support using existing v1/responses endpoint infrastructure (same as GPT-5) - Add comprehensive test coverage for streaming and non-streaming modes - Handle Codex Mini specific request format (instructions + input) - Reuse GPT-5's SSE parsing logic for efficient implementation Closes #5386
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! I've reviewed the changes and found some issues that need attention. The implementation looks solid overall, with good test coverage and proper integration with the existing responses API infrastructure.
| contextWindow: 200_000, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 1.5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pricing values here (1.5 and 6) appear to be correct based on issue #5386, but the PR description mentions '.5/M' and '/M' which could be confusing. Could you clarify if these are the correct values? The issue mentions these are the actual numeric values without dollar signs.
| inputPrice: 1.5, | ||
| outputPrice: 6, | ||
| cacheReadsPrice: 0, | ||
| description: "Codex Mini: Optimized coding model using v1/responses endpoint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description could be more detailed about the model's specific capabilities and limitations. For example, mentioning that it's optimized for code generation tasks, the free tier availability, or any specific use cases it excels at.
| delete global.fetch | ||
| }) | ||
|
|
||
| describe("Codex Mini Model", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great test coverage! However, it would be valuable to add integration tests that mock at a higher level (e.g., testing the full flow from API handler to response). This would catch issues with the integration between different components.
- Add codex-mini-latest model definition with pricing (.5/M input, /M output) - Reuse existing v1/responses endpoint infrastructure (same as GPT-5) - Add isResponsesApiModel() method to identify models using responses endpoint - Rename handleGpt5Message to handleResponsesApiMessage for clarity - Add comprehensive test coverage for Codex Mini - Fix error handling in GPT-5 stream handler to properly re-throw API errors - Use generic 'Responses API' error messages since both models share the endpoint The implementation keeps the GPT-5 path completely unchanged while allowing Codex Mini to reuse the same infrastructure with minimal code changes.
3740319 to
737d70d
Compare
…ructure - Removed handleCodexMiniWithResponsesApi method as Codex Mini should behave exactly like GPT-5 - Both models now use the same v1/responses endpoint format - Updated tests to reflect unified behavior - Addresses review feedback about including all messages in conversation context
…ort support - Removed unreachable GPT-5 specific code in completePrompt method - Updated getModel to apply reasoning effort to all responses API models (GPT-5 and Codex Mini) - Both models now properly support reasoning effort and verbosity through the responses API
Updated description to reflect that Codex Mini is powered by codex-1, a version of o3 optimized for software engineering tasks with reinforcement learning training
Summary
This PR adds support for the
codex-mini-latestmodel in the OpenAI Native provider, which uses OpenAI's v1/responses endpoint.Key Implementation Details:
Reuses GPT-5 infrastructure: Since both GPT-5 and Codex Mini use the same v1/responses endpoint, we've refactored the code to share the same infrastructure, reducing code duplication and maintenance overhead.
Unified responses API handling: Created a common
isResponsesApiModel()method to identify models that use the v1/responses endpoint, making it easy to add more such models in the future.Token Estimation: Uses the established pattern of
length / 4for token estimation (approximately 4 characters per token), consistent with other parts of the codebase.Comprehensive Testing: Added 5 new test cases covering streaming, non-streaming, error handling, and edge cases.
Related GitHub Issue
Closes: #5386
Test Procedure
Automated Testing:
Manual Testing Steps:
Pre-Submission Checklist
Additional Notes
Important
Adds support for Codex Mini model in OpenAI Native provider, sharing infrastructure with GPT-5 models and introducing comprehensive tests.
codex-mini-latestmodel inopenai-native.ts, using the v1/responses endpoint.isResponsesApiModel()to identify models using the v1/responses endpoint.completePrompt()throws error forcodex-mini-latest, directing to usecreateMessage().codex-mini-latestinopenai-native.spec.ts, covering streaming, non-streaming, error handling, and multiple user messages.handleGpt5Message()tohandleResponsesApiMessage()inopenai-native.tsfor shared use by GPT-5 and Codex Mini.This description was created by
for 7c3fd1f. You can customize this summary. It will automatically update as commits are pushed.