Disconnect an AI provider key

SDK platic.aiProviders.disconnect()

Stop using the provider key, remove its authorization, and delete the secret created when it was connected. The provider returns to not_connected, and agents use Platica's account again.

Example

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

Path parameters

ParameterTypeDescriptionRequired
providerstringopenai, google, anthropic, or xai✓

Response

200 OK with the provider now without a key, in the shape of list AI providers.

{
  "status": "success",
  "message": "Key disconnected",
  "data": {
    "provider": "openai",
    "name": "OpenAI",
    "status": "not_connected",
    "health": null,
    "fallback": null,
    "lastVerifiedAt": null,
    "lastError": null,
    "secretName": null,
    "models": [
      { "id": "gpt-6.1-sol", "name": "GPT-6.1 Sol", "status": "unverified", "code": null, "ownKeyOnly": false },
      { "id": "gpt-6.1-terra", "name": "GPT-6.1 Terra", "status": "unverified", "code": null, "ownKeyOnly": false },
      { "id": "gpt-6-luna", "name": "GPT-6 Luna", "status": "unverified", "code": null, "ownKeyOnly": false }
    ]
  }
}

Errors

Statusdetails.codeWhen it happens
400INVALID_PROVIDER{provider} is not one of the four
403FORBIDDENThe person behind the token cannot manage secrets

Notes

  • The secret that created the connection is deleted (for example, OpenAI key): its encrypted value disappears and cannot be recovered. If you renamed it or another integration uses it, it stays in Secrets without authorization for the provider; delete it if it is no longer useful.
  • Disconnecting a provider without a key changes nothing and answers the same.
  • From an AI agent, the tool is disconnect_ai_provider.