Skip to main content

Onyx CLI

Release CLI PyPI

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 Server URL (default: https://cloud.onyx.app)
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_PAT over 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 (default 15m)
  • --max-session-timeout (default 8h)
  • --rate-limit-per-minute (default 20)
  • --rate-limit-burst (default 40)
  • --rate-limit-cache (default 4096)

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
  • ask output truncated to 50000 bytes by default; full response saved to a temp file. Use --max-output 0 to disable.
  • search stdout stays valid JSON: over the limit, whole results are dropped and a truncation object 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

onyx_cli-1.2.3-py3-none-win_arm64.whl (6.4 MB view details)

Uploaded Python 3Windows ARM64

onyx_cli-1.2.3-py3-none-win_amd64.whl (7.1 MB view details)

Uploaded Python 3Windows x86-64

onyx_cli-1.2.3-py3-none-musllinux_1_2_x86_64.whl (6.9 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

onyx_cli-1.2.3-py3-none-musllinux_1_2_aarch64.whl (6.3 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

onyx_cli-1.2.3-py3-none-manylinux_2_17_x86_64.whl (6.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

onyx_cli-1.2.3-py3-none-manylinux_2_17_aarch64.whl (6.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

onyx_cli-1.2.3-py3-none-macosx_11_0_arm64.whl (6.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

onyx_cli-1.2.3-py3-none-macosx_10_12_x86_64.whl (7.0 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file onyx_cli-1.2.3-py3-none-win_arm64.whl.

File metadata

  • Download URL: onyx_cli-1.2.3-py3-none-win_arm64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using 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}

File hashes

Hashes for onyx_cli-1.2.3-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 689d2eddbfd122aae3bd50488f1e413a4ac03c3310b94718d6e06f51ef46dcdc
MD5 0537f662282ef8c974c37667850d7f87
BLAKE2b-256 ec3c0073231f0a4a5526b13d3ff0ef73a88af0efa8b3a76ed226fd05ab66de7c

See more details on using hashes here.

File details

Details for the file onyx_cli-1.2.3-py3-none-win_amd64.whl.

File metadata

  • Download URL: onyx_cli-1.2.3-py3-none-win_amd64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using 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}

File hashes

Hashes for onyx_cli-1.2.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e8646bb68186395130d6527fd7c156eca11ac14778ceaac7603f924f86de3a93
MD5 7335ded484786f2d04e6fddfca9cdbd7
BLAKE2b-256 221f0185d1b152ca62b1ec1405b19570763a1b58efaff539f7bab9cd63f6a588

See more details on using hashes here.

File details

Details for the file onyx_cli-1.2.3-py3-none-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: onyx_cli-1.2.3-py3-none-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 6.9 MB
  • Tags: Python 3, musllinux: musl 1.2+ x86-64
  • Uploaded using 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}

File hashes

Hashes for onyx_cli-1.2.3-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e8e661457c01ca616a3859a9317a898f02d31de6f8809f8a7bf0c4efe014425c
MD5 1f29b8acfc74c4828e0be10e74f769ee
BLAKE2b-256 54cf9ffa4b1eef1f544bce5197bc1f4597586bb92e366742fbf5fe0907a1e2a9

See more details on using hashes here.

File details

Details for the file onyx_cli-1.2.3-py3-none-musllinux_1_2_aarch64.whl.

File metadata

  • Download URL: onyx_cli-1.2.3-py3-none-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3, musllinux: musl 1.2+ ARM64
  • Uploaded using 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}

File hashes

Hashes for onyx_cli-1.2.3-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 719d4e8155b658fde081ef4fb1a2bf047f39e40814a2b920dcc0aabc50b48534
MD5 a2c3e0ef2977ea823ab196d13f2d4646
BLAKE2b-256 fb3dc1ff0a8b361b714c0915643f899213a8fcc881a7c48021bba3778ee50c95

See more details on using hashes here.

File details

Details for the file onyx_cli-1.2.3-py3-none-manylinux_2_17_x86_64.whl.

File metadata

  • Download URL: onyx_cli-1.2.3-py3-none-manylinux_2_17_x86_64.whl
  • Upload date:
  • Size: 6.9 MB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using 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}

File hashes

Hashes for onyx_cli-1.2.3-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a2b34336ad8109d720f63c934562e30072aa6cc1b93b711f7bbe0771e5fee079
MD5 37311f59550eaafcf8ab1e896a105d2a
BLAKE2b-256 f3f3a955a3c0f88a7426a49946a604042df49776f7ad23718169b625ab6bb3a3

See more details on using hashes here.

File details

Details for the file onyx_cli-1.2.3-py3-none-manylinux_2_17_aarch64.whl.

File metadata

  • Download URL: onyx_cli-1.2.3-py3-none-manylinux_2_17_aarch64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using 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}

File hashes

Hashes for onyx_cli-1.2.3-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 9b7caf61093a393a629076b59ff618d97ecc874a7ede4e521da7e94abd483855
MD5 9d4f655c8f44868196530167845e5397
BLAKE2b-256 25b6e7abd666e22358ee398a1dd394c3c6bdc02f90b141023be1adcb92e39d42

See more details on using hashes here.

File details

Details for the file onyx_cli-1.2.3-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: onyx_cli-1.2.3-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 6.5 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using 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}

File hashes

Hashes for onyx_cli-1.2.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 702e053603f1915252cdec616eaeeefc006824c9bb36187b7aac104c97ed2694
MD5 1c48debc9b6a3f14a0316a03de09c8c6
BLAKE2b-256 565e6b80c69fd582721acfbc62d65ad195ebb58242f07309429072334de0c6f8

See more details on using hashes here.

File details

Details for the file onyx_cli-1.2.3-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: onyx_cli-1.2.3-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using 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}

File hashes

Hashes for onyx_cli-1.2.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6a06027cd1be20a1b482c4062c6b9f03d587521e35fd24d1cc6100facb9b44c0
MD5 3cabb6b4141d85fd5ab327f8d4c5aff7
BLAKE2b-256 5f339d9d18dcadfe75bbbc206946396e732416464429aa87f67f24cb27d5aee3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page