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
Standalone binaries for Linux, macOS, and Windows (amd64/arm64) are also attached
to each cli/v* GitHub release.
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 | Server origin or already-prefixed API base (default: https://cloud.onyx.app) |
ONYX_API_PREFIX |
No | API path prefix (default: /api); set to empty for direct backend access |
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 50000 bytes by default; full response saved to a temp file. Use--max-output 0to disable.searchstdout stays valid JSON: over the limit, whole results are dropped and atruncationobject carries metadata plus the temp file path of the full response.
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"
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 manylinux
- linux/amd64 musllinux
- linux/arm64 manylinux
- linux/arm64 musllinux
- 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
# Build a musllinux-tagged Linux wheel for Alpine/musl environments
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
ONYX_CLI_WHEEL_PLATFORM_TAG=musllinux_1_2_x86_64 \
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.
Metadata
Release files for onyx-cli 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| onyx_cli-1.4.0-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details |
| onyx_cli-1.4.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| onyx_cli-1.4.0-py3-none-musllinux_1_2_x86_64.whl | Python 3 | none | Linux musl 1.2+ x86-64 | Details |
| onyx_cli-1.4.0-py3-none-musllinux_1_2_aarch64.whl | Python 3 | none | Linux musl 1.2+ ARM64 | Details |
| onyx_cli-1.4.0-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| onyx_cli-1.4.0-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| onyx_cli-1.4.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| onyx_cli-1.4.0-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details |
Total release size: 38.7 MB
Release files / onyx_cli-1.4.0-py3-none-win_arm64.whl
| Download URL | onyx_cli-1.4.0-py3-none-win_arm64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
ae873288adf2af4c5f3a5e06b69d81a25d713c96422ba9b51cbe3523e987f75e
|
|
BLAKE2b-256 checksum How to use checksums |
c967b6e03d739b6688c4772258258cf9043c2b77b0f12db4723530424c200cff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"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}
|
Release files / onyx_cli-1.4.0-py3-none-win_amd64.whl
| Download URL | onyx_cli-1.4.0-py3-none-win_amd64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3e451e5a8a5c66309cbd9b67ea2205c4355d085013c5e788b34fd5c722671443
|
|
BLAKE2b-256 checksum How to use checksums |
c0582776d0bef4c726897c3be57730c9bd3008f2101d763ee27478f06cf8c5f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"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}
|
Release files / onyx_cli-1.4.0-py3-none-musllinux_1_2_x86_64.whl
| Download URL | onyx_cli-1.4.0-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
1e80f0db95c45cd438fd3ca9f7309ba19e6251eb127ce4580e469b701755cd00
|
|
BLAKE2b-256 checksum How to use checksums |
cb768f47cc333c66d1fd8145e9c8730f9192b8bc913fc9630e7fc93d89eb739b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"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}
|
Release files / onyx_cli-1.4.0-py3-none-musllinux_1_2_aarch64.whl
| Download URL | onyx_cli-1.4.0-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
1584b0b1970fb027adb773fc617dd67ef4ae3ce2064da3137bf2a30907851495
|
|
BLAKE2b-256 checksum How to use checksums |
230bbcd25b6167eaade5301dbd3f8e795d847b8941ddeb25ffbf77456013ae58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"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}
|
Release files / onyx_cli-1.4.0-py3-none-manylinux_2_17_x86_64.whl
| Download URL | onyx_cli-1.4.0-py3-none-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
8e474bd7038d9f8e7bafdadf811e67c8cf91c09fa757fc81c40be67bc0e61dfc
|
|
BLAKE2b-256 checksum How to use checksums |
ecfe76a72bed3a47a28ca620dc057d7ebc256e94486b4c622d6fabcf681c471a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"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}
|
Release files / onyx_cli-1.4.0-py3-none-manylinux_2_17_aarch64.whl
| Download URL | onyx_cli-1.4.0-py3-none-manylinux_2_17_aarch64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
609047ee7eece91622b2c61ed448be4f7dcef97642b38c947a2839b3154b9686
|
|
BLAKE2b-256 checksum How to use checksums |
c893fc2fa87c48f7663b819c33d0fe63a3e325c76ea95180d35d238673bdf471
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"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}
|
Release files / onyx_cli-1.4.0-py3-none-macosx_11_0_arm64.whl
| Download URL | onyx_cli-1.4.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
465b7e119d5b9666f90506c60529bd1619306612467ae52f68228ca0e0b94665
|
|
BLAKE2b-256 checksum How to use checksums |
97ad0ec6ec1962795114aed7daba1ea82bc2531b53c76277881f8297927e44c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"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}
|
Release files / onyx_cli-1.4.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | onyx_cli-1.4.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
e181487ab44c1db7168867f9daa22e50e3e50294eb0433df7d80f3b68fd1ac30
|
|
BLAKE2b-256 checksum How to use checksums |
106b769a64c453e238791aa2a5ef6c33e85f647c7ff449e088a2f793b86af30b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"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}
|