Fix `Client(model_api_key=...)` and remove `OPENAI_API_KEY`/`MODEL_API_KEY` env var auto loading

Merged
PI
7mo ago
+242-105
  • removes auto loading of AI api keys from env in favor of explicit constructor params only
  • removes explicit openai_api_key param in favor of only model_api_key
  • fixes propagation of BROWSERBASE_FLOW_LOGS/BROWSERBASE_CONFIG_DIR to 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_KEY or provider env vars; header is sent only if model_api_key is set.
    • Local mode sets MODEL_API_KEY for the SEA process from model_api_key (or empty), never infers from OPENAI_API_KEY, and forwards BROWSERBASE_FLOW_LOGS/BROWSERBASE_CONFIG_DIR.
    • SEA child env masks inherited MODEL_API_KEY while leaving unrelated env (like OPENAI_API_KEY) intact.
    • SEA child always runs with NODE_ENV=production to avoid dev-only dependency issues.
    • .github/publish-pypi.yml and scripts/download-binary.py select the highest stable stagehand-server-v3/vX.Y.Z release and ignore dev/pre-release tags; binary cache version defaults to the Python package version when STAGEHAND_VERSION is unset.
  • Migration

    • Pass model_api_key explicitly if you need LLM auth; env vars are no longer auto-read.
    • Remove local_openai_api_key; use model_api_key instead (examples updated).