Skip to content

About

A CLI access to your Perplexity agent. Token-based access over API only!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

62 Commits

Folders and files

Repository files navigation

agent-plex

A fast, good-looking Perplexity chat for your terminal: researched answers with sources, streamed live, with chat history.

brew install manefunction/tap/agent-plex
pip install agent-plex

plex uses Perplexity's Agent API (/v1/agent). You don't need a Perplexity subscription. The package is called agent-plex; the command it installs is plex.

The API is billed per use with an API key. A Perplexity Pro subscription doesn't cover it. A typical fast answer costs about $0.002, and plex shows the cost under every answer.

You can use it as a full-featured shell with a familiar UI and commands, similar to other popular agentic CLIs like Claude Code or OpenCode.

Or you can get quick answers right in the terminal, without interrupting your work or switching tools.

The main difference with plex is that it's built for quick use, spending minimal time and tokens. Big harnesses use more than 10K tokens on every first message just to "set up" the model. Perplexity is mainly a search-and-summarize engine, and plex is your door to it with nothing in between.

Important

Because of this design, Perplexity doesn't store your context on the server side, and every new message in a chat resends the whole history, which increases the cost. It's not meant for long conversations.

Features

  • Chat UI with streamed answers, inline source citations and the cost of every answer.
  • One-shot mode for scripts: plex "question", and piped input is appended to the question.
  • Effort presets from fast to ultra, or pick a specific model and its reasoning effort.
  • Saved conversations: reopen the last one, search by id or title, rename, delete, or clear everything.
  • History sidebar, command palette, /commands with tab completion, copy the last answer.
  • Themes: ones that keep your terminal's own colors, a few full-color ones, and your own as a small TOML file.
  • Your API key is stored in a file only you can read, or taken from PERPLEXITY_API_KEY.

Installation

Install agent-plex with brew or pip if you can: they also keep it up to date.

  1. brew (Recommended for Mac and Linux users)
    • Run brew tap manefunction/tap && brew trust manefunction/tap in your terminal to add my tap (app source), if you haven't already.
    • Run brew install agent-plex to install the app.
    • Verify the installation with plex --version.
    • That's it: run plex from any folder.
  2. pip (Recommended for everyone with a Python environment)
    • Check that you have Python 3.11 or newer: run python --version in your terminal. Mac and Linux usually have it already; on Windows, get it from the official website.
    • Run pip install agent-plex to install the app from PyPI. On a Mac you may need pip3 instead of pip. The package is called agent-plex; the command is plex.
    • Verify the installation with plex --version.
    • That's it: run plex from any folder.
  3. From source (for advanced users)
    • Clone the repository or download the source code from GitHub.
    • Go to the folder with the code in your terminal and run pip install .
    • Verify the installation with plex --version.

Usage

Log in

plex auth login           # paste a key from https://www.perplexity.ai/account/api

This works like opencode: the key is stored in ~/.local/share/plex/auth.json with mode 600. You can also just start plex, and it will ask for a key the first time. PERPLEXITY_API_KEY in the environment takes precedence over the stored key.

Command
plex auth status shows which key is in use (masked)
plex auth logout removes the stored key

Chat

plex                      # open the chat
plex -r                   # reopen the last conversation
plex -o "python"          # reopen a conversation by id or title text
plex --history            # list saved conversations
plex --clear              # delete all saved conversations (asks y/n first)

plex "what's new in Python 3.15?"      # one-shot: print the answer and exit
git diff | plex "review this"          # piped input is appended to the question
plex -p high "compare uv and pip"      # pick an effort preset
plex -m openai/gpt-6-luna -e high "…"  # a specific model and its effort

Keys

Key Action
enter send
shift+enter / alt+enter / ctrl+j new line
↑ / ↓ on an empty prompt recall earlier questions
esc cancel the answer being written
ctrl+n new chat
ctrl+s history sidebar
ctrl+e effort preset picker
ctrl+p command palette
ctrl+q quit

Commands

Type / to see suggestions, then press tab to complete.

Command
/new, /clear new conversation
/history browse history
/preset [level] effort preset: fast · low · medium · high · xhigh · ultra (drops a selected model)
/effort [level] effort for the selected model: minimal · low · medium · high · xhigh · max · default (in preset mode, asks for a model first)
/model [id] / /model off pick a model from the list your key can use, or give an id (e.g. perplexity/sonar) / go back to presets
/search [on|off] toggle web search
/sources sources of the last answer
/copy copy the last answer
/rename <title> rename this conversation
/delete delete this conversation
/theme change the theme
/login set the API key
/help keys and commands
/quit, /exit exit

Files

Path
~/.local/share/plex/auth.json API key (0600)
~/.local/share/plex/sessions/*.json conversations, saved after every answer; ones not updated in 64 days (keep_days) are deleted when plex starts
~/.local/share/plex/state.json last used effort, model, reasoning effort, search and theme, plus the model last seen for each effort level
~/.config/plex/config.toml optional defaults (see below)

Themes

Theme Description
terminal (default) Your terminal's own background, text and palette, accent included, so it fits any color scheme, light or dark
terminal-coral, terminal-green, terminal-violet Your terminal's own background, text and palette, plus a single accent color
tokyo-night, catppuccin-mocha, dracula, gruvbox Full-color themes with their own palettes
matrix Mostly just a gimmick. terminal-green with dim digital rain falling behind the chat.

Each theme is one TOML file, named after the theme. The bundled ones live in src/plex_cli/themes/. To add your own, put a file in ~/.config/plex/themes/ ($XDG_CONFIG_HOME/plex/themes/ if that's set, on Linux and macOS alike). plex creates this folder the first time you open the chat UI (one-shot questions don't), with an empty PUT_YOUR_THEMES_HERE file in it. Your themes are loaded alongside the bundled ones and show up in /theme the next time plex starts. A file with the same name as a bundled theme replaces it. Files with mistakes are skipped, and plex tells you why at startup.

A terminal-style theme needs just an accent:

# ~/.config/plex/themes/terminal-teal.toml
terminal = true       # use the terminal's own background, text and palette
accent = "#2AA198"    # any hex color, or a terminal color like "ansi_cyan"
# effect = "rain"     # optional animated background (the one `matrix` uses)

A full-color theme sets its own colors (primary is required, the rest are optional):

# ~/.config/plex/themes/my-theme.toml
primary = "#88C0D0"     # highlights
secondary = "#81A1C1"   # your messages, key hints
accent = "#EBCB8B"      # answer bar, focused input
warning = "#EBCB8B"
error = "#BF616A"
success = "#A3BE8C"
foreground = "#D8DEE9"  # text
background = "#2E3440"
surface = "#3B4252"     # sidebar, menus, dialogs
panel = "#434C5E"       # borders
dark = true             # false for light themes

[variables]             # optional fine-tuning with Textual theme variables
border = "#88C0D0"

Notes

plex is built on the Perplexity Python SDK, Textual and Rich. It is an unofficial client and is not affiliated with Perplexity AI.

Author

agent-plex is made by Ilia Petrov-Komotskii (Mane Function). If it saves you time, you can support it on GitHub Sponsors.

Repository info

This repo follows the Conventional Commits specification.

GitHub release (latest by date) GitHub All Releases PyPI version PyPI downloads GitHub Sponsors

About

A CLI access to your Perplexity agent. Token-based access over API only!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Contributors

Languages