Inspired by the GitHub Copilot X CLI, but open source for everyone.
The minimum supported version of Node.js is v14
-
Install ai shell:
npm install -g @builder.io/ai-shell
-
Choose and configure your AI engine:
-
Retrieve your API key from OpenAI
Note: If you haven't already, you'll have to create an account and set up billing.
-
Set the key so ai-shell can use it:
ai config set OPENAI_KEY=<your openai token>
The default model is
gpt-4.1-nano(most cost-effective). You can change it usingai config set OPENAI_MODEL=<model_name>
-
Get your GigaChat API credentials from AI Platform
-
Configure GigaChat as your AI engine:
ai config set AI_ENGINE=GigaChat ai config set GIGACHAT_KEY=<your gigachat api key>
This will create a .ai-shell file in your home directory. You can change the path to the config file by setting the AI_SHELL_CONFIG_PATH environment variable.
ai <prompt>For example:
ai list all log filesThen you will get an output like this, where you can choose to run the suggested command, revise the command via a prompt, or cancel:
◇ Your script: │ │ find . -name "*.log" │ ◇ Explanation: │ │ 1. Search current directory and subdirectories │ 2. Find files ending with ".log" │ ◆ Run this script? │ ● ✅ Yes (Lets go!) │ ○ 📝 Edit │ ○ 🔁 Revise │ ○ 📋 Copy │ ○ ❌ Cancel └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:
ai 'what is my ip address'ai chatWith this mode, you can engage in a conversation with the AI and receive helpful responses in a natural, conversational manner directly through the CLI:
┌ Starting new conversation │ ◇ You: │ how do I serve a redirect in express │ ◇ AI Shell: In Express, you can use the `redirect()` method to serve a redirect. The `redirect()` method takes one argument, which is the URL that you want to redirect to. Here's an example: \`\`\`js app.get('/oldurl', (req, res) => { res.redirect('/newurl'); }); \`\`\`You can disable and skip the explanation section by using the flag -s or --silent
ai -s list all log filesor save the option as a preference using this command:
ai config set SILENT_MODE=trueYou can customize API endpoints for both engines:
For OpenAI (default: https://api.openai.com/v1):
ai config set OPENAI_API_ENDPOINT=<your proxy endpoint>For GigaChat:
ai config set GIGACHAT_API_ENDPOINT=<your gigachat endpoint>The application supports advanced proxy settings for both engines:
ALL_PROXY settings (separate for each engine):
# For OpenAI ai config set OPENAI_ALLPROXY=<your_proxy_url> # For GigaChat ai config set GIGACHAT_ALLPROXY=<your_proxy_url>Proxy PAC URL (common setting):
ai config set PROXY_PAC_URL=<your_pac_url>The AI Shell's default language is English, but you can easily switch to your preferred language by using the corresponding language keys, as shown below:
| Language | Key |
|---|---|
| English | en |
| Simplified Chinese | zh-Hans |
| Traditional Chinese | zh-Hant |
| Spanish | es |
| Japanese | jp |
| Korean | ko |
| French | fr |
| German | de |
| Russian | ru |
| Ukrainian | uk |
| Vietnamese | vi |
| Arabic | ar |
| Portuguese | pt |
| Turkish | tr |
For instance, if you want to switch to Simplified Chinese, you can do so by setting the LANGUAGE value to zh-Hans:
ai config set LANGUAGE=zh-HansThis will set your language to Simplified Chinese.
To use a more visual interface to view and set config options you can type:
ai configTo get an interactive UI like below:
◆ Set config: │ ● AI Engine (OpenAI) │ ○ [OpenAI] Key │ ○ [OpenAI] Model │ ○ [OpenAI] API Endpoint │ ○ [OpenAI] ALL_PROXY │ ○ [GigaChat] Key │ ○ [GigaChat] Model │ ○ [GigaChat] API Endpoint │ ○ [GigaChat] ALL_PROXY │ ○ [Common] Proxy PAC URL │ ○ Silent Mode │ ○ Language │ ○ Cancel └Check the installed version with:
ai --versionIf it's not the latest version, run:
npm update -g @builder.io/ai-shellOr just use AI shell:
ai updateSome users are reporting a 429 from OpenAI. This is due to incorrect billing setup or excessive quota usage. Please follow this guide to fix it.
You can activate billing at this link. Make sure to add a payment method if not under an active grant from OpenAI.
If you encounter authentication issues with GigaChat:
- Verify your API key is correct
- Ensure your GigaChat account has proper access rights
- Check that your credentials haven't expired
GigaChat has its own rate limiting. If you encounter 429 errors:
- Wait a few moments before retrying
- Check your usage quotas in the Developer Console
I am not a bash wizard, and am dying for access to the copilot CLI, and got impatient.
If you want to help fix a bug or implement a feature in Issues (tip: look out for the help wanted label), checkout the Contribution Guide to learn how to setup the project.
- Thanks to GitHub Copilot for their amazing tools and the idea for this.
- Thanks to Hassan and his work on aicommits, which inspired the workflow and some parts of the code and flows


