Introduction to AI CLI: Simplifying Chat with AI in the Command Line
In the world of modern computing, where AI-driven interfaces are becoming the norm, a tool known as AI CLI stands out by bringing the capabilities of chatGPT and new Bing into the command line interface (CLI). This powerful tool is designed for those who prefer the simplicity and efficiency of a CLI, allowing them to engage in conversations, ask questions, and even translate text directly within the terminal. Additionally, AI CLI supports rendering markdown, making it a versatile tool for developers and content creators alike.
Key Features
Dependencies
AI CLI integrates seamlessly with OpenAI's API, but for those who can't access the default API endpoint, it allows configuration through the OPENAI_API_BASE
environment variable. This offers a stable alternative to using a proxy. Users can leverage Cloudflare Workers to set up an OpenAI API proxy for enhanced stability.
To function, AI CLI requires an OPENAI_API_KEY
, which can be provided through environment variables or specified directly via the --api-key
parameter. Azure OpenAI users also have options to set up their keys and endpoints through specific environment variables.
Additional features include integration with Gemini Pro using the GOOGLE_API_KEY
and support for Bing and Bard Bots, though Bard support is deprecated. For those using Bing, setting a Bing Cookie is essential.
Installation and Configuration
Setting up AI CLI is straightforward. Users can simply run:
pip install py-ai-cli
Alternatively, the latest version can be installed from the GitHub repository. Once installed, configuration is done using the ai setting
command, where API keys and settings can be easily managed.
Usage
AI CLI comes with a variety of commands to facilitate different user needs:
- Automatic Commit Messages: Generates commit messages using AI suggestions.
- Ask a Question: Users can query AI with questions directly in the terminal.
- Translation: Supports translating text into various languages with ease.
- Chatting: Engage in conversations with AI directly from the CLI.
- Code Review: Offers a unique ability to review code, highlighting potential improvements or issues.
Each command is designed with user simplicity in mind, and the functionality is further enhanced with pre-prompt options and no-stream modes.
Proxy Support
AI CLI provides robust proxy support, recommending the use of OPENAI_API_BASE
for stability. It supports various environment variables for HTTP, HTTPS, and SOCKS5 proxies, offering a flexible setup for users with different network configurations.
Conclusion
For those who seek the convenience of a command-line interface combined with the powerful capabilities of AI, AI CLI is an excellent tool. Whether for coding, document translation, or simply to interact with advanced AI models, this CLI tool streamlines processes and enhances productivity. The project benefits from ongoing development and tools provided by JetBrains, ensuring it remains a valuable resource for developers and end-users alike.