# Use several keys

A provider can hold several API keys or signed-in accounts. They form one list, used from the top.

1. The list: Personal, Work, Old team key
2. A conversation keeps Personal while it works
3. Personal is rate limited: the next request uses Work, and the reply says "Switched to Work: Personal hit a rate limit"
4. An invalid key is skipped until it is replaced

## Add a key

Settings → Model services, then the provider's card, or its section on its company's card: **Add key** (a filled button while the provider has none), or **Sign in with another account** for a subscription. A provider with several ways to connect lists them first, the recommended one on top.

The key is checked with the provider before it is saved, and the dialog says what it found:

| Result | Saved |
| --- | --- |
| Key works · 42 models | Yes |
| Key works · no credit | Yes, with Top up for the billing page |
| Key saved · not verified | Yes: the provider took the key but nothing proved it can answer |
| Can't reach the provider | Yes, with Retry |
| Key rejected | No: paste another key, or Get a key |

A name is optional; without one the row reads "Key ····c41e". A key is never shown again, only its last four characters. A key set in the Worker's environment appears as its own row with the variable's name; paste the same key here and it is saved, keeps working when the variable is gone, and is listed once.

## Order and strategy

With two or more keys, the Credentials section shows a choice over the list:

- **In order**: The first usable key; the rest wait as spares. The default.
- **Evenly**: New conversations take turns across the usable keys.
- **Least used**: A new conversation takes the key used least today.

Drag a row by its grip, or use **Move up** / **Move down** in its ⋯ menu. **Don't use for now** keeps a key but skips it; **Use again** brings it back. **Remove…** is the only action that asks first.

## Pin a conversation to one key

In the composer's model menu, a provider with two or more keys ends its models with **This conversation uses Personal**, then **Automatic (in order)** and each key with its state; choosing a key pins this conversation to it and moves the check from Automatic to that key.

A key that cannot answer now cannot be picked. Other conversations keep following the list.

## When a key stops

| The row says | What happens, and the fix |
| --- | --- |
| Back at 14:32 | Rate limited: skipped until then, then used again by itself |
| Out of quota | Skipped until the quota resets. **Top up** on the provider's card opens this row |
| Invalid key | The provider refused it. **Replace** pastes a new key into the same row, keeping its name and place |
| Sign in again | The sign-in expired. **Sign in again** renews the same row |

When every key is waiting, the reply says "Waiting for Work, back in 30s".

## From the terminal

```
openprogram providers keys openai list
openprogram providers keys openai add --name work
openprogram providers keys openai move work --to 1
openprogram providers keys openai strategy evenly
```

In the terminal UI, `/login <provider>` opens the same list: check, rename, set aside, move, remove, or add a key or account.

[Authentication](https://fzkuji.github.io/OpenProgram/docs/models/auth.html) · [Providers](https://fzkuji.github.io/OpenProgram/docs/models/providers.html)
