---
docId: doc_a5d474d3933b4dd5a2ac739f37136a5f
title: Test an AI provider key
description: "Retest a stored key without sending it again."
api:
  group: proveedores-de-ia
  auth: bearer
  operations:
    - operationId: verifyAiProvider
      method: POST
      path: '/v1/ai-providers/{provider}/verify'
      postmanName: Test an AI provider key
---

<script>
  import { Ways } from '$lib/components';
</script>

# Test an AI provider key

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

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X POST https://api.platic.ai/v1/ai-providers/openai/verify \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

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

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `provider` | string | `openai`, `google`, `anthropic`, or `xai` | ✓ |

It has no body.

## Response

`200 OK` with the provider after the test, in the shape of [list AI providers](/api-reference/ai-providers/list#the-provider). `message` is `Key verified` if it works, or `The key does not work: see lastError` if it does not.

```json
{
  "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

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_PROVIDER` | `{provider}` is not one of the four |
| `403` | `FORBIDDEN` | The person behind the token cannot use secrets |
| `404` | `PROVIDER_NOT_FOUND` | The provider has no key. Connect it with [connect an AI provider key](/api-reference/ai-providers/connect-key) |
| `429` | `VERIFICATION_RATE_LIMITED` | There were already 10 tests of that provider in the last hour |
| `503` | `VERIFICATION_FAILED` | The key could not be tested with the provider. [Get the provider](/api-reference/ai-providers/list) 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`](/mcp/tools#ai-providers).
