fix(bedrock): apply base URL override after bedrock.WithConfig

Aleks Clark created

bedrock.WithConfig internally calls option.WithBaseURL with the default
regional endpoint, clobbering any user-provided base_url. Move the
custom base URL append to after the bedrock config block so last-write
wins.

🐨 Generated with Crush

Assisted-by: AWS Claude Opus 4.6 via Crush <crush@charm.land>

Change summary

providers/anthropic/anthropic.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Detailed changes

providers/anthropic/anthropic.go 🔗

@@ -156,7 +156,7 @@ func (a *provider) LanguageModel(ctx context.Context, modelID string) (fantasy.L
 	if a.options.apiKey != "" && !a.options.useBedrock {
 		clientOptions = append(clientOptions, option.WithAPIKey(a.options.apiKey))
 	}
-	if a.options.baseURL != "" {
+	if !a.options.useBedrock && a.options.baseURL != "" {
 		clientOptions = append(clientOptions, option.WithBaseURL(a.options.baseURL))
 	}
 	defaultUA := httpheaders.DefaultUserAgent(fantasy.Version)
@@ -205,6 +205,9 @@ func (a *provider) LanguageModel(ctx context.Context, modelID string) (fantasy.L
 				)
 			}
 		}
+		if a.options.baseURL != "" {
+			clientOptions = append(clientOptions, option.WithBaseURL(a.options.baseURL))
+		}
 	}
 	return languageModel{
 		modelID:  modelID,