Credentials, keys and accounts
Learn the credentials in memtrunk. A memtrunk key or a proxy token goes from your client to the gateway. A provider key and account go to the provider.
Last updated
memtrunk uses three kinds of credential. Each one has a different owner and a different job. This page explains what each one is and how the gateway uses all three in one request.
The three credentials#
| Credential | What it is | Who creates it | Direction |
|---|---|---|---|
| memtrunk key | The key your client sends to the gateway | A signed-in user, in the console | Client to memtrunk |
| Provider key | An API key from an AI provider | A signed-in user, in the console | memtrunk to provider |
| Provider account | A subscription account in a pool | A signed-in user, who becomes the owner | memtrunk to provider |
A memtrunk key belongs to the user who creates it. A provider key that a member adds is private to that member. A provider account belongs to the user who adds it.
Claude Code, Codex CLI and Antigravity CLI can connect with a proxy token in place of a memtrunk key. The token sits in the URL path of your personal address. The section The proxy token below explains it.
For the provider side, read Provider keys and Account pools.
One request, three credentials#
- Your client sends the memtrunk key. The gateway reads it from the
Authorization: Bearerheader first. If that header is absent, it reads thex-api-keyheader. - The gateway looks up the key by its hash. It returns a 401 when the key is missing, unknown, disabled or expired.
- The gateway checks the key owner. It returns a 401 with the message
Account is disabledwhen the owner is disabled. - The gateway checks the spend limits of the key. Read Spend limits.
- The gateway picks a provider account from a pool, or a provider key. The Allowed sources of the key limit this choice.
- The gateway sends the request to the provider with that provider credential.
Your client never needs a provider key or a provider sign-in. The gateway holds those and adds one to the outbound request.
A request on a personal address follows a shorter check. The gateway reads the proxy token from the URL path and not from a header. The request still needs a provider account or provider key that you may use.
The 401 messages are:
| Case | Message |
|---|---|
| No key in the request | API key required |
| Unknown, disabled or expired key | Invalid API key |
| Disabled owner | Account is disabled |
The proxy token#
A user can have a proxy token. It is not an API key. The personal address is the host of your instance followed by the token as a path. Claude Code, Codex CLI and Antigravity CLI connect through this address. They need no API key of their own.
Find your personal address in the setup guide on the Dashboard. It is also on the Proxy connection card on your Profile page. Treat the whole address like a password. Anyone who has it can send requests as you.
If the address leaks, rotate the token on the Proxy connection card. The old address then returns 404. An unknown or disabled token also returns 404. Many requests with an unknown token from one IP address return 429 with a Retry-After header.
Per-key limits do not apply on a personal address, because no key takes part. A monthly USD limit that your admin sets can still apply. Read Spend limits.
All three tools can also connect with a named API key. The setup guide shows these steps in a collapsed section.
Create a memtrunk key#
- Open API keys in the console.
- Select Create key.
- Enter the values from the next table.
- Select Create.
- Copy the key that the console shows.
The console shows the key in full after you select Create. Copy the key then. The owner of the key can also select Reveal key in the key details later. Reveal can fail. You cannot reveal a key from before reveal existed.
| Console field | Meaning |
|---|---|
| Name | A label for the key. The field is required. |
| Source | Shared pool or Own provider key. A new key starts as Shared pool. |
| Budget window | Monthly or Daily. A new key starts as Monthly. |
| Monthly limit (USD), Daily limit (USD), Monthly token limit | The limits of the key. Read Spend limits. |
| Expires | The date on which the key stops working. |
| Allowed sources | Switches for Claude, OpenAI / Codex, Antigravity, and Custom & provider keys. All switches start on. |
| Enabled | Edit key only. Turn it off to make the gateway reject the key. |
Some rules apply to these fields:
- Allowed sources only narrows the providers of the key owner. It cannot add a provider that the owner lacks.
- The console asks you to enable at least one source. You cannot turn all four switches off.
- Custom & provider keys needs the owner to have Claude for
/v1/messages, or OpenAI for/v1/chat/completions. - Own provider key restricts the Claude pool to the accounts that the key owner owns and the accounts granted to the owner. Read Account pools for the other pools.
The Expires field takes a date. The gateway compares the date with the current time in UTC. The key stops working when that date starts.
To change a key, select Edit in the key list. Change the fields and select Save changes.
Revoke a key#
- Open API keys in the console.
- Select Revoke on the key.
- Select Revoke to confirm.
The owner of a key can revoke it. A revoke deletes the key. The next request with that key gets a 401 with the message Invalid API key. A member or org admin who does not own the key cannot revoke it. A read-only auditor cannot revoke it.
The 401 hint#
The gateway checks the shape of a value that it rejects as Invalid API key. Suppose the value has exactly 43 characters. Suppose each character is a letter, a digit, a hyphen or an underscore. Suppose the value does not start with the prefix of a memtrunk key. Then the message gains a hint. The hint says the value looks like a proxy token and that the proxy token belongs in the URL path. The message then reads Invalid API key. This value looks like a proxy token. Put the proxy token in the URL path, not in the key.
If you see this hint, check that you put the right credential in the key field.