Purpose
ai-cli is an open-source command-line tool based on GPT-3, designed to let users get answers to CLI commands directly in the terminal. It answers questions by calling OpenAI's GPT-3 model (by default using gpt-3.5-turbo), and is suitable for developers who want to quickly look up command usage or get code suggestions in a terminal environment.
Main capabilities
- Ask GPT-3 questions from the terminal and get answers (command: ai ask [question]).
- Supports managing the OpenAI API key (command: ai auth), and can update or add a new key.
- Provides autocomplete functionality (command: ai autocomplete [SHELL]); follow the prompts to install it.
- Can switch model preference (command: ai model); the default model is gpt-3.5-turbo.
- Supports updating the CLI itself (command: ai update [CHANNEL]).
- Provides help information (command: ai help [COMMAND]).
Usage
First, the tool needs to be installed globally. Then you need to configure your own OpenAI API key: you can do this by visiting https://openai.com/api/login to create or log in to an account, then go to https://beta.openai.com/account/api-keys to get the key, or directly run ai auth in the terminal and enter the API KEY. After installation is complete, you can use commands such as ai ask to interact. Autocomplete can be added via ai autocomplete by following the instructions.
Suitable scenarios
Suitable for developers to quickly look up command-line usage, get code snippets, or technical answers in a terminal environment, without leaving the terminal to call GPT-3.
Limitations
- Requires users to provide their own OpenAI API key.
- The current prompt length is about 800-840 tokens, and the average response length is about 40 tokens. When using gpt-3.5-turbo, input costs $0.001 per 1K tokens and output costs $0.002 per 1K tokens, making each command cost about $0.0009. Earlier materials mentioning text-davinci-002 stated a cost of $0.02 per 1K tokens, or about $0.017 per command.
- The project states that in the future it may improve responses and reduce the cost per command through fine-tuning.