Skip to content

Commit 88d1565

Browse files
authored
allow openai CUA to take in an optional baseURL (#1040)
# why OpenAI CUA only defaults to the openai base url `api.openai.com/v1` # what changed Parametrized `baseURL` for openai cua # test plan
1 parent ae514f5 commit 88d1565

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changeset/three-windows-fail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
Allow OpenAI CUA to take in an optional baseURL

lib/agent/OpenAICUAClient.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class OpenAICUAClient extends AgentClient {
4141
// Process client options
4242
this.apiKey =
4343
(clientOptions?.apiKey as string) || process.env.OPENAI_API_KEY || "";
44+
this.baseURL = (clientOptions?.baseURL as string) || undefined;
4445
this.organization =
4546
(clientOptions?.organization as string) || process.env.OPENAI_ORG;
4647

@@ -57,6 +58,10 @@ export class OpenAICUAClient extends AgentClient {
5758
apiKey: this.apiKey,
5859
};
5960

61+
if (this.baseURL) {
62+
this.clientOptions.baseURL = this.baseURL;
63+
}
64+
6065
// Initialize the OpenAI client
6166
this.client = new OpenAI(this.clientOptions);
6267
}

0 commit comments

Comments
 (0)