[STG-1573] Add providerOptions for extensible model auth

Merged
BB
8mo ago
+2646-175

Summary

  • Add providerOptions bag to model config schema for provider-specific auth (Bedrock, Vertex, future providers) without polluting the shared schema with vendor-specific fields
  • Make modelApiKey optional so providers with non-API-key auth (e.g. AWS SigV4) can work without it
  • Server stores modelClientOptions from session start and reuses them on subsequent act/observe/extract/execute calls — SDKs don't need to reimplement this logic
  • Send modelClientOptions (including providerOptions) in the session start request body; server merges stored + per-request config

What this enables

  • Bedrock: pass region, accessKeyId, secretAccessKey, sessionToken via providerOptions
  • Vertex: pass project, location, googleAuthOptions via providerOptions
  • Future providers: any provider with non-standard auth just adds fields to providerOptions — zero schema or server changes needed

Architecture

SDK                          Server                       AI SDK
─────────────────────────    ─────────────────────────    ──────────────
modelClientOptions: {        Stores in session,           createAmazonBedrock({
  apiKey?,                   merges on each request,        apiKey,
  providerOptions: {    ──►  passes to V3 constructor ──►   region,
    region,                                                 accessKeyId,
    accessKeyId,             Server is vendor-agnostic:     secretAccessKey,
    ...                      just passes providerOptions    ...
  }                          through unchanged            })
}

Linked PRs

Testing

image image