From c7544f7cb99cbd0e474c5a38c456de9b05deffe3 Mon Sep 17 00:00:00 2001 From: uiyzzi Date: Sun, 22 Mar 2026 15:49:25 +0800 Subject: [PATCH] feat(providers): add extra_body config to inject custom fields into request body Allow configuring provider-specific fields like reasoning_split for minimax via the model config's extra_body map. These fields are merged into the request body last, giving them precedence over default values. Co-Authored-By: Claude Opus 4.6 --- pkg/config/config_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 9bd27e5eb..3f8ec6150 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -1207,6 +1207,9 @@ func TestModelConfig_ExtraBodyRoundTrip(t *testing.T) { ExtraBody: map[string]any{"custom_field": "value", "num_field": 42}, }, }, + security: &SecurityConfig{ + ModelList: map[string]ModelSecurityEntry{"test-model:0": {APIKeys: []string{"sk-test"}}}, + }, } if err := SaveConfig(cfgPath, cfg); err != nil { @@ -1228,3 +1231,24 @@ func TestModelConfig_ExtraBodyRoundTrip(t *testing.T) { t.Errorf("ExtraBody[num_field] = %v, want 42", got) } } + +func TestDefaultConfig_MinimaxExtraBody(t *testing.T) { + cfg := DefaultConfig() + + var minimaxCfg *ModelConfig + for i := range cfg.ModelList { + if cfg.ModelList[i].Model == "minimax/MiniMax-M2.5" { + minimaxCfg = cfg.ModelList[i] + break + } + } + if minimaxCfg == nil { + t.Fatal("Minimax model not found in ModelList") + } + if minimaxCfg.ExtraBody == nil { + t.Fatal("Minimax ExtraBody should not be nil") + } + if got, ok := minimaxCfg.ExtraBody["reasoning_split"]; !ok || got != true { + t.Fatalf("Minimax ExtraBody[reasoning_split] = %v, want true", got) + } +}