Terminal interface for chatting with your Onyx agent
Project description
Onyx CLI
A CLI for querying enterprise knowledge from Onyx. Includes an interactive chat TUI for humans and non-interactive commands for AI agents and scripts.
Installation
pip install onyx-cli
Or with uv:
uv pip install onyx-cli
Setup
Run the interactive chat TUI — on first launch it will guide you through setup:
onyx-cli chat
This prompts for your Onyx server URL and personal access token (PAT), tests the connection, and saves config to ~/.config/onyx-cli/config.json (or $XDG_CONFIG_HOME/onyx-cli/config.json if set). To reconfigure later, use the /configure command inside the TUI.
Environment variables override config file values:
| Variable | Required | Description |
|---|---|---|
ONYX_SERVER_URL |
No | API base URL (default: https://cloud.onyx.app/api) |
ONYX_PAT |
No | Personal access token for authentication (required if no config file) |
ONYX_PERSONA_ID |
No | Default agent/persona ID |
ONYX_STREAM_MARKDOWN |
No | Enable/disable progressive markdown rendering (true/false) |
ONYX_SSH_HOST_KEY |
No | Path to SSH host key for serve command |
Usage
Interactive chat
onyx-cli chat
onyx-cli chat --no-stream-markdown
| Flag | Description |
|---|---|
--no-stream-markdown |
Disable progressive markdown rendering during streaming |
One-shot question
onyx-cli ask "What is our company's PTO policy?"
onyx-cli ask --agent-id 5 "Summarize this topic"
onyx-cli ask --json "Hello"
| Flag | Description |
|---|---|
--agent-id <int> |
Agent ID to use (overrides default) |
--json |
Output NDJSON stream events instead of plain text |
--prompt <string> |
Question text (use with piped stdin context) |
--quiet |
Buffer output and print once at end |
--max-output <int> |
Max bytes before truncating (0 to disable) |
List agents
onyx-cli agents
onyx-cli agents --json
Serve over SSH
# Start a public SSH endpoint for the CLI TUI
onyx-cli serve --host 0.0.0.0 --port 2222
# Connect as a client
ssh your-host -p 2222
Clients can either:
- paste a personal access token (PAT) at the login prompt, or
- skip the prompt by sending
ONYX_PATover SSH:
export ONYX_PAT=your-pat
ssh -o SendEnv=ONYX_PAT your-host -p 2222
Useful hardening flags:
--host-key(default~/.config/onyx-cli/host_ed25519)--idle-timeout(default15m)--max-session-timeout(default8h)--rate-limit-per-minute(default20)--rate-limit-burst(default40)--rate-limit-cache(default4096)
Commands
| Command | Mode | Description |
|---|---|---|
chat |
Interactive | Launch the interactive chat TUI (requires terminal) |
ask |
Agent / Script | Ask a question and print the answer to stdout |
agents |
Agent / Script | List available agents (ID, name, description) |
validate-config |
Agent / Script | Check CLI configuration and server connectivity |
install-skill |
Agent / Script | Install the Onyx CLI agent skill file |
experiments |
Agent / Script | List experimental features and their status |
serve |
Interactive | Serve the Onyx TUI over SSH |
Global Flags
| Flag | Description |
|---|---|
--version, -v |
Print client and server version information |
--debug |
Run in debug mode (verbose logging) |
Agent / Non-Interactive Use
When called without a TTY (e.g., by an AI agent or piped into another command), onyx-cli adjusts its behavior:
- No subcommand: prints help and exits 0 (instead of launching the TUI)
- Results to stdout, progress/errors to stderr
- No ANSI codes or interactive prompts
askoutput truncated to 4096 bytes by default; full response saved to a temp file. Use--max-output 0to disable.
Configuration
If a human has already run onyx-cli chat (which includes first-time setup), the CLI works out of the box — no additional setup needed. Environment variables can override the config file or serve as an alternative when no config file exists:
export ONYX_SERVER_URL="https://your-onyx-server.com/api"
export ONYX_PAT="your-pat"
Exit Codes
| Code | Name | When |
|---|---|---|
| 0 | Success | Command completed |
| 1 | General | Unknown error |
| 2 | BadRequest | Invalid arguments |
| 3 | NotConfigured | Missing config/PAT |
| 4 | AuthFailure | Invalid PAT (401/403) |
| 5 | Unreachable | Server unreachable |
| 6 | RateLimited | Server returned 429 |
| 7 | Timeout | Request timed out |
| 8 | ServerError | Server returned 5xx |
| 9 | NotAvailable | Feature/endpoint doesn't exist |
Skill File
Install the bundled SKILL.md so AI coding agents can discover the CLI:
onyx-cli install-skill
onyx-cli install-skill --global
onyx-cli install-skill --copy
onyx-cli install-skill --agent claude-code
| Flag | Description |
|---|---|
--global, -g |
Install to home directory instead of project |
--copy |
Copy files instead of symlinking |
--agent, -a |
Target specific agents (e.g. claude-code; can be repeated) |
Slash Commands (in TUI)
| Command | Description |
|---|---|
/help |
Show help message |
/clear |
Clear chat and start a new session |
/agent |
List and switch agents |
/attach <path> |
Attach a file to next message |
/sessions |
List recent chat sessions |
/configure |
Re-run connection setup |
/connectors |
Open connectors in browser |
/settings |
Open settings in browser |
/quit |
Exit Onyx CLI |
Keyboard Shortcuts
| Key | Action |
|---|---|
Enter |
Send message |
Escape |
Cancel current generation |
Ctrl+O |
Toggle source citations |
Ctrl+D |
Quit (press twice) |
Scroll / Shift+Up/Down |
Scroll chat history |
Page Up / Page Down |
Scroll half page |
Building from Source
Requires Go 1.24+.
cd cli
go build -o onyx-cli .
Development
# Run tests
go test ./...
# Build
go build -o onyx-cli .
# Lint
golangci-lint run ./...
Publishing to PyPI
The CLI is distributed as a Python package via PyPI. The build system uses hatchling with manygo to cross-compile Go binaries into platform-specific wheels.
CI release (recommended)
Tag a release and push — the release-cli.yml workflow builds wheels for all platforms and publishes to PyPI automatically:
tag --prefix cli
To do this manually:
git tag cli/v0.1.0
git push origin cli/v0.1.0
The workflow builds wheels for: linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, windows/amd64, windows/arm64.
Manual release
Build a wheel locally with uv. Set GOOS and GOARCH to cross-compile for other platforms (Go handles this natively — no cross-compiler needed):
# Build for current platform
uv build --wheel
# Cross-compile for a different platform
GOOS=linux GOARCH=amd64 uv build --wheel
# Upload to PyPI
uv publish
Versioning
Versions are derived from git tags with the cli/ prefix (e.g. cli/v0.1.0). The tag is parsed by internal/_version.py and injected into the Go binary via -ldflags at build time.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onyx_cli-1.0.1-py3-none-win_arm64.whl.
File metadata
- Download URL: onyx_cli-1.0.1-py3-none-win_arm64.whl
- Upload date:
- Size: 5.8 MB
- Tags: Python 3, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e8eef270012966d3d372b0a70cc6a228a47a6f5a721988a1897ce859e30853
|
|
| MD5 |
cf28a6e4327f57bfd2d96f5004ccbd11
|
|
| BLAKE2b-256 |
543294fd3c905fff343c5976226dacb5379b1982ad8b602c7e3d4e6543955c8f
|
File details
Details for the file onyx_cli-1.0.1-py3-none-win_amd64.whl.
File metadata
- Download URL: onyx_cli-1.0.1-py3-none-win_amd64.whl
- Upload date:
- Size: 6.4 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2937678236854748ae59b5713350179847aec28e734a90a0f4ab1e6e725d0948
|
|
| MD5 |
82575f04781392a65a21fdd295dc1b90
|
|
| BLAKE2b-256 |
f0c642c75ed5a3601af29c2c8c5f130b2867cb882569213655c7d5a3f09099c8
|
File details
Details for the file onyx_cli-1.0.1-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: onyx_cli-1.0.1-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 6.3 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f8eadc77e02b4720946978c45100f1c76278ee4b2aab6af7921db4d7f6b2fcb
|
|
| MD5 |
48cc9556bbd98aa8140b70d70a460c4f
|
|
| BLAKE2b-256 |
10a32a02fe7fd9336ac30514a6732584b94d1c6534b3231c25861c0862889287
|
File details
Details for the file onyx_cli-1.0.1-py3-none-manylinux_2_17_aarch64.whl.
File metadata
- Download URL: onyx_cli-1.0.1-py3-none-manylinux_2_17_aarch64.whl
- Upload date:
- Size: 5.7 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abec993ab0deae432eefefc0c84b68ebb09c9c390aa7f3a2166f53236cc338ae
|
|
| MD5 |
66eb196c03d59e31b0b88cb7ec823a30
|
|
| BLAKE2b-256 |
82bf1577f072b1079d45c2bea7edfad5bf24992d982d7949eec1632fec0506b2
|
File details
Details for the file onyx_cli-1.0.1-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: onyx_cli-1.0.1-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.9 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d1fe3ba03045a226496a46482f0055b530a8e0add5c4c8ea39e41d9dbec5e6a
|
|
| MD5 |
d19a243a1ce428917654111117a646de
|
|
| BLAKE2b-256 |
e22b9605551c4b787d3effe7af32c3f2a7ea9dd910215bd536d6551f9811b297
|
File details
Details for the file onyx_cli-1.0.1-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: onyx_cli-1.0.1-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 6.4 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
649c1ff9ed567ee5875ceb4c832f23cd047cf1d29a33c09fb188c08a466c58b6
|
|
| MD5 |
e2e732bdea0cd6256d8826c15c5d9346
|
|
| BLAKE2b-256 |
64e75df33bddf7b3987099ae1138a78a22fb745c8ed29739de5fdd9ab8dba31b
|