Skip to content

Token onboarding

The tokenin-onboarding extension guides first-time users through adding a Token-In account so Selesai can authenticate with the model provider. It also provides the /tokenin command to manage multiple accounts after onboarding.

Bundled with Selesai

Loaded automatically with Selesai; no per-extension npm install is required.

Manifest entry
./tokenin-onboarding.ts
Runtime surface
Slash command

Setup and prerequisites

  • This extension is bundled with Selesai. It is loaded automatically; you do not need to install it separately.
  • Runs only on the first interactive startup (event.reason === "startup") until the onboarding marker is written.
  • Requires an interactive TUI session.
  • You need a Token-In token from https://token-in.selesai.in/dashboard/tokens.

What it sets up

  • Writes ~/.selesai/agent/.tokenInOnboardingComplete once onboarding completes or is skipped.
  • Stores the active credential in Selesai’s auth.json via AuthStorage.
  • Keeps multi-account details in ~/.selesai/agent/tokenin-auth.json with file mode 0o600.
  • The first account added during onboarding is set as active automatically.

What you can configure

Token onboarding uses environment suppression, an onboarding marker, and account storage. Credentials are sensitive values stored locally.

Configuration locations and precedence

  1. User marker and accounts
    ~/.selesai/agent/
    Marker file and multi-account tokenin-auth.json live here.

Settings

Key / pathType, default, and valuesDescription
.tokenInOnboardingCompletemarker file
Default: —
Written when onboarding is complete so the prompt does not reappear.
tokenin-auth.json🔒file
Default: —
Multi-account TokenIN storage. Written with mode 0o600.
providers.tokenin.apiKey🔒string
Default: —
Legacy models.json key removed during onboarding.

Environment variables

Key / pathDescription
SELESAI_SKIP_TOKENIN_ONBOARDINGSet to 1 to disable the first-run TokenIN onboarding prompt.

Command, tool, and shortcut controls

Key / pathDescription
/tokenin add|switch|remove|usageManage stored TokenIN accounts and show quota usage.

Source evidence

What you can do

  • On first run, confirm that you want to connect Token-In, open the dashboard, paste the token, and activate the account.
  • Add another account later with /tokenin add.
  • Switch the active account with /tokenin switch.
  • Remove a saved account with /tokenin remove (cannot remove the active account; switch first).
  • Check your Token-In quota with /tokenin usage: it queries the LiteLLM /key/info endpoint with the active token and shows spend, budget, remaining, and reset time in a boxed display.
  • Save multiple tokens and rely on automatic failover. If the active key fails with a 401, 429, or budget/quota error, the extension rotates to another saved account and puts the failed key on a 5-minute cooldown before trying it again.

Commands, tools, and shortcuts

CommandDescription
/tokenin addOpen the Token-In dashboard, paste a token, and add it to tokenin-auth.json. If it is the first account, it becomes active.
/tokenin switchPick a saved account and make it the active credential.
/tokenin removePick a non-active saved account and remove it.
/tokenin usageShow Token-In quota: spend, budget, remaining, and reset time from the LiteLLM /key/info endpoint.

The command validates that the pasted token starts with sk-. Invalid tokens are rejected and the prompt retries on the next launch.

Limits and safety

  • Tokens are stored in ~/.selesai/agent/tokenin-auth.json with mode 0o600. The active key is also written to Selesai’s auth.json.
  • Do not commit tokenin-auth.json, auth.json, or any file containing a token.
  • The onboarding prompt does not appear again after the marker file exists, even if the first attempt failed. Use /tokenin add to retry or add another token.
  • After a failover, the newly active credential is written to both tokenin-auth.json and auth.json, so the rotation survives new sessions.
  • The /tokenin-onboard command does not exist; use /tokenin add or wait for first-run onboarding.

Source evidence

Selesai version: 0.10.0