feat: add direct xAI Grok support

VI
3d ago
+378-81

Why

Allow Stagehand operations and agents to use Grok directly with an xAI API key.

What

Add xAI Responses inference, model validation, TypeScript and Python support, integration/eval key lookup and setup docs. Reject missing credentials and unsupported stop sequences.

How

Validated protocol, extension and Python tests, typechecks, SDK build and docs. Mocked HTTP tests cover credentials, images, structured output and function tool calls. Live inference has not been tested.


Summary by cubic

Adds direct xAI Grok support so Stagehand operations and agents can run with an xAI API key across TypeScript and Python.

  • Routes inference through the Responses API via @ai-sdk/xai; Browserbase Model Gateway does not support xAI.
  • Rejects missing xAI API keys even when a gateway session exists, and rejects stop sequences as unsupported.
  • Adds xai/ model validation and XAI_API_KEY env lookup across the TS/Python SDKs, evals, and docs.
  • Go SDK support is excluded from this PR.