@@ -725,7 +725,7 @@ func (c *coordinator) buildAzureProvider(baseURL, apiKey string, headers map[str
725725 return azure.New(opts...)
726726}
727727
728−func (c *coordinator) buildBedrockProvider(headers map[string]string) (fantasy.Provider, error) {
728+func (c *coordinator) buildBedrockProvider(apiKey string, headers map[string]string) (fantasy.Provider, error) {
729729 var opts []bedrock.Option
730730 if c.cfg.Config().Options.Debug {
731731 httpClient := log.NewHTTPClient()
@@ -734,9 +734,13 @@ func (c *coordinator) buildBedrockProvider(headers map[string]string) (fantasy.P
734734 if len(headers) > 0 {
735735 opts = append(opts, bedrock.WithHeaders(headers))
736736 }
737− bearerToken := os.Getenv("AWS_BEARER_TOKEN_BEDROCK")
738− if bearerToken != "" {
739− opts = append(opts, bedrock.WithAPIKey(bearerToken))
737+ switch {
738+ case apiKey != "":
739+ opts = append(opts, bedrock.WithAPIKey(apiKey))
740+ case os.Getenv("AWS_BEARER_TOKEN_BEDROCK") != "":
741+ opts = append(opts, bedrock.WithAPIKey(os.Getenv("AWS_BEARER_TOKEN_BEDROCK")))
742+ default:
743+ // Skip, let the SDK do authentication.
740744 }
741745 return bedrock.New(opts...)
742746}
@@ -824,7 +828,7 @@ func (c *coordinator) buildProvider(providerCfg config.ProviderConfig, model con
824828 case azure.Name:
825829 return c.buildAzureProvider(baseURL, apiKey, headers, providerCfg.ExtraParams)
826830 case bedrock.Name:
827− return c.buildBedrockProvider(headers)
831+ return c.buildBedrockProvider(apiKey, headers)
828832 case google.Name:
829833 return c.buildGoogleProvider(baseURL, apiKey, headers)
830834 case "google-vertex":