feat: Make model api key optional on API

Closed
CH
8mo ago
+143-10

why

what changed

test plan


Summary by cubic

Make the model API key optional in StagehandAPIClient.init() so sessions can start without providing a key. When a key is provided, behavior is unchanged and the header is sent.

  • Bug Fixes
    • Remove the init() error and make modelApiKey optional.
    • Send x-model-api-key and include model apiKey only when a key is present.
    • Add unit tests to verify both with-key and no-key flows.