Resolve authentication diagnostics by provider

This commit is contained in:
2026-11-22 18:16:13 +00:00
parent adc700f96e
commit ca8cf1b827
10 changed files with 123 additions and 38 deletions

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
@@ -26,8 +27,11 @@ func OpenRouterKeyEndpoint(base string) (string, error) {
return url.JoinPath(base, "key")
}
// ProbeOpenRouterKey executes and interprets an OpenRouter key request.
func (c *OpenAICompatibleClient) ProbeOpenRouterKey(ctx context.Context, endpoint string, timeoutSeconds int, target domain.ExecutionTarget) (AuthenticationEvidence, error) {
// ProbeAuthentication executes the selected authentication adapter.
func (c *OpenAICompatibleClient) ProbeAuthentication(ctx context.Context, adapter, endpoint string, timeoutSeconds int, target domain.ExecutionTarget) (AuthenticationEvidence, error) {
if !SupportedAuthenticationAdapter(adapter) {
return AuthenticationEvidence{}, fmt.Errorf("unsupported authentication adapter %q", adapter)
}
parsed, err := url.Parse(endpoint)
if err != nil {
return AuthenticationEvidence{}, err