diff --git a/internal/channel/anthropic_channel.go b/internal/channel/anthropic_channel.go index 6e481c7..52f9482 100644 --- a/internal/channel/anthropic_channel.go +++ b/internal/channel/anthropic_channel.go @@ -115,8 +115,8 @@ func (ch *AnthropicChannel) ValidateKey(ctx context.Context, key string) (bool, } defer resp.Body.Close() - // A 200 OK status code indicates the key is valid and can make requests. - if resp.StatusCode == http.StatusOK { + // Any 2xx status code indicates the key is valid. + if resp.StatusCode >= 200 && resp.StatusCode < 300 { return true, nil } diff --git a/internal/channel/gemini_channel.go b/internal/channel/gemini_channel.go index 9b4103e..0d327af 100644 --- a/internal/channel/gemini_channel.go +++ b/internal/channel/gemini_channel.go @@ -132,8 +132,8 @@ func (ch *GeminiChannel) ValidateKey(ctx context.Context, key string) (bool, err } defer resp.Body.Close() - // A 200 OK status code indicates the key is valid. - if resp.StatusCode == http.StatusOK { + // Any 2xx status code indicates the key is valid. + if resp.StatusCode >= 200 && resp.StatusCode < 300 { return true, nil } diff --git a/internal/channel/openai_channel.go b/internal/channel/openai_channel.go index 650912d..39083c6 100644 --- a/internal/channel/openai_channel.go +++ b/internal/channel/openai_channel.go @@ -113,8 +113,8 @@ func (ch *OpenAIChannel) ValidateKey(ctx context.Context, key string) (bool, err } defer resp.Body.Close() - // A 200 OK status code indicates the key is valid and can make requests. - if resp.StatusCode == http.StatusOK { + // Any 2xx status code indicates the key is valid. + if resp.StatusCode >= 200 && resp.StatusCode < 300 { return true, nil }