Introduction to gpt-cli
The gpt-cli is an innovative command-line interface designed to facilitate interaction with large language models (LLMs). This tool offers a seamless way to communicate with advanced AI models directly from your terminal. Ideal for both technical users and those new to command-line environments, gpt-cli emphasizes simplicity and functionality.
Supported Providers
The gpt-cli supports a spectrum of leading AI providers, including:
- OpenAI: Access the renowned ChatGPT and other models.
- Anthropic: Interact with Claude, another sophisticated AI model.
- Google Gemini: Leverage Google's advanced AI capabilities.
- Cohere: Utilize Cohere's unique language models.
- Other Compatible APIs: Support for APIs compatible with OpenAI, such as Together, OpenRouter, and even local models via LM Studio.
A broad compatibility makes gpt-cli a versatile tool for diverse applications.
Key Features
gpt-cli is equipped with several powerful features:
-
Command-Line Interface: Engage with AI models like ChatGPT directly within your terminal, providing a straightforward interaction method without needing a graphical interface.
-
Model Customization: Users have the ability to override default settings such as the model type, temperature, and top_p. This allows for customizing the AI's response behavior according to specific needs.
-
Usage Tracking: Keep track of your API interactions with comprehensive token counts and pricing details.
-
Keyboard Shortcuts: Facilitate efficient use with shortcuts like Ctrl-C to clear, Ctrl-D to exit, and Ctrl-R to regenerate responses.
-
Multi-Line Input: Use multi-line mode for complex queries which require more detailed inputs.
-
Markdown Support: Control markdown formatting during chat sessions, enhancing the readability of responses according to user preferences.
-
Predefined Messages: Set predefined messages for custom assistants to set the tone or pre-establish context for conversations.
-
Multiple Assistants: Swiftly switch back and forth between different assistants, whether they're pre-defined general and developer assistants or your custom configurations.
-
Flexible Configuration: Tailor your experience via a YAML configuration file that specifies assistant behaviors, model parameters, and API keys.
Installation
Installation is straightforward, especially for Linux/OSX users with Python and pip installed:
pip install gpt-command-line
Alternatively, install the latest version from the source:
pip install git+https://github.com/kharvd/gpt-cli.git
Or by cloning the git repository:
git clone https://github.com/kharvd/gpt-cli.git
cd gpt-cli
pip install .
After installation, add the OpenAI API key to your .bashrc
or .zshrc
file to activate functionality immediately.
Usage
Starting a conversation with gpt-cli is as simple as typing gpt
in your terminal. For example, the command can specify different modes such as general
, dev
, or bash
to tailor responses according to context, like programming or command-line scripting.
A variety of optional arguments enable precise control of the session, allowing the user to:
- Disable markdown.
- Change models or adjust parameters like temperature.
- Log interactions and adjust verbosity.
- Input prompts directly or in multi-line form.
Exit the session with :q
or Ctrl-D, clear conversations with :c
or Ctrl-C, and regenerate last responses with :r
or Ctrl-R.
Configuration
The .config/gpt-cli/gpt.yml
file is where users can customize their assistants. It allows setting defaults for the entire tool as well as for each assistant, defining models, message roles, and more.
An example configuration to set a default assistant and model might look like:
default_assistant: dev
markdown: True
openai_api_key: <your_open_ai_key>
assistants:
pirate:
model: gpt-4
temperature: 1.0
messages:
- {role: system, content: "You are a pirate."}
Additional Chat Bots
gpt-cli also supports interaction with models from other popular AI services through specific setup, including Anthropic's Claude, Google Gemini, and Cohere. Simply add the respective API keys to your environment or configuration file to start using these models.
The gpt-cli stands out as a flexible, powerful tool for interacting with cutting-edge AI models directly from your terminal—a must-have for tech enthusiasts and professionals looking to incorporate AI into their workflows.