Welcome to the OpenAI-API Compatible Command-Line Chat Application! This versatile tool is designed to work with any OpenAI API-compliant endpoints, allowing you to interact with various AI models, including self hosten models, through a refined terminal interface.
Whether you're seeking quick insights, engaging in in-depth conversations, or working with custom models, this application offers a seamless and feature-rich experience.
Key Features:
- Compatible with OpenAI API and custom endpoints
- Rapid "Training" Sessions for quick insights
- Copy-Paste & Multi-Line Input support
- Aesthetic Terminal Interface with Syntax Highlighting
- Platform Agnostic design (primary testing on Linux)
To use this application, you need to provide an API key. You have several options:
- Use the
--api_key
command-line argument - Set the
OPENWEBUI_KEY
environment variable - Set the
OPENAI_API_TOKEN
environment variable
If no API key is provided, the application will prompt you with these options.
Example:
export OPENAI_API_TOKEN=your_api_key_here
Note that these installations haven't been widely tested. It is possible to execute the python script your self and bypass the installers. Simply manually installing the python library requirements and manually adding your API key to your environment variables.
For those who would like install helpers, I have provided some based on other open source projects.
-
Clone the Repository (or Download the Zip):
git clone https://github.com/christian-taillon/openai-cl.git cd openai-cl
Alternatively, if you've provided a direct download, instruct the user to download and extract the zip, then navigate to its directory in the terminal.
-
Run the Installation Script: Make the installer script executable and run it:
chmod +x install.sh ./install.sh
During the installation, you'll be prompted to set up a virtual environment. If you don't have
virtualenv
installed, you can choose to skip this step.You'll also have the option to set your OpenAI API token as an environment variable. You can either provide your token or skip this step.
-
Usage: Once the installation is complete, you can use the tool from anywhere by typing:
openai-cl
-
Clone the Repository (or Download the Zip): Download the repository zip from the GitHub page or use a Git client if you have one installed.
Once downloaded, extract the zip and navigate to its directory.
-
Run the Installation Script:
Open a PowerShell prompt as administrator. Navigate to the directory containing the installation script and run:
.\install.ps1
You'll have the option to set your OpenAI API token as an environment variable. You can either provide your token or skip this step.
After installation, use the openai-cl
command to start the application:
openai-cl
-h, --help
: Display the help message--api_key <key>
: Provide your API key-m, --model <name>
: Specify the model (default: gpt-4)-l, --l-models
: List available models-s, --software <name>
: Learn about software using its man page-c, --code-helper <file_path>
: Let the AI help you with code from a file--base_url <url>
: Specify the base URL for a custom API endpoint--save_config
: Save the current configuration--clear_config
: Clear the saved configuration
During the chat session, you can use these commands:
help
: Show help messageclear
: Clear the terminal screenexit
: End the interactive sessionraw
ormarkdown
ormd
: Display the last AI response in raw format, preserving markdown syntax
- Type or paste your messages into the terminal
- Submit multi-line messages with
Ctrl+Space
- AI responses appear after the 'AI:' prompt
- Use commands like help, clear, or exit by typing and submitting with
Ctrl+Space
- End the session with
Ctrl+q
-
Using a specific API key:
openai-cl --api_key YOUR_API_KEY_HERE
-
Choosing a different model:
openai-cl -m llama3.2:3b
-
Learning about software using its man page:
openai-cl -s nano
-
Using a custom API host:
openai-cl --base_url https://your-custom-endpoint.com
-
Listing available models:
openai-cl -l
You can list the available models for your configured API using the -l
or --l-models
option. This is particularly useful when working with custom endpoints or to check which models are accessible with your current API key.
openai-cl -l
Train your session with the -s
option on the manpage output of a tool you would like to learn about:
openai-cl -s ssh
Note: You can obtain the non-rendered raw markdown by sending a raw
response to the chat.
List availalbe options:
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
Encountering bugs or have questions? Feel free to open an issue on the GitHub repository.
Remember to keep your API key confidential and never share it in public spaces.