fix: make it possible to add api key for minimax

Andrey Nering created

It has not good endpoint to validate the API key, so for now we're
skipping it.

Change summary

internal/config/config.go | 10 ++++++++++
1 file changed, 10 insertions(+)

Detailed changes

internal/config/config.go 🔗

@@ -780,6 +780,16 @@ func (c *ProviderConfig) TestConnection(resolver VariableResolver) error {
 		apiKey, _  = resolver.ResolveValue(c.APIKey)
 	)
 
+	switch providerID {
+	case catwalk.InferenceProviderMiniMax:
+		// NOTE: MiniMax has no good endpoint we can use to validate the API key.
+		// Let's at least check the pattern.
+		if !strings.HasPrefix(apiKey, "sk-") {
+			return fmt.Errorf("invalid API key format for provider %s", c.ID)
+		}
+		return nil
+	}
+
 	switch c.Type {
 	case catwalk.TypeOpenAI, catwalk.TypeOpenAICompat, catwalk.TypeOpenRouter:
 		baseURL, _ := resolver.ResolveValue(c.BaseURL)