OpenProgram Docs

Credential validation

validate_credential in models/listing/credentials.py serves save, verify, connectivity, CLI, TUI rows and setup. Validating never runs a model unless a model is named.

LayerQuestionCostRuns
0 presenceCredential present, not the mask, OAuth unexpired?offlinealways
1 authDid the auth endpoint accept it?one GET, 0 tokensthe normal check
2 modelCan this named model be reached now?one inference pingonly with model=

Probes

KindProvidersLayer-1 probe
openai_bearerevery provider not belowGET {base}/models, Bearer
openrouter_keyopenrouterGET {base}/key; /models is public there; shows balance
anthropic_nativeanthropicGET https://api.anthropic.com/v1/models, x-api-key, anthropic-version: 2023-06-01
anthropic_compatother anthropic-messages providers: minimax, minimax-cnGET {base}/v1/models, same headers, own base URL
google_querygoogleGET …/v1beta/models?key=…&pageSize=1
oauthopenai-codex, gemini-subscription, github-copilot, xai-subscription, opencode, opencode-goCredentialProvider.acquire_sync(pid).status; no network beyond an optional refresh
cloudamazon-bedrock, google-vertex, azure-openai-responsesnot_applicable

Results

OutcomestatusMessage
200, proven usablevalidnone
402, or any 4xx whose body says the credit is spent (checked first, so a 401 CreditsError lands here)valid_no_balanceKey works — account has no balance. Add funds.
401, 403, otherwiseinvalid_credentialKey rejected (HTTP 401). and the provider's own sentence ("This API key has expired"), with anything shaped like a key cut out
429, 5xx, no endpoints, data policy (layer 2)valid_model_unavailableModel X is unavailable right now
Layer 1 200, then another 4xx on the layer-2 test message (a parameter the model refuses)valid_model_unavailable (the key works)Key accepted; the test message failed: HTTP 400. and the provider's sentence
Transport error, ambiguousunknownCouldn't reach the provider. Saved anyway; will validate on first use.
The provider has no address here (a custom provider no longer configured)unknown, key check not_configured; its rows read Provider not set upNo base URL resolvable.
No credentialmissingnone
No key conceptnot_applicablenone

ok and the green chip mean exactly valid. A layer-1 200 proves auth, not balance: only OpenRouter GET /key with credit, a layer-2 ping or a live 200 chat may set the credential's status to ready. A sign-in that is needs_login: openprogram providers login <pid>. A non-JSON 200 from a custom endpoint is not valid.

A provider whose requests use the Responses API is pinged on /responses with max_output_tokens, the way its requests go, not on chat completions.

Surfaces

SurfaceUse
POST /api/configSaves first, then layer 1; a slow provider never blocks saving
POST /api/config/verifySame call with explicit api_key, synchronous
POST /api/providers/{name}/validate, /testLayer 1; {model} adds layer 2
GET /api/providers/auth-statusprovider_auth_status, batch for status rows
Status rowsConfigured (layer 0) and Validated (cached layer 1)

Results are cached 60 s per provider and whether a model was named; use_cache=False or refresh=True bypasses. The secret is never stored or returned. Not a quota dashboard.

Adding a provider

Declare its kind in _kind_for; openai_bearer needs nothing. Anthropic-wire third parties need three things to agree, pinned by test_model_fetch_routing.py:

  • _kind_for returns anthropic_compat
  • catalog/metadata.py default_api_for resolves anthropic-messages
  • listing/fetchers/__init__.py routes to the base-URL-aware Anthropic fetcher

Probe log

models/listing/probe_log.py marks test_provider (connectivity), validate_credential (credential) and fetch_and_normalize (model_list). Requests through safe_http.observing_requests become probe_events rows: provider, kind, method, origin, path (never the query), status or error type, duration. Answered model lists are skipped; a nested probe takes the outer kind. Never counted as usage. Kept 30 days; GET /api/providers/{name}/probes?days=7, newest first. Follows magpie's probelog (yetone/magpie, MIT).

Signature
def validate_credential(provider_id, *, api_key=None, model=None,
                        timeout=15.0, use_cache=True) -> CredentialResult
# CredentialResult: provider_id status ok kind via http_status latency_ms model detail cached

_validate_api_key and test_provider delegate, keeping their return shapes.

Peers
ProjectDesign
OpenClawUI calls models.authStatus: snapshot cached 60 s with refresh: true, validated off usage endpoints; health rollup ok, expiring, expired, missing, static; secrets redacted
opencodeNo check at login; the first request shows a bad key; catalog from models.dev; provider/error.ts maps errors to remedies

Taken: the taxonomy, 60 s cache with refresh, redaction, layering, one message mapper. OpenProgram keeps a save-time indicator, so unlike both it probes explicitly.

Implementation status

Not in place:

  • Fetchers call validate_credential(pid) first, not their own presence checks
  • check_providers() exposes a cached validated

Open:

  • Bulk save: automatic layer 1 or explicit Verify, with throttling
  • Anthropic OAuth token probe headers
  • openai-codex has no auth-only list endpoint (403); the default check is structural, an end-to-end probe is a layer-2 /responses ping

Test matrix, outcome by kind: 200, 401, 402, OpenRouter public /models, missing anthropic-version, OAuth needs_login, layer-2 429, offline, no key.

Credential status

Last updated · 2026-11-25