Documentation
¶
Overview ¶
Package providerping does the minimum possible real check of whether a configured provider account is actually reachable and authorized right now — a "list models" call (the same convention nearly every one of these APIs supports), never a real completion request. It exists so the CLI's accounts screen can show a real, current status instead of just "a key is set" — a key can be present and still be rate-limited, revoked, or pointed at a provider having an outage, and a chat request is the only way to actually find that out before this existed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListModels ¶ added in v0.4.0
ListModels queries baseURL's OpenAI-compatible "/models" endpoint and returns the model IDs it advertises, sorted — the exact same request Ping's "openai-compat" branch already makes for a connectivity check, just reading the body instead of discarding it. Lets a caller (the CLI's custom-provider form) offer a real, currently-available model to pick from instead of asking the user to type one by hand and find out later, at the first real turn, whether they got it right. apiKey may be empty for a no-auth local/LAN server, matching buildPingRequest's own "openai-compat" convention.
Types ¶
type Result ¶
type Result struct {
Status Status
Latency time.Duration
// Detail is a short, human-readable explanation — empty for a clean
// StatusOK, set for anything else ("no quota (429)", "invalid
// key", "high latency", ...).
Detail string
}
Result is one provider's current, real status.
func Ping ¶
Ping makes one minimal request against kind's API (anthropic, gemini, openai-compat, or openai-responses) using apiKey, and classifies the result. baseURL, if empty, uses each kind's public default — the same convention internal/provider's adapters already use. Every kind here has exactly one real auth shape (see internal/oauthflow/anthropic.go's doc comment for why an Anthropic account connected via browser login still ends up with a plain, permanent API key rather than needing a second auth mode here).