@@ -508,7 +508,7 @@ func (c *ProviderConfig) TestConnection(resolver VariableResolver) error {
508 if baseURL == "" {
508 if baseURL == "" {
509 baseURL = "https://api.openai.com/v1"
509 baseURL = "https://api.openai.com/v1"
511− if c.ID == "openrouter" {
511+ if c.ID == string(catwalk.InferenceProviderOpenRouter) {
512 testURL = baseURL + "/credits"
512 testURL = baseURL + "/credits"
514 testURL = baseURL + "/models"
514 testURL = baseURL + "/models"
@@ -546,8 +546,15 @@ func (c *ProviderConfig) TestConnection(resolver VariableResolver) error {
546 if err != nil {
546 if err != nil {
547 return fmt.Errorf("failed to create request for provider %s: %w", c.ID, err)
547 return fmt.Errorf("failed to create request for provider %s: %w", c.ID, err)
549+ if c.ID == string(catwalk.InferenceProviderZAI) {
550+ if b.StatusCode == http.StatusUnauthorized {
551+ // for z.ai just check if the http response is not 401
552+ return fmt.Errorf("failed to connect to provider %s: %s", c.ID, b.Status)
549− if b.StatusCode != http.StatusOK {
555+ if b.StatusCode != http.StatusOK {
550− return fmt.Errorf("failed to connect to provider %s: %s", c.ID, b.Status)
556+ return fmt.Errorf("failed to connect to provider %s: %s", c.ID, b.Status)
552 _ = b.Body.Close()
559 _ = b.Body.Close()
553 return nil
560 return nil