on main help sign in
fix: use `Authorization` header for MiniMax (#2269)

Co-authored-by: Greg Slepak <contact@taoeffect.com>

commitac0972b48b4f5d6710fa9cae6680683ba18647a7 authorAndrey Nering <andreynering@users.noreply.github.com> dateFri 20 Feb 2026, 13:44 (8 months ago) parentd699acd
1 file changed+9−4
internal/agent/coordinator.go+9−4
internal/agent/coordinator.go+9−4
@@ -566,14 +566,19 @@ func (c *coordinator) buildAgentModels(ctx context.Context, isSubAgent bool) (Mo
566566 }, nil
567567}
568568
569−func (c *coordinator) buildAnthropicProvider(baseURL, apiKey string, headers map[string]string) (fantasy.Provider, error) {
569+func (c *coordinator) buildAnthropicProvider(baseURL, apiKey string, headers map[string]string, providerID string) (fantasy.Provider, error) {
570570 var opts []anthropic.Option
571571
572− if strings.HasPrefix(apiKey, "Bearer ") {
572+ switch {
573+ case strings.HasPrefix(apiKey, "Bearer "):
573574 // NOTE: Prevent the SDK from picking up the API key from env.
574575 os.Setenv("ANTHROPIC_API_KEY", "")
575576 headers["Authorization"] = apiKey
576− } else if apiKey != "" {
577+ case providerID == string(catwalk.InferenceProviderMiniMax):
578+ // NOTE: Prevent the SDK from picking up the API key from env.
579+ os.Setenv("ANTHROPIC_API_KEY", "")
580+ headers["Authorization"] = "Bearer " + apiKey
581+ case apiKey != "":
577582 // X-Api-Key header
578583 opts = append(opts, anthropic.WithAPIKey(apiKey))
579584 }
@@ -793,7 +798,7 @@ func (c *coordinator) buildProvider(providerCfg config.ProviderConfig, model con
793798 case openai.Name:
794799 return c.buildOpenaiProvider(baseURL, apiKey, headers)
795800 case anthropic.Name:
796− return c.buildAnthropicProvider(baseURL, apiKey, headers)
801+ return c.buildAnthropicProvider(baseURL, apiKey, headers, providerCfg.ID)
797802 case openrouter.Name:
798803 return c.buildOpenrouterProvider(baseURL, apiKey, headers)
799804 case vercel.Name: