File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 - name : Run tests
2323 run : cargo test --verbose
2424 env :
25+ BROWSERBASE_API_URL : ${{ secrets.BROWSERBASE_API_URL }}
2526 STAGEHAND_API_URL : ${{ secrets.STAGEHAND_API_URL }}
2627 BROWSERBASE_API_KEY : ${{ secrets.BROWSERBASE_API_KEY }}
2728 BROWSERBASE_PROJECT_ID : ${{ secrets.BROWSERBASE_PROJECT_ID }}
Original file line number Diff line number Diff line change @@ -179,8 +179,9 @@ GROQ_API_KEY=your_groq_key # Groq
179179CEREBRAS_API_KEY=your_cerebras_key # Cerebras
180180DEEPSEEK_API_KEY=your_deepseek_key # DeepSeek
181181
182- # Optional: Custom Stagehand API URL (defaults to https://api.stagehand.browserbase.com/v1)
183- STAGEHAND_API_URL=https://api.stagehand.browserbase.com/v1
182+ # Optional: Custom API URLs
183+ STAGEHAND_API_URL=https://api.stagehand.browserbase.com/v1 # Stagehand API (default)
184+ BROWSERBASE_API_URL=https://api.browserbase.com/v1 # Browserbase API (default)
184185```
185186
186187The SDK checks for model API keys in the order listed above and uses the first one found.
Original file line number Diff line number Diff line change @@ -271,6 +271,9 @@ pub struct V3Options {
271271/// Default Stagehand API URL
272272pub const DEFAULT_STAGEHAND_API_URL : & str = "https://api.stagehand.browserbase.com/v1" ;
273273
274+ /// Default Browserbase API URL
275+ pub const DEFAULT_BROWSERBASE_API_URL : & str = "https://api.browserbase.com/v1" ;
276+
274277/// Transport selection for connecting to Stagehand API
275278#[ derive( Debug , Clone , PartialEq ) ]
276279pub enum TransportChoice {
@@ -1032,9 +1035,12 @@ impl Stagehand {
10321035 let api_key = std:: env:: var ( "BROWSERBASE_API_KEY" )
10331036 . map_err ( |_| StagehandError :: MissingApiKey ( "BROWSERBASE_API_KEY" . to_string ( ) ) ) ?;
10341037
1038+ let browserbase_api_url = std:: env:: var ( "BROWSERBASE_API_URL" )
1039+ . unwrap_or_else ( |_| DEFAULT_BROWSERBASE_API_URL . to_string ( ) ) ;
1040+
10351041 let client = reqwest:: Client :: new ( ) ;
10361042 let response = client
1037- . get ( format ! ( "https://api.browserbase.com/v1/ sessions/{}" , session_id) )
1043+ . get ( format ! ( "{}/ sessions/{}" , browserbase_api_url , session_id) )
10381044 . header ( "x-bb-api-key" , & api_key)
10391045 . send ( )
10401046 . await
You can’t perform that action at this time.
0 commit comments