Skip to content

allow openai CUA to take in an optional baseURL - #1040

Merged
miguelg719 merged 1 commit into
mainfrom
openai_cua_base_url
Aug 28, 2025
Merged

allow openai CUA to take in an optional baseURL#1040
miguelg719 merged 1 commit into
mainfrom
openai_cua_base_url

Conversation

@miguelg719

Copy link
Copy Markdown
Collaborator

why

OpenAI CUA only defaults to the openai base url api.openai.com/v1

what changed

Parametrized baseURL for openai cua

test plan

@miguelg719
miguelg719 marked this pull request as ready for review August 28, 2025 22:51
@changeset-bot

changeset-bot Bot commented Aug 28, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest 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

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Edit Code Review Bot Settings | Greptile

@miguelg719
miguelg719 merged commit 88d1565 into main Aug 28, 2025
15 checks passed
miguelg719 pushed a commit that referenced this pull request Sep 4, 2025
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>
michaelfp930-WB added a commit to michaelfp930-WB/stagehand that referenced this pull request Jan 12, 2026
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>
felipeofdev-ai pushed a commit to felipeofdev-ai/stagehand that referenced this pull request Aug 4, 2026
# why
OpenAI CUA only defaults to the openai base url `api.openai.com/v1`

# what changed
Parametrized `baseURL` for openai cua

# test plan
felipeofdev-ai pushed a commit to felipeofdev-ai/stagehand that referenced this pull request Aug 4, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants