A command-line tool that translates natural language commands into bash commands using OpenAI's language models.
pip install bgptBefore using bgpt, make sure you have the OPENAI_API_KEY environment variable set with your OpenAI API key. You can also set the OPENAI_BASE_URL environment variable if you are using a custom OpenAI endpoint, and the LLM_MODEL environment variable to change the model. The default model is GPT-4.1-mini.
Example:
export OPENAI_API_KEY="sk-..."
export OPENAI_BASE_URL="https://api.openai.com/v1"
export LLM_MODEL="GPT-4.1-mini"bgpt <natural language command>Examples:
bgpt create a folder named my-folder
bgpt list all files in the current directory
bgpt show me the contents of my_file.txtThe tool will then:
- Generate a bash command based on your input.
- Display the generated command and ask for confirmation.
- Execute the command if you confirm.
- Show the output of the command.
- OPENAI_API_KEY: You must set this environment variable to your OpenAI API key.
- OPENAI_BASE_URL: (Optional) Set this environment variable if you are using a custom OpenAI endpoint.
- LLM_MODEL: (Optional) Set this environment variable to change the model.
- Python 3.8+
- openai Python library
Contributions are welcome! Please submit a pull request with your changes.
Please note that this project is released with a Contributor Covenant Code of Conduct. By participating in this project you agree to abide by its terms.
Note: This tool uses the OpenAI API, so usage will incur costs based on your OpenAI API billing. Please use responsibly.