# get_key_status

URL: https://codepanel.ai/docs/mcp-server/get_key_status

The CodePanel MCP tool that shows which AI providers have a working API key on your account, without ever returning a key.

`get_key_status` tells you which AI providers have a working API key on your account, without ever showing a key. Call it before you build or change a panel, or when a review fails for a missing or rejected key. It needs only the `read` scope. It cannot add or fix a key: a person does that in the browser.

## When to call it

- **Before `apply_panel` or `add_reviewer`.** A panel member can only use a provider with a valid key (or credits). `status: "valid"` is what you look for.
- **When `get_panel` shows `callable: false`**, or a review was refused for a key. This shows which provider's key is missing or off.
- **When a member keeps failing.** A key turns `invalid` on its own after repeated failures of a certain kind (see below), and this is where you see it.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |


It only reads: the server marks it `readOnlyHint: true`, so clients that ask before a write can run it without asking.

The tool takes no inputs.

## What it returns

An array with one entry for every provider CodePanel supports, whether or not you have a key for it:

- `provider` and `name`: the id you pass as `provider` to the panel tools, and its label.
- `configured`: `true` when a key is stored.
- `status`: `valid`, `invalid`, or `null` when no key is stored.
- `lastValidatedAt`: when the key was last checked, in milliseconds since 1970, or `null`.
- `lastError`: why the key is `invalid`, or `null`. It is redacted: anything that looks like a key is masked, because some providers echo part of a rejected key.
- `modelCount`: how many models the key reported. [`list_models`](/docs/mcp-server/list_models) lists them.
- `consoleUrl`: where the provider issues keys, for a person to open. It is empty for a custom endpoint.
- `health`: what real calls found since the last test, as `{ status, at }`, or `null` when no key is stored. `status` is `valid`, `invalid`, `expired` or `rate_limited`; `at` is when the call that set it failed, or `null` when the test set it. Reviews and the model proxy set it: a 401 (or a 400 or 403 that names the API key) is `invalid`, or `expired` when the provider says so, and a 429 or a quota is `rate_limited`. `invalid` and `expired` hold until the key is saved or re-tested; `rate_limited` lasts an hour after the last one. Only the class and the time are kept.
- `platform`: the same for CodePanel's own key for the provider, which calls on credits use, or `null` when nothing failed on it lately (an hour for a rate limit, a day for a refusal). Read it when a member on credits fails or waits: nobody on your side can fix it, and a member on your own key is not affected.

A key also turns `invalid` by itself when a member on it fails two rounds in a row because the account is out of credit or the key was revoked (HTTP 401 or 402, or the provider's out-of-credit message). `lastError` then starts `Turned off after reviews failed with:` and quotes the provider. Rounds skip that key's members until a person saves the key again or refreshes its models in Settings. You cannot do that over MCP. Pass on the provider and `consoleUrl` to your user.

## Examples

These responses come from a test account on a local backend, which holds fake keys. The result lists twelve providers; this copy keeps four: a valid key, a plan with none stored, a provider with none stored and the custom endpoint.

```json title="Call"
{}
```

```json title="Result (trimmed)"
[
  {
    "configured": true,
    "consoleUrl": "https://platform.claude.com/settings/keys",
    "health": { "status": "valid", "at": null },
    "lastError": null,
    "lastValidatedAt": 1794614457488,
    "modelCount": 3,
    "name": "Anthropic",
    "platform": null,
    "provider": "anthropic",
    "status": "valid"
  },
  {
    "configured": false,
    "consoleUrl": "https://chatgpt.com/#settings",
    "lastError": null,
    "lastValidatedAt": null,
    "modelCount": 0,
    "name": "ChatGPT plan",
    "provider": "openai-chatgpt",
    "status": null
  },
  {
    "configured": false,
    "consoleUrl": "https://platform.deepseek.com/api_keys",
    "lastError": null,
    "lastValidatedAt": null,
    "modelCount": 0,
    "name": "DeepSeek",
    "provider": "deepseek",
    "status": null
  },
  {
    "configured": false,
    "consoleUrl": "",
    "lastError": null,
    "lastValidatedAt": null,
    "modelCount": 0,
    "name": "Custom (OpenAI-compatible)",
    "provider": "custom",
    "status": null
  }
]
```

No sample here shows an `invalid` key. The shape is the same, with `status: "invalid"` and a `lastError`. A key a call found rate-limited keeps `status: "valid"` and reads `"health": { "status": "rate_limited", "at": <ms> }`; read `health` for whether the key works now.

## The same step without MCP

| Surface | Form |
| --- | --- |
| CLI | `codepanel keys` ([CLI](/docs/cli#panels-models-and-keys)) |
| HTTP API | [`GET /keys`](/docs/api#get-keys) |

Keys can only be added in the browser, so they never pass through an agent's context ([Providers and keys](/docs/providers-and-keys#check-key-health)).

## What the server tells your agent

The description your agent reads when it lists the tools:

> Which AI providers have a working API key. Keys themselves are never shown; add or fix them in CodePanel Settings → Provider keys. Each row's health is your own key's latest refusal class; platform is CodePanel's own key for the provider (credits): when its status is invalid or expired, reviews and disputes run on your own key and get_review's payload.keys names it with creditsSkipped platform_key. CodePanel's operators replace that key; it is not yours to fix.

## Related

- [`get_panel`](/docs/mcp-server/get_panel): which members are `callable` as a result.
- [`list_models`](/docs/mcp-server/list_models): the models each valid key reaches.
- [Providers and keys](/docs/providers-and-keys#keys-that-stop-working): what happens when a key stops working.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
