Test an AI provider key

SDK platic.aiProviders.verify()

Retest the provider's stored key without sending its value. Use this after adding balance, enabling a model, or resolving a key in the invalid state.

Example

await platic.aiProviders.verify("openai");

Path parameters

ParameterTypeDescriptionRequired
providerstringopenai, google, anthropic, or xai✓

It has no body.

Response

200 OK with the provider after the test, in the shape of list AI providers. message is Key verified if it works, or The key does not work: see lastError if it does not.

{
  "status": "success",
  "message": "The key does not work: see lastError",
  "data": {
    "provider": "openai",
    "name": "OpenAI",
    "status": "invalid",
    "health": "no_credit",
    "fallback": "platform",
    "lastVerifiedAt": "2026-11-13T17:05:00.000Z",
    "lastError": "NO_CREDIT",
    "secretName": "OpenAI key",
    "models": [
      { "id": "gpt-6.1-sol", "name": "GPT-6.1 Sol", "status": "unavailable", "code": "NO_CREDIT", "ownKeyOnly": false },
      { "id": "gpt-6.1-terra", "name": "GPT-6.1 Terra", "status": "unavailable", "code": "NO_CREDIT", "ownKeyOnly": false },
      { "id": "gpt-6-luna", "name": "GPT-6 Luna", "status": "unavailable", "code": "NO_CREDIT", "ownKeyOnly": false }
    ]
  }
}

Errors

Statusdetails.codeWhen it happens
400INVALID_PROVIDER{provider} is not one of the four
403FORBIDDENThe person behind the token cannot use secrets
404PROVIDER_NOT_FOUNDThe provider has no key. Connect it with connect an AI provider key
429VERIFICATION_RATE_LIMITEDThere were already 10 tests of that provider in the last hour
503VERIFICATION_FAILEDThe key could not be tested with the provider. Get the provider before retrying

Notes

  • As when connecting, the test spends a few tokens from your provider account and can take up to 200 seconds.
  • From an AI agent, the tool is verify_ai_provider.