Cohere CLI is a powerful and user-friendly command-line interface that allows seamless interaction with Cohere's AI models directly from your terminal. With an intuitive interface, streamlined commands, and comprehensive help system, it provides a polished experience for everyday AI interactions. Whether you're looking to engage in multi-turn conversations, perform single-turn web searches, or upload files for analysis, Cohere CLI has you covered.
- Multi-Turn Chat: Engage in extended conversations with Cohere's AI models, maintaining context across multiple interactions.
- Multiple Model Support: Choose between Command R+, Command A (03-2025), and more with the
:m <model>
command. - Single-Turn Web Search: Use the
:w <query>
command to perform quick web searches directly from the terminal. - File Upload: Upload PDF or TXT files (up to 20MB) with the
:u <file>
command for the AI to analyze. - Clear Screen: Use the
:c
command to refresh your terminal display without losing your conversation history. - Debug Mode: Toggle debug mode with
:d
to see detailed information about API requests and responses. - Persistent Memory: Conversations are saved locally, allowing the chat to "remember" context across different sessions.
- Context Injection: Optionally inject real-time context such as your current location and local time/date into the AI's system message.
- Onboarding Process: An interactive setup that guides you through configuring preferences and API key.
- Citation Support: Automatically formats and displays citations from web search results.
- Dynamic Terminal Resizing: Automatically adjusts the chat interface based on your terminal's size for a consistent experience.
Before installing Cohere CLI, ensure that the following dependencies are installed on your system:
curl
- For making API requests and downloading the installerjq
- For parsing JSON responsesgum
- For interactive prompts and UI elementspdftotext
- Optional, required only for PDF file uploads
The installation script will attempt to install these dependencies if they're missing.
-
Download and Run the Installation Script
You can install Cohere CLI by running the following command in your terminal:
curl -sL https://raw.githubusercontent.com/plyght/cohere-cli/main/install.sh | bash
This will install the script to
/usr/local/bin/cohere
, making it available as a system-wide command. -
Manual Installation (Alternative)
If you prefer, you can manually download the script and make it executable:
curl -sL https://raw.githubusercontent.com/plyght/cohere-cli/main/cohere.sh -o cohere.sh chmod +x cohere.sh sudo mv cohere.sh /usr/local/bin/cohere
Once installed, simply type cohere
in your terminal to start a conversation. The following commands are available:
- Regular input: Type any message to engage in a multi-turn conversation
:w <query>
: Perform a single-turn web search (e.g.,:w what is the capital of France?
):u <file>
: Upload a PDF or TXT file (up to 20MB) for analysis (e.g.,:u ~/Documents/report.pdf
):m <model>
: Switch between available models with user-friendly names (e.g.,:m Command A
or:m r+
):i
: Show detailed information about the current model with self-identification:h
: Show all available commands and options:c
: Clear the screen without losing conversation history:d
: Toggle debug mode to see detailed information about API requests/responses:q
: Quit the CLI
Upon first run, the CLI will guide you through an onboarding process to:
- Enter your Cohere API key
- Choose whether to enable location injection
- Choose whether to enable time/date injection
- Choose whether to enable debug mode
These settings are stored in ~/.config/cohere-cli/config.env
and can be edited manually if needed.
Conversation history is stored in ~/.config/cohere-cli/chat-memory.json
and is maintained between sessions.
- Your Cohere API key is stored locally in
~/.config/cohere-cli/config.env
with appropriate file permissions (600) - Configuration directory permissions are set to 700 for enhanced security
- No data is sent to third parties other than to Cohere's API and ipinfo.io (if location injection is enabled)
- File uploads are processed locally and only a snippet (first 2000 characters) is sent to Cohere's API
- Supports multiple Cohere models with user-friendly aliases:
- Command R+: Can be selected using "r+", "command r", "command r+", or "command-r-plus"
- Command A: Can be selected using "a", "command a", "command-a", or "command-a-03-2025"
- User-friendly interface with simplified initial command display
- Comprehensive help system via the
:h
command - Enhanced model information display with the
:i
command - Conversations are maintained using the chat history API
- Web searches utilize Cohere's built-in web connector
- Terminal UI is built with gum for a clean, interactive experience
- JSON processing is handled by jq
- PDF extraction is done with pdftotext (part of Poppler utilities)
See LICENSE file for details.
Contributions are welcome! Feel free to open issues or submit pull requests.