feat: support both api_key and apiKey for CUA agent API keys#245
Open
t-anjan wants to merge 1 commit intobrowserbase:mainfrom
Open
feat: support both api_key and apiKey for CUA agent API keys#245t-anjan wants to merge 1 commit intobrowserbase:mainfrom
api_key and apiKey for CUA agent API keys#245t-anjan wants to merge 1 commit intobrowserbase:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
why
api_key(snake_case), e.g. at https://docs.stagehand.dev/v2/basics/agent:uvx create-browser-app --template gemini-cuatemplate also usesapi_key.apiKeyfromconfig.options, so running the generated Gemini example could error with:options={"api_key": ...}was provided.what changed
Anthropic CUA
config.options["api_key"]config.options["apiKey"]ANTHROPIC_API_KEYenv varconfig/config.optionsbeingNone.OpenAI CUA
config.options["api_key"]config.options["apiKey"]OPENAI_API_KEYenv varconfig/config.optionsbeingNone.Google CUA (Gemini)
config.options["api_key"]config.options["apiKey"]GEMINI_API_KEYenv varValueErrorif still missing (same behavior as before).GEMINI_API_KEY, matching the Gemini usage and the generated template.test plan
Generate and run the Gemini example:
uvx create-browser-app --template gemini-cuaoptions={"api_key": os.getenv("GEMINI_API_KEY")}.python main.pyand verify it no longer fails with a missing GEMINI_API_KEY error whenapi_keyis set.Smoke-test Anthropic and OpenAI CUA:
options={"api_key": ...}options={"apiKey": ...}*_API_KEYenv var set, withoptionsomitted.AttributeErroris raised whenconfig/optionsis absent.Summary by cubic
Support both api_key and apiKey for CUA agent API keys and standardize Gemini to GEMINI_API_KEY. Fixes auth errors in the Gemini template and aligns behavior with docs and examples.
Bug Fixes
Migration
Written for commit 45db389. Summary will update automatically on new commits.