allow openai CUA to take in an optional baseURL - #1040
Conversation
🦋 Changeset detectedLatest commit: bda3f60 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Greptile Summary
This PR adds support for an optional baseURL parameter to the OpenAICUAClient class, allowing users to specify custom OpenAI API endpoints instead of being restricted to the default api.openai.com/v1. The implementation follows the same pattern already established by the AnthropicCUAClient, creating consistency across agent clients in the codebase.
The changes involve three key modifications: (1) adding a private baseURL property to the class, (2) extracting the baseURL from clientOptions in the constructor with a fallback to undefined, and (3) conditionally setting it in the OpenAI client configuration only when provided. This approach maintains backward compatibility since the parameter is optional and defaults to undefined, allowing the OpenAI SDK to use its default endpoint when no custom URL is specified.
This enhancement addresses enterprise use cases where requests need to be routed through proxy servers, alternative OpenAI-compatible endpoints, or custom API gateways. The implementation is straightforward and mirrors established patterns in the codebase, ensuring consistency with how other agent clients handle base URL configuration.
PR Description Notes:
- The test plan section is empty and should include details about how the changes were tested
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it adds optional functionality without breaking existing behavior
- Score reflects simple, well-patterned changes that follow existing codebase conventions and maintain backward compatibility
- No files require special attention as the implementation is straightforward and follows established patterns
1 file reviewed, no comments
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/stagehand@2.5.0 ### Minor Changes - [#981](#981) [`8244ab2`](8244ab2) Thanks [@sameelarif](https://github.com/sameelarif)! - Added support for `stagehand.agent` to interact with MCP servers as well as custom tools to be passed in. For more information, reference the [MCP integrations documentation](https://docs.stagehand.dev/best-practices/mcp-integrations) ### Patch Changes - [#959](#959) [`09b5e1e`](09b5e1e) Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - add webvoyager evals - [#1049](#1049) [`e3734b9`](e3734b9) Thanks [@miguelg719](https://github.com/miguelg719)! - Support local MCP server connections - [#1025](#1025) [`be85b19`](be85b19) Thanks [@tkattkat](https://github.com/tkattkat)! - add support for custom baseUrl within openai provider - [#1040](#1040) [`88d1565`](88d1565) Thanks [@miguelg719](https://github.com/miguelg719)! - Allow OpenAI CUA to take in an optional baseURL - [#1046](#1046) [`ab5d6ed`](ab5d6ed) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for gpt-5 in operator agent ## @browserbasehq/stagehand-evals@1.0.9 ### Patch Changes - Updated dependencies \[[`09b5e1e`](09b5e1e), [`e3734b9`](e3734b9), [`8244ab2`](8244ab2), [`be85b19`](be85b19), [`88d1565`](88d1565), [`ab5d6ed`](ab5d6ed)]: - @browserbasehq/stagehand@2.5.0 ## @browserbasehq/stagehand-examples@1.0.9 ### Patch Changes - Updated dependencies \[[`09b5e1e`](09b5e1e), [`e3734b9`](e3734b9), [`8244ab2`](8244ab2), [`be85b19`](be85b19), [`88d1565`](88d1565), [`ab5d6ed`](ab5d6ed)]: - @browserbasehq/stagehand@2.5.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/stagehand@2.5.0 ### Minor Changes - [#981](browserbase/stagehand#981) [`8244ab2`](browserbase/stagehand@8244ab2) Thanks [@sameelarif](https://github.com/sameelarif)! - Added support for `stagehand.agent` to interact with MCP servers as well as custom tools to be passed in. For more information, reference the [MCP integrations documentation](https://docs.stagehand.dev/best-practices/mcp-integrations) ### Patch Changes - [#959](browserbase/stagehand#959) [`09b5e1e`](browserbase/stagehand@09b5e1e) Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - add webvoyager evals - [#1049](browserbase/stagehand#1049) [`e3734b9`](browserbase/stagehand@e3734b9) Thanks [@miguelg719](https://github.com/miguelg719)! - Support local MCP server connections - [#1025](browserbase/stagehand#1025) [`be85b19`](browserbase/stagehand@be85b19) Thanks [@tkattkat](https://github.com/tkattkat)! - add support for custom baseUrl within openai provider - [#1040](browserbase/stagehand#1040) [`88d1565`](browserbase/stagehand@88d1565) Thanks [@miguelg719](https://github.com/miguelg719)! - Allow OpenAI CUA to take in an optional baseURL - [#1046](browserbase/stagehand#1046) [`ab5d6ed`](browserbase/stagehand@ab5d6ed) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for gpt-5 in operator agent ## @browserbasehq/stagehand-evals@1.0.9 ### Patch Changes - Updated dependencies \[[`09b5e1e`](browserbase/stagehand@09b5e1e), [`e3734b9`](browserbase/stagehand@e3734b9), [`8244ab2`](browserbase/stagehand@8244ab2), [`be85b19`](browserbase/stagehand@be85b19), [`88d1565`](browserbase/stagehand@88d1565), [`ab5d6ed`](browserbase/stagehand@ab5d6ed)]: - @browserbasehq/stagehand@2.5.0 ## @browserbasehq/stagehand-examples@1.0.9 ### Patch Changes - Updated dependencies \[[`09b5e1e`](browserbase/stagehand@09b5e1e), [`e3734b9`](browserbase/stagehand@e3734b9), [`8244ab2`](browserbase/stagehand@8244ab2), [`be85b19`](browserbase/stagehand@be85b19), [`88d1565`](browserbase/stagehand@88d1565), [`ab5d6ed`](browserbase/stagehand@ab5d6ed)]: - @browserbasehq/stagehand@2.5.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# why OpenAI CUA only defaults to the openai base url `api.openai.com/v1` # what changed Parametrized `baseURL` for openai cua # test plan
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/stagehand@2.5.0 ### Minor Changes - [browserbase#981](browserbase#981) [`8244ab2`](browserbase@8244ab2) Thanks [@sameelarif](https://github.com/sameelarif)! - Added support for `stagehand.agent` to interact with MCP servers as well as custom tools to be passed in. For more information, reference the [MCP integrations documentation](https://docs.stagehand.dev/best-practices/mcp-integrations) ### Patch Changes - [browserbase#959](browserbase#959) [`09b5e1e`](browserbase@09b5e1e) Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - add webvoyager evals - [browserbase#1049](browserbase#1049) [`e3734b9`](browserbase@e3734b9) Thanks [@miguelg719](https://github.com/miguelg719)! - Support local MCP server connections - [browserbase#1025](browserbase#1025) [`be85b19`](browserbase@be85b19) Thanks [@tkattkat](https://github.com/tkattkat)! - add support for custom baseUrl within openai provider - [browserbase#1040](browserbase#1040) [`88d1565`](browserbase@88d1565) Thanks [@miguelg719](https://github.com/miguelg719)! - Allow OpenAI CUA to take in an optional baseURL - [browserbase#1046](browserbase#1046) [`ab5d6ed`](browserbase@ab5d6ed) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for gpt-5 in operator agent ## @browserbasehq/stagehand-evals@1.0.9 ### Patch Changes - Updated dependencies \[[`09b5e1e`](browserbase@09b5e1e), [`e3734b9`](browserbase@e3734b9), [`8244ab2`](browserbase@8244ab2), [`be85b19`](browserbase@be85b19), [`88d1565`](browserbase@88d1565), [`ab5d6ed`](browserbase@ab5d6ed)]: - @browserbasehq/stagehand@2.5.0 ## @browserbasehq/stagehand-examples@1.0.9 ### Patch Changes - Updated dependencies \[[`09b5e1e`](browserbase@09b5e1e), [`e3734b9`](browserbase@e3734b9), [`8244ab2`](browserbase@8244ab2), [`be85b19`](browserbase@be85b19), [`88d1565`](browserbase@88d1565), [`ab5d6ed`](browserbase@ab5d6ed)]: - @browserbasehq/stagehand@2.5.0
why
OpenAI CUA only defaults to the openai base url
api.openai.com/v1what changed
Parametrized
baseURLfor openai cuatest plan