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.
Installation
Section titled “Installation”See the installation guide for the current setup flow.
Authentication
Section titled “Authentication”Interactive sign-in
Section titled “Interactive sign-in”lokai auth loginThis prompts for your LokAI email address and password, validates the session against the API, and stores the resulting session locally.
Browser sign-in
Section titled “Browser sign-in”lokai auth login --browserThis 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.
Personal access tokens
Section titled “Personal access tokens”For CI, automation, or headless environments, create a personal access token in Studio under Account → Access Tokens, then log in with the token directly:
lokai auth login --token <lok_pat_...>Environment variables
Section titled “Environment variables”The CLI also accepts tokens from the environment:
export LOKAI_API_TOKEN=<lok_pat_...>lokai auth whoamiLOKAI_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.
Local storage
Section titled “Local storage”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.
Commands
Section titled “Commands”| Command | Description |
|---|---|
lokai auth login | Authenticate with email/password or a direct token |
lokai auth logout | Remove the stored local session |
lokai auth whoami | Show the current authenticated user and workspace |
lokai auth status | Check whether the CLI is currently authenticated |
lokai project init | Placeholder for upcoming project initialization |
lokai project sync | Placeholder for upcoming project synchronization |
lokai push | Planned command for uploading local translation key |
lokai pull | Planned command for downloading translations |
lokai doctor | Planned diagnostic command |
lokai auth login
Section titled “lokai auth login”Use lokai auth login when you want to create or replace the local session used by the CLI.
Examples:
lokai auth loginlokai auth login --token <lok_pat_...>lokai auth login --api-url https://api-dev.lokai.cloudSupported options:
| Option | Description |
|---|---|
--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 |
--browser | Sign 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.
lokai auth logout
Section titled “lokai auth logout”lokai auth logoutDeletes the local session file. It does not revoke personal access tokens created in Studio.
lokai auth whoami
Section titled “lokai auth whoami”lokai auth whoamiPrints the authenticated user’s email, user ID, provider, auth source, API URL, and current workspace when one is available.
lokai auth status
Section titled “lokai auth status”lokai auth statusReturns a simple authentication check that is useful in shell scripts and CI jobs.
Personal access token workflow
Section titled “Personal access token workflow”- Open Studio and go to Account → Access Tokens.
- Create a token with a clear name such as
Local CLIorGitHub Actions. - Copy the token immediately. The full token is only shown once.
- Authenticate with
lokai auth login --token <lok_pat_...>or setLOKAI_API_TOKEN.
If you no longer need a token, revoke it from the same Studio page. Revoked tokens stop working immediately.