{"id":13585070,"url":"https://github.com/ricklamers/shell-ai","last_synced_at":"2025-05-15T11:03:52.988Z","repository":{"id":189585046,"uuid":"680918523","full_name":"ricklamers/shell-ai","owner":"ricklamers","description":"LangChain powered shell command generator and runner CLI","archived":false,"fork":false,"pushed_at":"2024-06-03T11:05:23.000Z","size":91,"stargazers_count":1009,"open_issues_count":6,"forks_count":61,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-10-29T15:48:43.291Z","etag":null,"topics":["automation","cli","gpt","langchain","llm","openai","shell"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ricklamers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-20T20:26:06.000Z","updated_at":"2024-10-29T01:42:30.000Z","dependencies_parsed_at":"2023-08-20T21:37:02.418Z","dependency_job_id":"aa1efc72-c819-4cdf-9d02-c542af60621f","html_url":"https://github.com/ricklamers/shell-ai","commit_stats":{"total_commits":53,"total_committers":12,"mean_commits":4.416666666666667,"dds":0.3207547169811321,"last_synced_commit":"9a6ba10cb17bbc08818119add8dac5a4ab61d4b1"},"previous_names":["ricklamers/ai-shell"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricklamers%2Fshell-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricklamers%2Fshell-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricklamers%2Fshell-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricklamers%2Fshell-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ricklamers","download_url":"https://codeload.github.com/ricklamers/shell-ai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248912233,"owners_count":21182238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","cli","gpt","langchain","llm","openai","shell"],"created_at":"2024-08-01T15:04:43.536Z","updated_at":"2025-05-15T11:03:52.969Z","avatar_url":"https://github.com/ricklamers.png","language":"Python","funding_links":[],"categories":["Python","CLIs"],"sub_categories":[],"readme":"# Shell-AI: let AI write your shell commands\n\n[![PyPI version](https://badge.fury.io/py/shell-ai.svg)](https://pypi.org/project/shell-ai/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Forks](https://img.shields.io/github/forks/ricklamers/shell-ai)](https://github.com/ricklamers/shell-ai/network)\n[![Stars](https://img.shields.io/github/stars/ricklamers/shell-ai)](https://github.com/ricklamers/shell-ai/stargazers)\n\n\nShell-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](https://github.com/langchain-ai/langchain) for LLM use and builds on the excellent [InquirerPy](https://github.com/kazhala/InquirerPy) for the interactive CLI.\n\n![demo-shell-ai](https://github.com/ricklamers/shell-ai/assets/1309307/b4057165-5c23-46d4-b68e-00915b738dc3)\n\n## Installation\n\nYou can install Shell-AI directly from PyPI using pip:\n\n```bash\npip install shell-ai\n```\n\nNote that on Linux, Python 3.10 or later is required.\n\nAfter installation, you can invoke the utility using the `shai` command.\n\n## Usage\n\nTo use Shell-AI, open your terminal and type:\n\n```bash\nshai run terraform dry run thingy\n```\n\nShell-AI will then suggest 3 commands to fulfill your request:\n- `terraform plan`\n- `terraform plan -input=false`\n- `terraform plan`\n\n## Features\n\n- **Natural Language Input**: Describe what you want to do in plain English (or other supported languages).\n- **Command Suggestions**: Get single-line command suggestions that accomplish what you asked for.\n- **Cross-Platform**: Works on Linux, macOS, and Windows.\n- **Azure Compatibility**: Shell-AI now supports Azure OpenAI deployments.\n\n## Configuration\n\nShell-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).\n\n### Environment Variables\n\n- `OPENAI_API_KEY`: (Required) Your OpenAI API key, leave empty if you use ollama\n- `OPENAI_MODEL`: The OpenAI model to use (default: \"gpt-3.5-turbo\")\n- `OPENAI_API_BASE`: The OpenAI API / OpenAI compatible API endpoint to use (default: None)\n- `GROQ_API_KEY`: (Required if using Groq) Your Groq API key\n- `SHAI_SUGGESTION_COUNT`: Number of suggestions to generate (default: 3)\n- `SHAI_SKIP_CONFIRM`: Skip command confirmation when set to \"true\"\n- `SHAI_SKIP_HISTORY`: Skip writing to shell history when set to \"true\"\n- `SHAI_API_PROVIDER`: Choose between \"openai\", \"ollama\", \"azure\", or \"groq\" (default: \"groq\")\n- `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.\n- `CTX`: Enable context mode when set to \"true\" (Note: outputs will be sent to the API)\n- `OLLAMA_MODEL`: The Ollama model to use (default: \"phi3.5\")\n- `OLLAMA_API_BASE`: The Ollama endpoint to use (default: \"http://localhost:11434/v1/\")\n\n### Config File Example\n\n```json\n{\n  \"OPENAI_API_KEY\": \"your_openai_api_key_here\",\n  \"OPENAI_MODEL\": \"gpt-3.5-turbo\",\n  \"SHAI_SUGGESTION_COUNT\": \"3\",\n  \"CTX\": true\n}\n```\n\n### Config Example for OpenAI compatible\n\n```json\n{\n   \"SHAI_API_PROVIDER\": \"openai\",\n   \"OPENAI_API_KEY\": \"deepseek_api_key\",\n   \"OPENAI_API_BASE\": \"https://api.deepseek.com\",\n   \"OPENAI_MODEL\": \"deekseek-chat\",\n   \"SHAI_SUGGESTION_COUNT\": \"3\",\n   \"SHAI_SUGGESTION_COUNT\": \"3\",\n   \"CTX\": true\n}\n```\n\n### Config Example for Ollama\n```json\n   {\n   \"OPENAI_API_KEY\":\"\",\n   \"SHAI_SUGGESTION_COUNT\": \"3\",\n   \"SHAI_API_PROVIDER\": \"ollama\",\n   \"OLLAMA_MODEL\": \"phi3.5\",\n   \"OLLAMA_API_BASE\": \"http://localhost:11434/v1/\",\n   \"SHAI_TEMPERATURE\": \"0.05\"\n   }\n```\nThe application will read from this file if it exists, overriding any existing environment variables.\n\nRun the application after setting these configurations.\n\n### Using with Groq\n\nTo use Shell AI with Groq:\n\n1. Get your API key from Groq\n2. Set the following environment variables:\n   ```bash\n   export SHAI_API_PROVIDER=groq\n   export GROQ_API_KEY=your_api_key_here\n   export GROQ_MODEL=llama-3.3-70b-versatile\n   ```\n\n## Contributing\n\nThis implementation can be made much smarter! Contribute your ideas as Pull Requests and make AI Shell better for everyone.\n\nContributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nShell-AI is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricklamers%2Fshell-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricklamers%2Fshell-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricklamers%2Fshell-ai/lists"}