Verifies API key setup via environment variables and checks basic API connectivity for specified LLM providers (Google, OpenAI, Anthropic). Provides informative messages and returns results invisibly.
Usage
sitrep(orgs = c("google", "openai", "anthropic"), verbose = TRUE)
Value
(Invisibly) A named list summarizing the check results for each requested provider. Each element in the list corresponds to a provider and contains another list with two logical elements:
key_set
TRUE if the expected environment variable for the API key is set and non-empty, FALSE otherwise.
api_ok
TRUE if a basic API call succeeded (typically HTTP 2xx status), FALSE if the API call failed (network error, auth error, timeout, etc.), or NA if the API key was not set (and thus the check was skipped).
Examples
if (FALSE) { # \dontrun{
# Run checks interactively (messages print, result list doesn't auto-print)
sitrep()
# Capture the results programmatically
check_results <- sitrep(verbose = FALSE) # Quieter run
if (!isTRUE(check_results$openai$key_set)) {
message("OpenAI key not found. See ?sitrep for setup help.")
}
print(check_results) # Explicitly print the captured list
# Check only Anthropic
anthropic_status <- sitrep("anthropic")
} # }