Admin guide AI
AI providers and keys
How bring-your-own-key works, where keys are stored, how the router picks a model, and how to update the model catalog.
On this page
Explain and the Architect need a large language model. Archipelego brings no AI keys of its own. People bring their own keys, and you can also give the server its own Anthropic credentials.
Bring your own key
Archipelego works with eight providers:
| Provider | Letter on the model badge |
|---|---|
| Anthropic | A |
| OpenAI | O |
| G | |
| xAI | X |
| DeepSeek | D |
| Moonshot | K |
| Mistral | M |
| Qwen | Q |
People add keys in the app, from Save & export, then AI models and keys. For each key they choose where to keep it:
- This browser: encrypted, only they can use it.
- Server, for this canvas: encrypted, everyone in the room can use it.
The user guide explains the dialog to the people in your workshops.
Keys kept in the browser
- The browser generates a device key once, with AES-GCM and 256 bits.
- The device key is not extractable. The browser can use it to encrypt and decrypt, but no script can read its bytes.
- The device key and the sealed API keys live in IndexedDB, in a database named
archipelego-secure. - Each API key is encrypted with that device key. The provider id is bound to the ciphertext.
- The browser decrypts its keys only to send them with one AI request to your Archipelego server.
- The server uses them for that one call. It never writes them to disk and never logs them.
A key kept in the browser works only in that browser, on that device.
Keys kept on the server
A key kept on the server belongs to one canvas. Everyone who opens that canvas can use it, without seeing it.
- The server encrypts the key with AES-256-GCM before it writes it.
- The ciphertext is bound to its canvas and its provider, as
<canvas>:<provider>additional authenticated data. A stored key cannot be copied to another canvas or provider. - Extra fields, such as the Qwen workspace id, are encrypted together with the key.
- The file is
keys/<canvas id>.jsonin the data folder, written with owner-only permissions. - The server decrypts a key only to call the provider.
- The API returns the last four characters of a key, never the key.
The master key
The master key that encrypts server keys comes from one of two places:
ARCHIPELEGO_SECRET, 32 bytes as base64 or as 64 hexadecimal characters.- Otherwise, a random 32-byte file,
.vault.key, that the server creates once in the data folder with owner-only permissions.
Back up the master key with the data. See Data and backup.
Owner tokens
Whoever stores a key on the server gets an owner token.
- The browser keeps the token in local storage, per canvas and provider.
- The server keeps only a SHA-256 hash of the token.
- Replacing or removing the key requires the token, sent in the
x-owner-tokenheader. - Without the token, the server refuses the change with "Someone else stored this key. Ask them to remove it first."
Anyone in the room can use a server key. Only its owner can replace or remove it.
Editions and key levels
ARCHIPELEGO_EDITION says what this instance is:
| Value | Meaning |
|---|---|
onprem (default) |
An on-premises instance, sold to or run by a company, a group of companies or a collective. The operator may provide keys for everyone (instance keys), and organisations inside it share their own |
saas |
The public service (archipelego.app). No instance keys and no server credentials: keys come from people (browser, board, workspace) and from the organisations they declare |
Instance keys, on an on-premises instance only:
ARCHIPELEGO_INSTANCE_KEYSas JSON, for example{"anthropic":"sk-ant-…","mistral":{"key":"…"}};- or one variable per provider,
ARCHIPELEGO_KEY_ANTHROPIC,ARCHIPELEGO_KEY_MISTRAL…
ARCHIPELEGO_ADMINS lists the emails of the instance's administrators (separated by ;). When it is set, only they declare organisations; otherwise anyone signed in can.
Keys stored by people live in the data folder, encrypted with the master key (ARCHIPELEGO_SECRET): keys/<board>.json for boards, keys/workspace/<account>.json and keys/organisation/<organisation>.json. Organisations are in orgs.json. Each key is bound to its level and holder, so a copied file cannot open elsewhere.
Server credentials
You can give the server its own Anthropic credentials. Every canvas can then use Claude as a last resort, even when nobody has added a key.
The server counts as having credentials when one of these variables is set:
ANTHROPIC_API_KEYANTHROPIC_AUTH_TOKENANTHROPIC_PROFILE
ARCHIPELEGO_PLATFORM_AI changes that rule:
| Value | Effect |
|---|---|
| not set | The server uses its own credentials when one of the variables above is set. |
on |
The server always offers its own Anthropic credentials, for example an ant auth login profile. |
off |
The server never uses its own credentials. Every request needs a key from a person. |
The router
The router picks the model for each request. Its settings belong to the canvas, so everyone in the room shares them.
Roles
Each request has a role:
| Role | Used by | Tiers it prefers, in order |
|---|---|---|
architect |
@architect in the chat |
flagship, balanced, fast |
explain |
Explain | flagship, balanced, fast |
quick |
quick replies | fast, balanced, flagship |
Every model in the catalog has a tier: flagship, balanced or fast.
Candidate order
For each request the router builds an ordered list of models:
- The fixed model, when the mode is Fixed.
- The model chosen for this role, if any.
- The fallback list the room sets, in its order.
- Then every model of the catalog, tier by tier for the role, with providers in this order:
anthropic,openai,google,moonshot,xai,mistral,qwen,deepseek.
The router keeps only models whose provider has a key: a key from this browser, a key stored on the server for this canvas, or the server credentials. When one provider has several keys, the browser key wins over the server key, and the server key wins over the server credentials.
Fixed mode
In Fixed mode, the router uses only the fixed model. It never answers with another model. When the fixed model has no key, the request fails with "The fixed model has no key. Add one in AI models and keys, or switch the router to Auto."
Fallbacks
- The router tries at most four models per request.
- A model that fails before its first word is skipped, and the router tries the next one.
- A model that fails after its first word ends the request. One answer never mixes two models.
- When no model can answer, the error names the last failure.
For Claude, the server also turns on Anthropic's server-side fallback. When Claude declines a request for safety reasons, the Anthropic API runs it again on Anthropic's recommended fallback model.
Providers on the wire
- Claude goes through the official Anthropic SDK.
- Every other provider goes through its OpenAI-compatible
/chat/completionsendpoint, with streaming.
AI endpoints
| Method and path | What it does |
|---|---|
GET /api/ai/catalog |
The providers, the models, and platform: the providers the server can use with its own credentials. |
GET /api/ai/keys?canvas=<id> |
The status of server keys for a canvas: provider, last four characters, date, and whether you own it. |
PUT /api/ai/keys/<provider>?canvas=<id> |
Stores a key. The body is { "key": "...", ...fields }. It returns the owner token. |
DELETE /api/ai/keys/<provider>?canvas=<id> |
Removes a key. It needs the x-owner-token header. |
POST /api/ai/test |
Sends one short prompt to check a key. It times out after 30 seconds. |
POST /api/explain |
Explain, streamed as server-sent events. |
POST /api/architect |
The Architect, streamed as server-sent events. |
POST /api/feature |
A feature draft from the Architect, as one JSON answer. |
Explain, the Architect and feature drafts all go through the router. With ARCHIPELEGO_AI_MOCK, the Architect and feature drafts can answer without any key. See Offline simulator.
The model catalog
The catalog lists the providers and models the router knows. It is data, not code.
- The router reads
server/llm/catalog.json, or the file inARCHIPELEGO_LLM_CATALOG. - The server reloads the file when its modification time changes. You do not need to restart.
- When the file is missing or invalid, the server uses a built-in catalog with three Claude models:
claude-opus-5-5,claude-sonnet-5-5andclaude-fable-5-2. - A model whose provider is not in the catalog is dropped when the catalog loads.
Update the catalog
The catalog is built from the research file docs/research/llm-catalog.json. To add or retire a model:
- Edit
docs/research/llm-catalog.json. Each model has anid, aprovider, alabeland atier. - Rebuild the catalog with
npm run llm-catalog. - Copy the new
server/llm/catalog.jsonto the server, or pointARCHIPELEGO_LLM_CATALOGat it.
npm run llm-catalogThe command runs node scripts/build-llm-catalog.mjs. It writes server/llm/catalog.json and prints each provider with its models.
The script leaves out the models listed in its EXCLUDE set. It also adds the per-provider settings the router needs, such as the Qwen workspace field. See scripts/build-llm-catalog.mjs.
Adding a new provider needs code as well as data. See The LLM router.