Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions stagehand/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ def __init__(

# Handle non-config parameters
self.api_url = self.config.api_url
if not self.api_url:
raise ValueError(
"api_url is not set. Please set StagehandConfig.api_url "
"or the STAGEHAND_API_URL environment variable."
)

if not self.api_url.startswith(("http://", "https://")):
raise ValueError(
f"Invalid api_url: {self.api_url}. Must start with http:// or https://"
)

self.model_api_key = self.config.model_api_key or os.getenv("MODEL_API_KEY")
self.model_name = self.config.model_name

Expand Down