Skip to content

Migrate templates to Model Gateway — remove separate model API keys, bump SDKs#76

Merged
jay-sahnan merged 7 commits into
devfrom
jaysahnan/gro-1197-convert-templates-to-use-model-gateway
Apr 7, 2026
Merged

Migrate templates to Model Gateway — remove separate model API keys, bump SDKs#76
jay-sahnan merged 7 commits into
devfrom
jaysahnan/gro-1197-convert-templates-to-use-model-gateway

Conversation

@jay-sahnan
Copy link
Copy Markdown
Contributor

@jay-sahnan jay-sahnan commented Mar 31, 2026

Why

Model Gateway launches April 2nd, routing LLM requests through Browserbase so users only need their BROWSERBASE_API_KEY. No more juggling separate OpenAI/Anthropic/Google keys per template.

What

  • TypeScript (5 files): Collapsed model: { modelName, apiKey } objects to model: "string"
  • Python (~27 files): Removed model_api_key parameter from Stagehand/AsyncStagehand/StagehandConfig constructors, including variable declarations and validation blocks
  • SDK bumps: @browserbasehq/stagehand^3.1.0, stagehand (Python) → >=3.19.0, browserbase (Python) → >=1.7.0
  • .env.example files (~16): Removed model API key entries
  • READMEs (~40): Removed model key setup instructions, error messages, and pitfall entries. Added Model Gateway section to root README.
  • Error messages/comments (~30 files): Removed "Verify OPENAI_API_KEY" / "Verify GOOGLE_API_KEY" hints from catch blocks

Notes

  • CUA templates excluded: gemini-cua, company-address-finder, business-lookup, microsoft-cua — CUA models are not supported by Model Gateway at launch
  • Other exclusions: cerebras-docs-checker (unsupported provider), go/hackernews (Go SDK not in scope)
  • cartesia-form-filling: Removed Stagehand model_api_key but kept GEMINI_API_KEY for its separate genai.Client (non-Stagehand usage)
  • Pre-existing ruff lint errors in amazon-global-price-comparison, exa-browserbase, sec-filing-research were fixed as part of this PR since the linter runs on all staged .py file

Note

Medium Risk
Broad, cross-template changes plus SDK version bumps could break example runtimes if any template still relies on removed model_api_key/project ID wiring or older Stagehand/Browserbase APIs.

Overview
Updates templates to use Browserbase Model Gateway so most examples only require BROWSERBASE_API_KEY, removing MODEL_API_KEY/provider-key setup, validation, and troubleshooting text across Python/TypeScript/Go templates.

Refactors Stagehand client initialization accordingly (dropping model_api_key and often browserbase_project_id arguments, and collapsing TS model config to a routed model string), and bumps dependencies (stagehand>=3.19.0, browserbase>=1.7.0, and TS packages to newer/latest versions). Root README.md adds a Model Gateway section and notes that CUA models remain excluded and still require provider keys.

Reviewed by Cursor Bugbot for commit a90a164. Bugbot is set up for automated code reviews on this repo. Configure here.

@@ -1,7 +1,3 @@
# Browserbase credentials - get these from https://www.browserbase.com/settings
BROWSERBASE_API_KEY=your_browserbase_api_key
BROWSERBASE_PROJECT_ID=your_browserbase_project_id
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we no longer need project_id right? or is python not the same?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 548cc58. Configure here.

" (starts with /dp/ or https://)"
" Only extract actual product listings, skip sponsored"
" ads or recommendations."
),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prompt newlines lost in string reformatting

Medium Severity

The extract instruction was refactored from a triple-quoted f-string (with newlines between each numbered item) to concatenated string literals, which silently strips all newlines. The old prompt had each extraction field on its own line with a blank line before the "Only extract…" closing note; the new version joins everything into one continuous line. This makes the numbered list significantly harder for the LLM to parse and may reduce extraction quality.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 548cc58. Configure here.

- Tailor responses to align with job requirements when available
- Craft thoughtful responses that highlight relevant experience/skills
- For cover letter or "why interested" fields, reference specific aspects of the job/company

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line added to agent system prompt

Low Severity

A blank line was inserted into AGENT_SYSTEM_PROMPT between the "For cover letter…" and "For location/relocation…" bullet points during reformatting. The original prompt had these as consecutive items in a single bullet list. This changes the actual prompt content sent to the LLM, likely unintentionally since this PR's goal was removing API keys, not modifying prompts.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 548cc58. Configure here.

Copy link
Copy Markdown
Member

@Kylejeong2 Kylejeong2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-approving

@jay-sahnan jay-sahnan merged commit 7cf4107 into dev Apr 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants