{"id":28369848,"url":"https://github.com/interwebologist/nerdprompt","last_synced_at":"2026-04-11T04:32:41.832Z","repository":{"id":287505029,"uuid":"964953315","full_name":"interwebologist/NerdPrompt","owner":"interwebologist","description":"🧠 Colorful Perplexity.AI search for Terminal Hackers: AI assistant designed for the tricked out terminal. AI responses with code syntax highlighting, ascii or Unicode custom dividers, emoji bullet points, match your current VIM theme with colored headers, sprinkle in bold and italic text. Should work with OpenAI API's Cohere, Anthropic, \u0026 ChatGPT.","archived":false,"fork":false,"pushed_at":"2025-06-03T12:06:41.000Z","size":3862,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T22:14:50.878Z","etag":null,"topics":["anthropic","anthropic-claude","artificial-intelligence","bbs","chatgpt","cohere","cohere-ai","llm","openai","openai-api","perplexity","perplexity-ai","terminal","terminal-based","vim"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interwebologist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-12T05:09:15.000Z","updated_at":"2025-06-03T12:06:43.000Z","dependencies_parsed_at":"2025-05-27T12:22:19.894Z","dependency_job_id":"ef285d8c-d342-4f63-a809-2fe3e67ec202","html_url":"https://github.com/interwebologist/NerdPrompt","commit_stats":null,"previous_names":["interwebologist/perplexed_cli","interwebologist/terminal-perplexity","interwebologist/nerdprompt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/interwebologist/NerdPrompt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interwebologist%2FNerdPrompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interwebologist%2FNerdPrompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interwebologist%2FNerdPrompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interwebologist%2FNerdPrompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interwebologist","download_url":"https://codeload.github.com/interwebologist/NerdPrompt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interwebologist%2FNerdPrompt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260124097,"owners_count":22962207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anthropic","anthropic-claude","artificial-intelligence","bbs","chatgpt","cohere","cohere-ai","llm","openai","openai-api","perplexity","perplexity-ai","terminal","terminal-based","vim"],"created_at":"2025-05-29T06:00:28.067Z","updated_at":"2025-12-30T21:48:50.120Z","avatar_url":"https://github.com/interwebologist.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 NerdPrompt\n\n## 🎬 Demo\n\n\u003cdiv align=\"center\"\u003e\n\n![NerdPrompt Demo](NerdPrompt_Demo_Best.gif)\n\n\u003c/div\u003e\n\n**AI formatted for tricked out terminals now with customizable ANSI colors, emojis, ASCII art dividers, code detection and code syntax highlighting with follow up questions (threads)** (Currently tested with Perplexity.AI, should work with ChatGPT, Claude, Cohere)\n\nIn the default mode NerdPrompt keeps context while asking follow up questions, but you can clear context to reset the thread topic and keep going.\n\n**Options:**\n- `-n` / `--nothread`: Output the response end execution. Great for quick answers though its easy enough to keep a tmux pane with rolling execution where you clear for new questions or just continue the thread. \n- `-p` / `--prompt`: 'default', 'concise', 'command', but you can set your own. Default system prompt focuses on colorful output, examples, for the computer professional. 'concise' prompt for shrinking answers to fewest tokens possible, and 'command' for only responding with the command you asked for.\n- `-m` / `--model`: Overrides the LLM models setting set in config.yaml. Available models: `sonar`, `sonar-pro`, `sonar-reasoning`, `sonar-research-pro`, `sonar-deep-research` if using Perplexity.AI. Check your OpenAPI provider for these values.\n- `-r` / `--raw`: Output raw markdown without NerdPrompt additions - perfect for AI agents web searching tooling. Skips converting for terminal , so faster as well. \n- `--paste`: Paste mode for multiline input - accepts piped content or interactive paste ('Enter' to skip line after pasted text and Ctrl+D to get response ). Piped input processes content then exits gracefully; interactive paste mode allows follow-up questions. \n\n## Screenshots\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"images/10.png\" alt=\"Terminal output showing syntax-highlighted code blocks with custom dividers\" width=\"700\"\u003e\n\n\n\u003c/div\u003e\n\n### No-Thread Mode: Command-Only Response and Exit\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"images/nothread-exit.png\" alt=\"No-thread mode demonstration showing command-only response with immediate exit\" width=\"700\" height=\"177\"\u003e\n\u003c/div\u003e\n\n### NeoVim Integration\n**Set up with \"leader key + np hotkey\" [HERE](https://github.com/interwebologist/neovim_config/blob/fd8320c6e7d1a5ed117c335bf4a620bad66f6995/init.lua#L32-L50)**\n\nWith Noice installed, this provides a popup floating in the middle of the screen before splitting to run NerdPrompt.\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"images/Neovim1.png\" alt=\"NerdPrompt integration with NeoVim showing popup and split screen functionality\" width=\"700\"\u003e\n\u003c/div\u003e\n\n---\n\n## 🚀 Features\n\n- **Custom terminal styling**: Emoji, ANSI colors, or ASCII-enhanced bullet points\n- **Flexible dividers**: Horizontal dividers for content and code blocks\n- **Custom headers**: Match your terminal/vim theme colors with underlines and styling\n- **Rich text formatting**: Bold, italic, and combined formatting rendered in terminal\n- **Clean output**: Removes citation markers like \"[1]\" for cleaner Perplexity.ai responses\n- **Syntax highlighting**: 40+ Pygments themes for code blocks with custom dividers\n- **Multiple system prompts**: Choose between 'default', 'concise', or 'command' modes, or create custom prompts in config.yaml\n- **Raw output mode**: Perfect for AI agents and integration with other tools\n\n---\n\n## 🔧 Installation\n\nFollow these steps to install Nerd Prompt:\n\n1. **Clone the repository:**\n\n    ```\n    git clone https://github.com/interwebologist/NerdPrompt.git\n    cd NerdPrompt\n    ```\n\n2. **Create and activate a virtual environment (recommended):**\n\n    ```\n    python3 -m venv venv\n    # On Linux or macOS:\n    source venv/bin/activate\n    # On Windows:\n    venv\\Scripts\\activate\n    ```\n\n3. **Install dependencies:**\n\n    ```\n    pip install -r requirements.txt\n    ```\n\n4. **Set up your API key (see below).**\n\n---\n\n**Note:**  \nUsing a virtual environment (`venv`) keeps dependencies isolated from your system Python and is best practice for Python projects.\n\n---\n\n## 🔑 Setting Up Your API Key\n\nTo use **Nerd Prompt**, you need an API key from Perplexity.ai. Here's how to get it:\n\n1. **Log in to Perplexity.ai**: Visit [www.perplexity.ai](https://www.perplexity.ai) and log in to your account.\n2. **Navigate to Settings**: Click on the **Settings** icon (bottom-left corner).\n3. **Access the API Tab**: Select the **API** tab from the menu.\n4. **Generate or Copy Your API Key**: Click \"Generate API Key\" if you don't already have one, or copy your existing key.\n5. Save your API key securely.\n\n---\n\n## 🛠️ Configuring Your API Key\n\n1. Create a `.env` file in the project directory:\n\n```bash\ntouch .env\n```\n\n2. Add your API key to the `.env` file:\n\n```plaintext\nAPI_KEY=your_api_key_here\n```\n\n3. The project will automatically load the key from the `.env` file when you run it.\n\n---\n\n## 🖥️ Usage Instructions\n\n### Basic Usage\nRun the script with your query as an argument:\n\n```bash\npython nerdprompt.py \"What is the capital of France?\"\n```\n\n### System Prompt Selection\nChoose different response styles with the `-p` flag:\n\n```bash\n# Default prompt (detailed responses)\npython nerdprompt.py \"Explain Python decorators\"\n\n# Concise prompt (token-efficient responses)\npython nerdprompt.py -p concise \"Explain Python decorators\"\n\n# Custom prompt (add your own in config.yaml)\npython nerdprompt.py -p custom \"Tell me about the weather\"\n```\n\n### Model Selection\nOverride the default model from config.yaml:\n\n```bash\npython nerdprompt.py -m sonar-reasoning -p concise \"Analyze the trade-offs of microservices\"\n```\n\n### Raw Output Mode\nFor AI agents or piping to other tools:\n\n```bash\npython nerdprompt.py --raw \"What is Docker?\"\npython nerdprompt.py -p concise --raw \"Explain APIs\"\n```\n\n### Paste Mode\nFor multiline input and code analysis - solves copy-paste repetition issues:\n\n```bash\n# Interactive paste mode - paste content and press Ctrl+D\npython nerdprompt.py --paste\n\n# Pipe files or code directly\ncat script.py | python nerdprompt.py --paste\necho \"def broken():\n    x = 5\n    if x \u003e 3\n        print('broken')\" | python nerdprompt.py --paste\n\n# Combine question with code using bash\n(echo \"What's wrong with this code?\" \u0026\u0026 cat broken_script.py) | python nerdprompt.py --paste\necho -e \"Optimize this function:\\n$(cat my_code.py)\" | python nerdprompt.py --paste\n```\n\n**Pro Tip:** Create a bash function for easy code analysis:\n```bash\n# Add to your ~/.bashrc or ~/.zshrc\nanalyze() {\n    (echo \"$1\" \u0026\u0026 cat \"${@:2}\") | nerdprompt --paste --nothread\n}\n\n# Usage examples:\nanalyze \"What's wrong with this code?\" broken_script.py\nanalyze \"Optimize this function\" my_code.py\nanalyze \"Add error handling to:\" api_client.py\n```\n\n**Use Case:** Eliminates the issue where copying/pasting multiline content causes the same query to run multiple times.\n\n### No Thread Mode\nExit after showing response without threading capability:\n\n```bash\n# No threading - returns only the answer and exits\npython nerdprompt.py --nothread \"What is Python?\"\npython nerdprompt.py -n \"Explain machine learning\"\n\n# Command-only responses (perfect for getting specific commands)\npython nerdprompt.py -p command -n \"roll back git commit 1 commit\"\npython nerdprompt.py -p command --nothread \"list all docker containers\"\n```\n\n**Pro Tip:** Set up an alias to run commands without activating the Python environment:\n\n```bash\n# Add to your ~/.bashrc or ~/.zshrc\nalias nerdprompt=\"/path/to/your/NerdPrompt/venv/bin/python /path/to/your/NerdPrompt/nerdprompt.py\"\n\n# Usage examples:\nnerdprompt \"What is Docker?\"\nnerdprompt -p concise \"Explain APIs\"\nnerdprompt -p command -n \"list all running processes\"\n```\n\n---\n\n## ✨ Markdown Formatting in Terminal\n\nThe tool supports formatting for the Terminal:\n\n- **Headers** are styled with different colors. Example:\n    - Green for `# Header`\n    - Blue for `## Subheader`\n    - Red for `### Sub-subheader`\n- Text styling includes:\n    - **Bold**\n    - *Italic*\n    - ***Bold Italic***\n- Emoji-enhanced bullet points like 🚀, 🔥, and ✨ add personality to your terminal output.\n- Add your own ASCII art dividers or dividers with emoji's\n\n---\n\n## 💡 Best Practices\n\n- **Security**: Keep your API key private and never share it publicly\n- **Credits**: Ensure sufficient credits in your Perplexity.ai account (Pro users receive $5/month free credits at time of writing)\n- **Compatibility**: Requires Python 3.8 or higher\n- **Performance**: Use virtual environments to isolate dependencies\n\n---\n\n## ❓ Troubleshooting\n\nIf you encounter issues:\n\n1. **API Key Issues**: Ensure your `.env` file contains a valid API key\n2. **Dependencies**: Verify all dependencies are installed (`pip install -r requirements.txt`)\n3. **Account Status**: Check your Perplexity.ai account for sufficient credits and active API keys\n4. **Python Version**: Confirm you're using Python 3.8 or higher\n5. **Virtual Environment**: Make sure your virtual environment is activated\n\nFor additional support, consult [Perplexity's Help Center](https://www.perplexity.ai/help-center).\n\n---\n\n## 🎨 Code Syntax Highlighting Themes\n\nThis project uses [Pygments](https://pygments.org/) for code syntax highlighting. You can customize the appearance of code blocks by selecting one of the many available Pygments styles. For a live preview of each theme, visit the [Pygments demo page](https://pygments.org/demo/).\n\n**To set a style, configure your formatter in the config.yaml with the desired style name.**  \nFor example, in Python:\n\n### Available Code Styles\n\nBelow is a list of supported syntax highlighting themes:\n\n- abap\n- algol\n- algol_nu\n- arduino\n- autumn\n- bw\n- borland\n- coffee\n- colorful\n- default\n- dracula\n- emacs\n- friendly_grayscale\n- friendly\n- fruity\n- github-dark\n- gruvbox-dark\n- gruvbox-light\n- igor\n- inkpot\n- lightbulb\n- lilypond\n- lovelace\n- manni\n- material\n- monokai\n- murphy\n- native\n- nord-darker\n- nord\n- one-dark\n- paraiso-dark\n- paraiso-light\n- pastie\n- perldoc\n- rainbow_dash\n- rrt\n- sas\n- solarized-dark\n- solarized-light\n- staroffice\n- stata-dark\n- stata-light\n- tango\n- trac\n- vim\n- vs\n- xcode\n- zenburn\n\nEnjoy using **Nerd Prompt**! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterwebologist%2Fnerdprompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterwebologist%2Fnerdprompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterwebologist%2Fnerdprompt/lists"}