Skip to content

CLI Reference

The LokAI CLI (lokai) gives you terminal access to your LokAI account and upcoming project sync workflows. This page documents the commands that are available today.

See the installation guide for the current setup flow.

Terminal window
lokai auth login

This prompts for your LokAI email address and password, validates the session against the API, and stores the resulting session locally.

Terminal window
lokai auth login --browser

This opens Studio in your browser, completes sign-in there, and then links the browser session back to the CLI through a short-lived local callback. After success, Studio shows a confirmation screen so you can safely return to the terminal.

For CI, automation, or headless environments, create a personal access token in Studio under AccountAccess Tokens, then log in with the token directly:

Terminal window
lokai auth login --token <lok_pat_...>

The CLI also accepts tokens from the environment:

Terminal window
export LOKAI_API_TOKEN=<lok_pat_...>
lokai auth whoami

LOKAI_API_KEY is also supported as an alias. To target a different LokAI API endpoint, use API_URL or pass --api-url to lokai auth login.

Interactive logins store credentials in ~/.lokai/credentials.json and remember the chosen API URL in ~/.lokai/config.json. On Unix-like systems, both files are written with 0600 permissions.

Set LOKAI_CLI_HOME if you want the CLI to use a different directory for those files.

CommandDescription
lokai auth loginAuthenticate with email/password or a direct token
lokai auth logoutRemove the stored local session
lokai auth whoamiShow the current authenticated user and workspace
lokai auth statusCheck whether the CLI is currently authenticated
lokai project initPlaceholder for upcoming project initialization
lokai project syncPlaceholder for upcoming project synchronization
lokai pushPlanned command for uploading local translation key
lokai pullPlanned command for downloading translations
lokai doctorPlanned diagnostic command

Use lokai auth login when you want to create or replace the local session used by the CLI.

Examples:

Terminal window
lokai auth login
lokai auth login --email [email protected]
lokai auth login --token <lok_pat_...>
lokai auth login --api-url https://api-dev.lokai.cloud

Supported options:

OptionDescription
--api-url <url>Override the LokAI API base URL for this login
--token <token>Use a direct bearer token such as a personal access token
--email <email>Pre-fill the email address for terminal login
--password <password>Provide the password non-interactively
--browserSign in through Studio in the browser and link that session back to the CLI
--studio-url <url>Override the Studio URL used for browser-based sign-in

Browser sign-in is a good default for local development when you already use Studio in the browser. Personal access tokens are still the recommended option for CI, automation, and other headless environments.

Terminal window
lokai auth logout

Deletes the local session file. It does not revoke personal access tokens created in Studio.

Terminal window
lokai auth whoami

Prints the authenticated user’s email, user ID, provider, auth source, API URL, and current workspace when one is available.

Terminal window
lokai auth status

Returns a simple authentication check that is useful in shell scripts and CI jobs.

  1. Open Studio and go to AccountAccess Tokens.
  2. Create a token with a clear name such as Local CLI or GitHub Actions.
  3. Copy the token immediately. The full token is only shown once.
  4. Authenticate with lokai auth login --token <lok_pat_...> or set LOKAI_API_TOKEN.

If you no longer need a token, revoke it from the same Studio page. Revoked tokens stop working immediately.