A command-line interface tool that allows you to interact with OpenAI's GPT models directly from your terminal.
- Node.js (version 14 or higher)
- An OpenAI API key (Get one here)
Since this package isn't published to npm yet, you can install it locally:
- Clone this repository
git clone git@github.com:gasatrya/ai-cli.git
cd ai-cli
- Install dependencies
npm install
- Link the package locally
npm link
Before using the tool, you need to configure your OpenAI API key. You have two options:
When you run the tool for the first time without a configured API key, it will prompt you to enter your OpenAI API key.
Run the configuration menu:
ai-cli config
In the configuration menu, you can:
- Add/Update your API key
- Choose the AI model:
- gpt-4o-2024-11-20
- gpt-4o-mini-2024-07-18
ai-cli
This will start an interactive session where you can:
- Type your questions and get responses from the AI
- Type 'exit' to quit the session
ai-cli> What is the capital of France?
[AI will respond with the answer]
ai-cli> exit
Goodbye!
- Interactive CLI interface
- Markdown rendering for AI responses
- Loading animation while waiting for responses
- Configuration persistence
- Support for multiple GPT models
The configuration is stored in ~/.ai-cli-config.json
in your home directory.