Fix `Client(model_api_key=...)` and remove `OPENAI_API_KEY`/`MODEL_API_KEY` env var auto loading
Merged
PI
7mo ago+242+242+012345678901234567890123456789-105-105-012345678901234567890123456789
- removes auto loading of AI api keys from env in favor of explicit constructor params only
- removes explicit
openai_api_keyparam in favor of onlymodel_api_key - fixes propagation of
BROWSERBASE_FLOW_LOGS/BROWSERBASE_CONFIG_DIRto SEA binary
Summary by cubic
Stop auto-reading model API keys from env. Only send x-model-api-key when model_api_key is provided, set the SEA child MODEL_API_KEY explicitly in local mode, and force production NODE_ENV for the SEA process.
-
Bug Fixes
- Client no longer reads
MODEL_API_KEYor provider env vars; header is sent only ifmodel_api_keyis set. - Local mode sets
MODEL_API_KEYfor the SEA process frommodel_api_key(or empty), never infers fromOPENAI_API_KEY, and forwardsBROWSERBASE_FLOW_LOGS/BROWSERBASE_CONFIG_DIR. - SEA child env masks inherited
MODEL_API_KEYwhile leaving unrelated env (likeOPENAI_API_KEY) intact. - SEA child always runs with
NODE_ENV=productionto avoid dev-only dependency issues. .github/publish-pypi.ymlandscripts/download-binary.pyselect the highest stablestagehand-server-v3/vX.Y.Zrelease and ignore dev/pre-release tags; binary cache version defaults to the Python package version whenSTAGEHAND_VERSIONis unset.
- Client no longer reads
-
Migration
- Pass
model_api_keyexplicitly if you need LLM auth; env vars are no longer auto-read. - Remove
local_openai_api_key; usemodel_api_keyinstead (examples updated).
- Pass