docs/en/getting-started/05-cli-setup.md
This guide helps you install the OpenViking CLI, configure it, and verify that it can connect to OpenViking.
ov is the client CLI. It connects to an existing OpenViking server or to VolcEngine Cloud. It does not replace server setup. If you still need to install or start a self-managed server, follow the Quick Start or the Server Mode guide first.
Use this page in either of two ways:
ov yourself, follow Manual Setup.Both paths should start by checking the installed CLI help:
ov --help
ov config --help
The CLI evolves quickly. Use ov --help and ov <command> --help as the source of truth for the commands available in your installed version.
The CLI uses ~/.openviking/ovcli.conf as the active client connection config.
When you create named configs, ov stores them next to the active file as ~/.openviking/ovcli.conf.<name>. Switching configs copies the chosen saved config into ~/.openviking/ovcli.conf.
ov config is the human-friendly interactive manager. It can add, edit, delete, validate, and switch configs.
ov config add, ov config edit, ov config list, ov config switch <name>, and ov config delete are deterministic commands for scripts and agents.
npm i -g @openviking/cli
ov --help
ov config
ov config validate
ov health
ov status
Expected result:
ov --help prints the OpenViking command list.ov config opens the interactive config manager.ov config validate confirms the active config can reach and authenticate with the server.ov health confirms basic server reachability.ov status shows the active config and server diagnostics.You need:
@openviking/cli package, oropenviking package.API keys are sensitive. Prefer entering them through the interactive ov config prompt. For agent-assisted setup, prefer stdin when the agent already holds the key through a secure channel. Use an environment variable only when the key is already present in the shell environment. Avoid putting API keys directly in chat messages or shell history.
ovCheck whether ov is already installed:
command -v ov
ov --version
Install or upgrade the npm package:
npm i -g @openviking/cli
The npm package is the simplest standalone CLI install. If you also want the Python SDK or server package, the Python package exposes ov too:
uv tool install openviking --upgrade
# or
pip install openviking --upgrade --force-reinstall
Verify:
ov --help
If ov is still not found, close and reopen the shell, or check the npm global prefix:
npm prefix -g
On macOS and Linux, the global npm binary directory is usually $(npm prefix -g)/bin. Make sure that directory is on PATH.
OpenViking CLI configs can hold a user key, a root key, or both.
ov add-resource, ov find, and ov tree. The server derives the identity from the key, so you usually do not pass --account or --user. This is what most users want.--sudo. A root key has no built-in tenant identity. If a config only has a root key, it must also include --account and --user; that root key then serves normal commands for that identity and --sudo commands.--sudo commands use the root key with the configured account and user.Choose this when you want OpenViking hosted on VolcEngine Cloud.
ov: https://api.vikingdb.cn-beijing.volces.com/openviking--account or --user unless the user's administrator specifically provides identity override values.Choose this when you run or operate your own OpenViking server.
http://127.0.0.1:1933Use this path when you are reading the guide and configuring ov yourself.
Run:
ov config
Then choose:
Add configVolcEngine Cloud or Self-ManagedIf you manage more than one OpenViking target, use:
ov config switch
to choose the active config later.
After setup, continue to Verify The Setup.
Use this path when an agent is setting up ov for a user. The agent should read this whole page. The manual setup path above is the fallback when deterministic commands do not fit the user's environment.
ov --help, ov config --help, and the relevant config subcommand help before choosing commands.ov --help command surface. Do not store API keys or other secrets.ov config commands when the required values are known.--name for agent setup so retries target the same saved config.--api-key-stdin or --root-api-key-stdin and write only the key bytes to stdin. Use --api-key-env or --root-api-key-env only when that environment variable already exists. Do not ask the user to open a separate shell just to export a key for the agent.-o json and branch on the JSON result plus the process exit code.ov config validate, then check ov health and ov status.ov config instead.Run:
ov --help
ov config --help
ov config add --help
ov config add cloud --help
ov config add self-managed --help
ov config edit --help
Use the installed CLI help as the source of truth. If this page and the installed help disagree, follow the installed help and tell the user what changed.
Always pass --name when an agent creates a config. If you omit it, ov generates a random name; a retry can create a second saved config instead of updating the intended one.
ov config add is safe to run again with the same --name when the values are identical. It exits 0, and --activate will make that saved config active again. If the same name already exists with different values, the command exits 3 and asks for --force.
When you use -o json with the non-interactive config commands, successful results are printed to stdout:
{"status":"ok","result":{"action":"add","name":"prod"}}
The result object depends on the subcommand. add and edit also include fields such as kind, url, saved_path, active_path, activated, and validation, so agents should not assume that only action and name are present.
Errors are printed to stderr:
{"status":"error","error":{"code":"bad_input","message":"..."}}
Agents should branch on the process exit code and the JSON error.code, not on human-readable prose.
| Exit code | Meaning |
|---|---|
0 | Success, or already in the desired state |
2 | Bad input, missing value, invalid name, or unreadable secret source |
3 | A config with that name already exists with different values; pass --force only if replacement is intended |
4 | Server unreachable or config validation failed |
5 | Authentication or key-role mismatch, such as passing a root key where a user key is expected |
6 | Refused operation, such as deleting the active config |
ov config list -o json
The list output shape is:
{"status":"ok","result":[{"name":"prod","kind":"VolcEngine Cloud","url":"https://api.vikingdb.cn-beijing.volces.com/openviking","active":true}]}
For an existence check, inspect result[].name. To decide whether a config already needs switching, inspect the matching entry's active flag.
If a suitable saved config already exists, activate it by name:
ov config switch prod -o json
Then run the verification commands.
If the agent already holds the API key through a secure channel, run:
ov config add cloud --name prod --api-key-stdin --activate -o json
Write only the API key bytes to stdin. Do not place the key in the shell command. This writes a VolcEngine Cloud config using the fixed endpoint https://api.vikingdb.cn-beijing.volces.com/openviking. The cloud target does not take a custom server URL.
Use an environment variable only if it already exists in the shell:
ov config add cloud --name prod --api-key-env OV_API_KEY --activate -o json
Do not pass --account or --user for standard VolcEngine Cloud setup. Use them only when the user or their OpenViking administrator provides identity override values.
For a local unauthenticated server:
ov config add self-managed --name local --url http://127.0.0.1:1933 --activate -o json
If the local server is not running, guide the user to start it first. See the Server Mode guide.
For a hosted self-managed server with a normal API key:
ov config add self-managed --name hosted --url https://ov.example.com --api-key-stdin --activate -o json
Write the API key to stdin. If the key is already in the shell environment, use --api-key-env OV_API_KEY instead.
For a self-managed server where the user gives you only a root API key, include the target account and user:
ov config add self-managed --name hosted --url https://ov.example.com --root-api-key-stdin --account "$OV_ACCOUNT" --user "$OV_USER" --activate -o json
Write the root API key to stdin. Root keys require explicit --account and --user so normal CLI commands know which identity to use.
For a self-managed server where the user has both a user key and a root key, store both in one config:
ov config add self-managed --name hosted-admin --url https://ov.example.com --api-key-stdin --root-api-key-env OV_ROOT_API_KEY --account "$OV_ACCOUNT" --user "$OV_USER" --activate -o json
This keeps normal commands on the user key and lets --sudo commands use the root key. Because one command has only one stdin stream, the second key must come from an existing environment variable. If neither key is already available in the environment, use ov config and guide the user through the interactive flow.
List configs first:
ov config list -o json
Rename and activate a saved config:
ov config edit prod --new-name production --activate -o json
Replace an API key:
ov config edit production --api-key-stdin --activate -o json
Write the replacement API key to stdin.
Replace a self-managed URL:
ov config edit local --url http://127.0.0.1:1933 --activate -o json
Use --force only when you intentionally want to replace an existing saved config name.
Delete only non-active saved configs:
ov config delete old-local -o json
If the config is active, switch to another config first:
ov config switch prod -o json
ov config delete old-local -o json
Run:
ov config show
ov config validate
ov health
ov status
Use ov config show for inspection because it redacts secrets.
Do not print the raw config file unless you understand that it may contain secrets.
After the config is working, use the built-in help to explore the rest of ov:
ov --help
ov config --help
ov add-resource --help
Agents should refresh this help before running unfamiliar commands. If an agent keeps long-term memory for the user and the user allows it, the agent may store a concise summary of the command surface for future sessions. It should not store secrets, raw config files, or private server details unless the user explicitly asks.
ov config prompt for manual setup.~/.openviking/ovcli.conf.ov Is Not FoundRun:
npm i -g @openviking/cli
npm prefix -g
Then reopen the shell or add the global npm binary directory to PATH. On macOS and Linux, that directory is usually $(npm prefix -g)/bin.
If npm reports a permission error, use your normal Node.js setup policy. Avoid sudo npm i -g unless you intentionally manage global npm packages with sudo.
For self-managed local setup, verify the server first:
curl http://127.0.0.1:1933/health
If it fails, start the server before configuring ov. See the Server Mode guide.
Run ov config again and edit the config. For VolcEngine Cloud, confirm the key came from the OpenViking console URL above. For self-managed servers, confirm whether the server requires authentication.
Agents should not keep retrying unknown keys. Ask the user to confirm the target type, server URL, key type, account, and user.
Inspect and switch:
ov config show
ov config list
ov config switch
ov config validate
Agents can switch by name:
ov config list -o json
ov config switch prod -o json
Use the interactive wizard:
ov config
This is the right fallback when a secret should be typed directly by the user, when the target is unclear, or when validation needs human judgment.
Use ov config. Do not use old or removed setup commands such as ov config setup-cli.
Once the CLI is configured, use ov --help and ov <command> --help to learn the rest of the CLI.
Adding a resource writes data into the active OpenViking server. If you want a small demo, use a resource you are comfortable storing. Agents must ask the user for permission before running this kind of demo command.
ov add-resource https://github.com/volcengine/OpenViking --wait
ov find "what is OpenViking"
ov tree viking://resources/ -L 2
For all commands:
ov --help
ov config --help
ov add-resource --help