# AI Shell
## Setup
> The minimum supported version of Node.js is v14
1. Install _ai shell_:
```sh
npm install -g @builder.io/ai-shell
```
2. Retrieve your API key from [OpenAI](https://platform.openai.com/account/api-keys)
> Note: If you haven't already, you'll have to create an account and set up billing.
3. Set the key so ai-shell can use it:
```sh
ai-shell config set OPENAI_KEY=
```
This will create a `.ai-shell` file in your home directory.
## Usage
```bash
ai
```
For example:
```bash
ai list all log files
```
Then you will get an output like this, where you can choose to run the suggested command, revise the command via a prompt, or cancel:
```bash
◇ Your script:
│
│ find . -name "*.log"
│
◇ Explanation:
│
│ 1. Searches for all files with the extension ".log" in the current directory and any subdirectories.
│
◆ Run this script?
│ ● ✅ Yes (Lets go!)
│ ○ 📝 Revise
│ ○ ❌ Cancel
└
```
### Special characters
Note that some shells handle certain characters like the `?` or `*` or things that look like file paths specially. If you are getting strange behaviors, you can wrap the prompt in quotes to avoid issues, like below:
```bash
ai 'what is my ip address'
```
### Silent mode (skip explanations)
You can disable and skip the explanation section by using the flag `-s` or `--silent`
```bash
ai -s list all log files
```
or save the option as a preference using this command:
```bash
ai-shell config set SILENT_MODE=true
```
### Upgrading
Check the installed version with:
```bash
ai-shell --version
```
If it's not the [latest version](https://github.com/BuilderIO/ai-shell/tags), run:
```bash
npm update -g @builder.io/ai-shell
```
## Common Issues
### 429 error
Some users are reporting a 429 from OpenAI. This is due to incorrect billing setup or excessive quota usage. Please follow [this guide](https://help.openai.com/en/articles/6891831-error-code-429-you-exceeded-your-current-quota-please-check-your-plan-and-billing-details) to fix it.
You can activate billing at [this link](https://platform.openai.com/account/billing/overview). Make sure to add a payment method if not under an active grant from OpenAI.
## Motivation
I am not a bash wizard, and am dying for access to the copilot CLI, and got impatient.
## Contributing
If you want to help fix a bug or implement a feature in [Issues](https://github.com/BuilderIO/ai-shell/issues) (tip: look out for the `help wanted` label), checkout the [Contribution Guide](CONTRIBUTING.md) to learn how to setup the project.
## Credit
- Thanks to Github Copilot for their amazing tools and the idea for this
- Thanks to Hassan and his work on [aicommits](https://github.com/Nutlope/aicommits) which inspired the workflow and some parts of the code and flows
## Community
Come join the [Builder.io discord](https://discord.gg/EMx6e58xnw) and chat with us in the #ai-shell-general room