tokmine [start] [flags] discover local models and open the tunnel (default)
tokmine upstream connect OpenAI, Anthropic, ... to your endpoints and set the fallback order
tokmine install [runner] install a local model server and a model (ollama, llamacpp)
tokmine login [--token T] store an agent token (or set TOKMINE_TOKEN)
tokmine endpoints list your endpoints and their machines
tokmine provider save URL-based providers (OmniRoute, LiteLLM, ...): add, list, remove, detect
tokmine privacy audit local runtimes for prompt logging
tokmine privacy apply fix what the audit found, asking first (--yes, --dry-run)
tokmine client point AI clients at your endpoint
tokmine update update to the latest release
tokmine logout remove the stored token
tokmine status show configuration, providers and reachability
tokmine models list discovered models
tokmine version
tm is an alias for tokmine and takes the same arguments.
Commands
Command
Description
tokmine [start]
Default. Discover local model servers, open the tunnel, print the public URL and stay running.
tokmine install [runner|family]
Install a local model server (ollama by default, or llamacpp) and pull a model that fits this machine. Families such as glm or qwen pick a model from that family. Options below. See Install a local model.
tokmine login [--token T]
Store your agent token in the config file. Without --token it reads TOKMINE_TOKEN, then prompts. Also saves --name, --endpoint and --server if given.
tokmine endpoints
List your workspace's endpoints: name, slug, public URL and machines online/total. Needs a logged-in machine. See Static endpoints.
tokmine logout
Remove the stored token. The machine id is kept.
tokmine status
Show version, mode (anonymous or authenticated), machine name and id, endpoint and whether it is reachable, config path, and discovered providers.
tokmine models
One-off scan: list discovered providers, dialects and models.
tokmine privacy
Audit local runtimes for prompt logging and print the privacy tier the marketplace uses, with fix hints. --json for machine-readable output. See Privacy checks.
tokmine privacy apply
Fix what tokmine privacy found, asking before each change: turn off Ollama debug logging (systemd override, macOS launchctl or Windows user variable), switch off LM Studio's prompt logging (close LM Studio first) and delete its saved chats and the server logs that hold earlier prompts. A .tokmine-bak copy is kept for edited files. --yes approves the changes that do not delete anything; deleting also needs --allow-delete. --dry-run shows the changes only, --only ollama:debug-on picks a fix. Runtimes configured in your own scripts or containers are listed as manual steps.
tokmine upstream
Connect OpenAI, Anthropic, Gemini, OpenRouter and other public services to your endpoints and choose the fallback order. See Managed router.
tokmine provider
Save URL-based providers such as OmniRoute, LiteLLM, OpenRouter or any OpenAI-compatible URL, with their headers. Subcommands add, list, remove and detect; options below. See URL-based providers.
tokmine update
Update to the latest release (checksum verified). --check only reports, --version X.Y.Z picks a version, --force reinstalls even when up to date. Available from 0.5.0; older versions re-run the install command once.
tokmine client
Point AI tools at your endpoint. Plain tokmine client configures OpenCode and Codex (asks first, keeps a backup) and lists the rest; client list shows every supported tool; client show <id> prints exact steps (Cursor, Devin, Antigravity, ...). --models 'qwen*,*claude*' and --no-variants trim long model lists; --print opencode prints the OpenCode config as one env var. Needs tokmine login. See AI tools and clients.
tokmine service
Run tokmine in the background, started at login and restarted if it crashes. Subcommands install, uninstall and status; see Run in the background.
tokmine version
Print version, commit, build date and OS/arch.
tokmine help
Print usage.
Flags
For start, status and models:
Flag
Description
--name <name>
Machine name. Defaults to the hostname.
--provider <url>
Add a model server manually (for example http://gpu-box:8000). Repeatable. See runners.
--dialect <d>
Force the dialect of --provider servers: openai, anthropic, gemini or ollama.
--endpoint <slug>, -e
Join this endpoint (a static endpoint of your workspace, or default). Authenticated machines only. Without it the CLI auto-selects your only static endpoint, asks you to choose among several, or uses the default endpoint. See Static endpoints.
--server <url>
Override the Tokmine server (default https://tunnel.tokmine.ai). For development. This was --endpoint <url> in earlier versions; a URL passed to --endpoint or TOKMINE_ENDPOINT still works as the server but prints a deprecation notice.
--app-url <url>
Web portal used for the chat link (default https://app.tokmine.ai). See Browser chat.
--no-discover
Skip probing the well-known local ports. Only --provider servers are used.
--json
Emit machine-readable events, one JSON object per line.
--verbose
More output. Tokens are never logged.
--token <t>
Agent token (login).
Flags for install
Flag
Description
--model <name>
Pull this model instead of choosing one from RAM and GPU.
--method <m>
auto (default), script, brew, winget or docker.
--yes
Skip confirmation prompts, including before running an installer script.
Probe and save an OpenAI-compatible base URL, for example http://localhost:20128/v1. A trailing /v1 is optional.
--preset <p>
omniroute (http://localhost:20128/v1), litellm (http://localhost:4000/v1) or openrouter (needs a key). Fills in the URL and name.
--name <n>
Label shown in status and models. Saving the same name again updates it.
--api-key-env <VAR>
Send Authorization: Bearer $VAR, read from the environment at run time. The secret is never written to the config file.
--api-key <key>
Same, but stores the key in the config file (owner-only permissions).
--header "Name: value"
Extra header sent to the provider. Repeatable. Values may use ${ENV_VAR}.
--dialect <d>
openai, anthropic, gemini or ollama. Default: detect.
--no-check
Save without probing the URL.
list, remove <name|url>
Show saved providers (header names only, never values) or delete one.
detect
Probe the common ports and report what is running, and which gateways (OmniRoute, LiteLLM, Xinference) answer but need an API key.
Flags for upstream
Needs tokmine login. The Tokmine server calls these services, so nothing has to keep running on this machine. Writes need a workspace admin on a paid plan.
Command or flag
Description
list (--json)
Connected services with status, the key's last four characters and your usage against the limit.
add <kind>
openai, anthropic, gemini, openrouter, omniroute, litellm or custom. The server checks the key and reports the models found.
--name <n>, --models a,b
Label (default: the kind), and an optional allow-list of models to offer from the service.
--url <u>
Base URL, required for omniroute, litellm and custom. Public https, without /v1.
--key-env <VAR>, --key-stdin
Where the API key comes from. Default: $OPENAI_API_KEY, $ANTHROPIC_API_KEY, $GEMINI_API_KEY or $OPENROUTER_API_KEY by kind. Keys are never accepted as flag values.
test, enable, disable, key, remove<service>
By name, id or unique id prefix. key replaces the stored key and tests it; remove erases it.
route <endpoint> [hop ...]
Show or set the order requests try: machines, a service name, marketplace. --default restores machines then marketplace. Named endpoints only.
Environment variables
Precedence is flags, then environment, then the config file.
TOKMINE_TOKEN
Agent token. Alternative to tokmine login.
TOKMINE_NAME
Machine name.
TOKMINE_PROVIDERS
Comma or space separated provider URLs.
TOKMINE_DIALECT
Forced dialect for manual providers.
TOKMINE_ENDPOINT
Endpoint slug to join, same as --endpoint.
TOKMINE_SERVER
Tokmine server URL override (formerly TOKMINE_ENDPOINT).
TOKMINE_APP_URL
Web portal URL for the chat link. Can also be set as appUrl in the config file.
TOKMINE_CONFIG_DIR
Directory for the config and session files.
OLLAMA_HOST
Honoured during discovery.
NO_COLOR
Disable coloured output.
HTTPS_PROXY, HTTP_PROXY
Standard proxy settings.
Config file
Location: ~/.config/tokmine/config.json on Linux and macOS (or $XDG_CONFIG_HOME/tokmine), %APPDATA%\tokmine\config.json on Windows, or $TOKMINE_CONFIG_DIR/config.json. It is written atomically with owner-only permissions.
machineId is generated on first run and identifies this machine across restarts. endpoint is the endpoint slug to join and server the Tokmine server URL (before this release, endpoint held the server URL). upstreams are the URL-based providers saved with tokmine provider add. An anonymous session is kept next to it in anon-session.json and deleted when it expires.
Behaviour
Reconnects automatically after network loss or sleep, with exponential backoff and jitter (1 to 30 seconds). The delay resets once a connection is stable.
Fatal errors stop it rather than retrying: rejected agent token, plan limit reached, an endpoint that does not exist, was disabled or deleted, or needs a paid plan, an outdated CLI, or another process using the same machine id. The message says what to do.
Anonymous sessions resume across restarts and end after 30 minutes, when the CLI exits.
Prints a chat link once online (and when an anonymous session resumes), to try the endpoint in the browser. --json adds it to the online event as chatUrl. See Browser chat.
With no local model server (and no --provider), suggests tokmine install ollama and, in an interactive terminal, asks Install Ollama now? [y/N] before connecting. A server with no models gets a tokmine install --model hint.
Endpoints (logged-in machines): the CLI prints the endpoint name and public URL on start and in status. If the endpoint is deleted or disabled while it runs, or your plan no longer includes static endpoints, the CLI prints why, does not reconnect and exits with code 78; pick another with --endpoint. The chat link becomes https://app.tokmine.ai/chat?endpoint=<slug> (no token in it).
Reports CPU, RAM and GPU load so traffic can be balanced across machines.
Ctrl-C (or SIGTERM) drains in-flight requests before exiting.
Run in the background
tokmine service install makes tokmine start when you log in and restart it if it crashes. It uses what your system already has: a launchd agent on macOS, a systemd user unit on Linux and a Scheduled Task on Windows. It needs tokmine login first, because an anonymous session lasts 30 minutes. The token stays in the config file; it is never written into the service.
bash
tokmine login
tokmine service install --endpoint home --now
tokmine service status
tokmine service uninstall
Command or flag
Description
service install
Install the service. Asks first; --yes skips the question and --dry-run prints what would be installed and changes nothing. Without --now it starts at your next login.
--now
Also start it right away. Do not use it while tokmine is already running in a terminal: two processes cannot share a machine id.
--name, --endpoint, --provider
Same as for tokmine. Set --endpoint if you have several: a background service cannot ask.
--restart-delay <seconds>
Wait before restarting after a crash. Default 30.
service status
Show whether it is installed and running, and where the log is.
service uninstall
Stop and remove it. Safe to run when nothing is installed.
Logs:~/Library/Logs/tokmine/tokmine.log on macOS, ~/.local/state/tokmine/tokmine.log on Linux, %LOCALAPPDATA%\tokmine\tokmine.log on Windows.
Fatal errors are not retried. A rejected token, a reached plan limit or a deleted endpoint stops the service instead of restarting it in a loop; read the log, fix it, then start it again.
After tokmine update the service keeps running the old process. Run tokmine service install --now again to restart it on the new binary.
Linux servers: a user unit stops when you log out unless you run sudo loginctl enable-linger $USER. Without systemd, use your own supervisor.
macOS: a launch agent starts when you log in. A Mac mini that must come back after a power cut also needs automatic login turned on in System Settings.
Windows: the task runs at logon and is not restarted automatically after a crash.
Exit codes
0
Normal exit (including Ctrl-C) or a successful command.
1
Runtime error or a failed command.
78
Fatal tunnel error that retrying cannot fix: bad token, plan limit, endpoint not found, disabled or not allowed, session refused. Service managers are told not to restart on it. Set TOKMINE_FATAL_EXIT_CODE to use another code.
2
Invalid usage: unknown command, flag, dialect or provider URL, or several endpoints and none chosen in a non-interactive run.
Flags and commands may change until the first stable release.