Core CLI
opod token
Create, list, expire, renew and revoke API keys and node join tokens on the leader, with the key format and the errors a caller sees.
In short
opod token mints, lists, expires and revokes API keys. A key has one scope (user, admin or node) and an optional expiry, and it is printed once. The commands write the store directly, so they work with no leader running.
opod token create alice --ttl 30d✔ created alice (id=k_Xb3…, scope=user)
expires: 2026-11-29T10:00:00Z (in 720h0m0s)
Key (shown once — store it now):
sk-orc-<printed once>Usage
opod token create [NAME] [--admin | --node] [--ttl DURATION | --expires-at DATE]
opod token ls
opod token expire ID [--in DURATION]
opod token renew ID --ttl DURATION | --expires-at DATE
opod token revoke IDA token is an API key: an identity with a scope and an optional expiry. These commands write the leader's store (storage.dsn, ~/.opod/state.db by default) directly. They need no running leader, and a running leader sees the change on the next request, because it looks the key up in the store on every request. Run them on the leader host.
| Sub-command | Alias | Effect |
|---|---|---|
create | — | Mint a key and print it once. |
ls | list | List keys. Never shows the key itself. |
expire ID | — | Set the expiry to now, or to now plus --in. |
renew ID | — | Set a new expiry. |
revoke ID | — | Revoke for good. |
Scopes
| Scope | Flag | Can call |
|---|---|---|
user | (none) | /v1/* — the OpenAI and Anthropic gateway. |
admin | --admin | /v1/* and /admin/v1/*. |
node | --node | The worker join path: POST /admin/v1/nodes/register and …/heartbeat. This is the join token a worker presents. |
A key is an identity only: who calls, with which scope, until when. It carries no rate limit, no quota and no model allowlist. Put those in a gateway in front of the endpoint.
opod token create
| Argument / flag | Default | Effect |
|---|---|---|
NAME | default, or node-join with --node | The key's name. For user and admin keys the name is also the key's user id, which usage rows carry. A node key has no user id. |
--admin | — | Make an admin key. |
--node | — | Make a node key. |
--ttl DURATION | no expiry | Expire this long from now. |
--expires-at DATE | no expiry | Expire at this time: YYYY-MM-DD (midnight UTC at the start of that day) or RFC 3339. |
Each flag also takes the --flag=value form. When both --admin and --node are given, the last one wins. When both --ttl and --expires-at are given, the last one wins.
opod token create alice # user key, never expires
opod token create alice-admin --admin
opod token create alice --ttl 7d
opod token create alice --expires-at 2027-01-01
opod token create --node # a worker join token named node-join
opod token create rack-2 --node --ttl 24h # a named join token that expiresPut the name first
The first word that is not a flag is the name; later words are ignored. On 0.2.1, with --node, write the name before the flag (opod token create rack-2 --node): in opod token create --node rack-2 the flag sets the name to node-join first, so rack-2 is ignored. From 0.3.0 the name is kept in either order, and a node key with no name is node-join.
The key is printed once:
✔ created alice (id=k_Xb3…, scope=user)
expires: 2026-11-06T10:00:00Z (in 168h0m0s)
Key (shown once — store it now):
sk-orc-<printed once>- The key is
sk-orc-followed by 32 URL-safe base64 characters (24 random bytes). - The id is
k_followed by 11 URL-safe base64 characters (8 random bytes). Commands that take anIDtake this. - The store keeps only the SHA-256 of the key. A lost key cannot be shown again; mint a new one.
When stdout is not a terminal (a pipe, a file, CI), the key is still printed to stdout, and a warning goes to stderr: secret written to a non-terminal (pipe/redirect/CI) — it may be captured in logs or shell history; rotate it if that wasn't intended. So KEY=$(opod token create ci-bot | tail -1) works, with that warning.
Node tokens
A node key is the shared secret between the leader and its workers. Issue it only on a network you trust, and give it an expiry when you can. The first worker that registers a node id with a node key binds that id to the key: another node key cannot register or heartbeat under the same id.
From core v0.4.6:
- The key is the only line on stdout, so
key=$(opod token create ci)holds just the key;created …, the expiry and the "shown once" note go to stderr, and a--nodekey addson the worker: opod join "<leader-url>?token=<this key>". - An argument that starts with
-and is not a flag is refused, with a did-you-mean:unknown token create flag --admn — did you mean --admin?(before, it became the key's name). A second name is refused too. - An expiry in the past is refused (
--ttl=-1h,--expires-at 2020-01-01). - With
OPOD_MANAGED=1and noOPOD_STORAGE_DSN,createrefuses: the CLI's store would be in memory, and the key would be thrown away.
Durations and dates
--ttl and --in take Go durations (30s, 5m, 2h, 1h30m) plus a whole number of days with d (7d; not 1.5d, not 0d). --expires-at takes YYYY-MM-DD or an RFC 3339 timestamp such as 2027-01-01T09:00:00-08:00; both are stored in UTC.
| Error | Cause |
|---|---|
opod: --ttl requires a duration (e.g. 30m, 2h, 7d) | --ttl is the last word. |
opod: invalid --ttl: invalid days: "1.5d" | Days must be a whole number above 0. |
opod: invalid --ttl: time: invalid duration "…" | Not a Go duration. |
opod: invalid --expires-at: expected YYYY-MM-DD or RFC3339, got "…" | Wrong date shape. |
opod token ls
opod token lsID NAME SCOPE REVOKED EXPIRES CREATED
k_Xb3… alice user no never 2026-10-30T10:00:00Z
k_9Lq… node-join node no 2026-10-31T10:00:00Z 2026-10-30T10:00:00Z
k_seed_1a2b3c… node-join (seeded) node no never 2026-10-30T09:58:01Z
k_cp_team-a team-a user no never 2026-10-30T09:58:02ZNo hash and no key are shown. EXPIRES is RFC 3339 or never. An expired key still shows REVOKED no; compare EXPIRES with the clock. With no keys, it prints (no API keys — create one with `opod token create`). From core v0.4.6 the REVOKED column is STATE — active, expired or revoked — EXPIRES is wide enough for its value, and --json prints the same rows as a list.
Ids tell you where a key came from:
| Id prefix | Origin |
|---|---|
k_ | opod token create, the first opod up (initial-admin), or POST /admin/v1/tokens. |
k_seed_ | auth.join_token / OPOD_JOIN_TOKEN, seeded by opod up as node-join (seeded). |
k_seedadm_ | auth.admin_token, seeded by opod up as manager-admin (seeded). |
k_cp_ | A key from the mounted auth snapshot. Its manager owns it. |
opod token expire
opod token expire k_abc # ✔ k_abc: expired immediately
opod token expire k_abc --in 1h # ✔ k_abc: will expire at 2026-10-30T11:00:00Z (in 1h0m0s)With no --in, the expiry is now. The next request with the key gets 401 key_expired. Any other flag is opod: unknown flag: ….
opod token renew
opod token renew k_abc --ttl 30d # 30 days from NOW, not from the old expiry
opod token renew k_abc --expires-at 2027-06-01✔ k_abc: renewed — expires 2026-11-29T10:00:00Z (in 720h0m0s)--ttl counts from now, so a late renewal is predictable. A renew also brings an expired key back. It does not bring a revoked key back. With neither flag: opod: renew needs --ttl or --expires-at. There is no way to clear an expiry back to never; mint a new key instead.
opod token revoke
opod token revoke k_abc # ✔ revoked k_abcRevocation is final. The next request with that key gets 401 invalid_api_key. There is no un-revoke.
An unknown id, for expire, renew or revoke, prints opod: … api_key k_x not found and exits 1. From core v0.4.6 it prints no key k_x (see opod token ls); revoke names the key (revoked k_… (alice, scope user) — requests carrying it are refused now) and says already revoked — nothing changed on a repeat (exit 0); renew of a revoked key refuses, because a new expiry does not restore it; a new expiry in the past is refused and points at opod token expire. revoke asks no confirmation: it ends one key, and a new key replaces it.
What a caller sees
| Status | error.type | When |
|---|---|---|
401 | missing_api_key | No key in the request. The key is read from Authorization (Bearer <key>, or the bare key), else X-Api-Key, else the ?key= query parameter. Message: Authorization header required. |
401 | invalid_api_key | The key is unknown or revoked. Message: Invalid or revoked API key. |
401 | key_expired | Past its expiry. Message: API key expired at <RFC 3339>. |
403 | forbidden | The key's scope does not allow the route, for example a user key on /admin/v1/*. Message: Insufficient scope. |
With auth.require_keys: false (and no auth snapshot that sets requireKeys), /v1 demands no key and treats every caller as admin; a valid key is still recorded on usage rows. /admin/v1/* always demands a key, whatever require_keys says. See Security.
Over the API
The same operations are GET|POST /admin/v1/tokens, PATCH /admin/v1/tokens/{id} (expiry only) and DELETE /admin/v1/tokens/{id}. See Admin API.
Last updated · Source: content/docs/core-cli/token.mdx · View as Markdown