on main help sign in
Merge pull request #352 from charmbracelet/fix_providers

chore: fix custom headers and system prefix

commit10500051bf92a13507751fa68b1a9b154afbb3e2 authorKujtim Hoxha <kujtimii.h@gmail.com> dateWed 30 Jul 2025, 16:06 (1 year ago) parent287fc2054bf4a6
2 files changed+13−12
internal/config/load.go+11−10 internal/llm/provider/anthropic.go+2−2
internal/config/load.go+11−10
@@ -145,16 +145,17 @@ func (c *Config) configureProviders(env env.Env, resolver VariableResolver, know
145145 maps.Copy(headers, config.ExtraHeaders)
146146 }
147147 prepared := ProviderConfig{
148− ID: string(p.ID),
149− Name: p.Name,
150− BaseURL: p.APIEndpoint,
151− APIKey: p.APIKey,
152− Type: p.Type,
153− Disable: config.Disable,
154− ExtraHeaders: headers,
155− ExtraBody: config.ExtraBody,
156− ExtraParams: make(map[string]string),
157− Models: p.Models,
148+ ID: string(p.ID),
149+ Name: p.Name,
150+ BaseURL: p.APIEndpoint,
151+ APIKey: p.APIKey,
152+ Type: p.Type,
153+ Disable: config.Disable,
154+ SystemPromptPrefix: config.SystemPromptPrefix,
155+ ExtraHeaders: headers,
156+ ExtraBody: config.ExtraBody,
157+ ExtraParams: make(map[string]string),
158+ Models: p.Models,
158159 }
159160
160161 switch p.ID {
internal/llm/provider/anthropic.go+2−2
@@ -70,8 +70,8 @@ func createAnthropicClient(opts providerClientOptions, useBedrock bool) anthropi
7070 if useBedrock {
7171 anthropicClientOptions = append(anthropicClientOptions, bedrock.WithLoadDefaultConfig(context.Background()))
7272 }
73− for _, header := range opts.extraHeaders {
74− anthropicClientOptions = append(anthropicClientOptions, option.WithHeaderAdd(header, opts.extraHeaders[header]))
73+ for key, header := range opts.extraHeaders {
74+ anthropicClientOptions = append(anthropicClientOptions, option.WithHeaderAdd(key, header))
7575 }
7676 for key, value := range opts.extraBody {
7777 anthropicClientOptions = append(anthropicClientOptions, option.WithJSONSet(key, value))