feat: support both api_key and apiKey for CUA agent API keys
#238
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.