Shell-AI (shai
) is a CLI utility that brings the power of natural language understanding to your command line. Simply input what you want to do in natural language, and shai
will suggest single-line commands that achieve your intent. Under the hood, Shell-AI leverages the LangChain for LLM use and builds on the excellent InquirerPy for the interactive CLI.
You can install Shell-AI directly from PyPI using pip:
pip install shell-ai
Note that on Linux, Python 3.10 or later is required.
After installation, you can invoke the utility using the shai
command.
To use Shell-AI, open your terminal and type:
shai run terraform dry run thingy
Shell-AI will then suggest 3 commands to fulfill your request:
terraform plan
terraform plan -input=false
terraform plan
- Natural Language Input: Describe what you want to do in plain English (or other supported languages).
- Command Suggestions: Get single-line command suggestions that accomplish what you asked for.
- Cross-Platform: Works on Linux, macOS, and Windows.
- Azure Compatibility: Shell-AI now supports Azure OpenAI deployments.
Shell-AI can be configured through environment variables or a config file located at ~/.config/shell-ai/config.json
(Linux/MacOS) or %APPDATA%\shell-ai\config.json
(Windows).
OPENAI_API_KEY
: (Required) Your OpenAI API keyGROQ_API_KEY
: (Required if using Groq) Your Groq API keyOPENAI_MODEL
: The OpenAI model to use (default: "gpt-3.5-turbo")SHAI_SUGGESTION_COUNT
: Number of suggestions to generate (default: 3)SHAI_SKIP_CONFIRM
: Skip command confirmation when set to "true"SHAI_SKIP_HISTORY
: Skip writing to shell history when set to "true"SHAI_API_PROVIDER
: Choose between "openai", "azure", or "groq" (default: "groq")SHAI_TEMPERATURE
: Controls randomness in the output (default: 0.05). Lower values (e.g., 0.05) make output more focused and deterministic, while higher values (e.g., 0.7) make it more creative and varied.CTX
: Enable context mode when set to "true" (Note: outputs will be sent to the API)
{
"OPENAI_API_KEY": "your_openai_api_key_here",
"OPENAI_MODEL": "gpt-3.5-turbo",
"SHAI_SUGGESTION_COUNT": "3",
"CTX": true
}
The application will read from this file if it exists, overriding any existing environment variables.
Run the application after setting these configurations.
To use Shell AI with Groq:
- Get your API key from Groq
- Set the following environment variables:
export SHAI_API_PROVIDER=groq export GROQ_API_KEY=your_api_key_here export GROQ_MODEL=llama-3.3-70b-versatile
This implementation can be made much smarter! Contribute your ideas as Pull Requests and make AI Shell better for everyone.
Contributions are welcome! Please read the CONTRIBUTING.md for guidelines.
Shell-AI is licensed under the MIT License. See LICENSE for details.