{"id":13637090,"url":"https://github.com/efJerryYang/chatgpt-cli","last_synced_at":"2025-04-19T08:33:46.463Z","repository":{"id":97548401,"uuid":"608649563","full_name":"efJerryYang/chatgpt-cli","owner":"efJerryYang","description":"A markdown-supported command-line interface tool that connects to ChatGPT using OpenAI's API key.","archived":false,"fork":false,"pushed_at":"2023-05-29T07:42:04.000Z","size":12074,"stargazers_count":47,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-18T19:15:53.011Z","etag":null,"topics":["chatbot","chatgpt","chatgpt-cli","cli","command-line","markdown","openai"],"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/efJerryYang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2023-03-02T13:10:05.000Z","updated_at":"2024-04-25T22:11:29.000Z","dependencies_parsed_at":"2024-01-06T22:00:48.466Z","dependency_job_id":null,"html_url":"https://github.com/efJerryYang/chatgpt-cli","commit_stats":{"total_commits":71,"total_committers":2,"mean_commits":35.5,"dds":0.05633802816901412,"last_synced_commit":"0f00e99caa3afaede6c13a8a59bf176305cacb7f"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efJerryYang%2Fchatgpt-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efJerryYang%2Fchatgpt-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efJerryYang%2Fchatgpt-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efJerryYang%2Fchatgpt-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/efJerryYang","download_url":"https://codeload.github.com/efJerryYang/chatgpt-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223779657,"owners_count":17201287,"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":["chatbot","chatgpt","chatgpt-cli","cli","command-line","markdown","openai"],"created_at":"2024-08-02T00:01:10.379Z","updated_at":"2024-11-09T06:31:07.205Z","avatar_url":"https://github.com/efJerryYang.png","language":"Python","funding_links":[],"categories":["CLI"],"sub_categories":["Special-purpose"],"readme":"# ChatGPT CLI\n\n[![PyPI](https://img.shields.io/pypi/v/chatgpt-cli-md)](https://pypi.org/project/chatgpt-cli-md/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chatgpt-cli-md)](https://pypi.org/project/chatgpt-cli-md/)\n[![PyPI - License](https://img.shields.io/pypi/l/chatgpt-cli-md)](https://pypi.org/project/chatgpt-cli-md/)\n[![Stars](https://img.shields.io/github/stars/efJerryYang/chatgpt-cli)](https://github.com/efJerryYang/chatgpt-cli/stargazers)\n\n[中文](README_zh.md)\n\n## Introduction\n\nChatGPT CLI is a command-line interface tool that connects to the ChatGPT language model\nusing OpenAI's official API key. It features markdown support, allowing you to structure\nyour inputs in a readable and well-organized format for easier reference. The tool also\nsaves conversations in `JSON` format, you can load them with `!load` command. Commands\nprovided enable you to use this tool much like you would use the official web client. For\nmore command usage, you can type `!help` or see more in the [Commands](#commands) section.\n\nHere is a simple demonstration of how to use it:\n\n![demo](docs/demo/ezgif.com-optimize.gif)\n\n\u003c!-- For more detailed information, please check out the `\u003clink_to_docs\u003e`. --\u003e\n\n## Prequisites\n\nTo run the ChatGPT CLI tool, you'll need to have Python version 3.8 or higher installed on\nyour machine. You can check your Python version by typing `python -V` in your terminal. We\nrequire version at least `3.8` because the feature of `importlib.metadata` is only\navailable from this version. You'll also need an OpenAI API key, which you can easily\n[get here](https://platform.openai.com/account/api-keys).\n\nThe required Python packages can be installed with `pip install -r requirements.txt`,\nwhich includes the following:\n\n- `openai \u003e= 0.27.0`\n- `pyyaml \u003e= 6.0`\n- `rich \u003e= 13.3.1`\n\n## Installation\n\nYou can install ChatGPT CLI by downloading the package from the\n[latest release](https://github.com/efJerryYang/chatgpt-cli/releases) and running either\nof the following commands. Note that you will need to replace `\u003cversion\u003e` with the version\nnumber of the package you downloaded (e.g. `0.1.0`).\n\nYou can also install the package from PyPI by running `pip install chatgpt-cli-md`.\n\n```sh\npip install chatgpt-cli-md-\u003cversion\u003e.tar.gz\n```\n\n```sh\npip install chatgpt_cli_md-\u003cversion\u003e-py3-none-any.whl\n```\n\nThis will automatically install all the required dependencies. You can also build the\nproject and get the binary file to install by cloning the repository from GitHub and\nrunning the following commands:\n\n```sh\ngit clone https://github.com/efJerryYang/chatgpt-cli.git\n```\n\nInstall necessary dependencies:\n\n```sh\npip install -r requirements.txt\n```\n\nBuild the project into package:\n\n```sh\npython -m build\n```\n\nOnce built, you can follow the instructions above to install the package. The built\npackage will be located in `dist` directory.\n\nWe highly recommend that you use the latest version of ChatGPT CLI and install it using\nthe recommended methods for optimal performance and stability.\n\n## Getting Started\n\nAfter installation, you can start the ChatGPT CLI tool by typing `chatgpt-cli` in your\nterminal.\n\n```sh\nchatgpt-cli\n```\n\nIf you are running the tool for the first time, you will be prompted to configure your\n`config.yaml` file, and you can also import the `data` directory from your previous script\nversion. If you do not have a configuration file in the path\n`${HOME}/.config/chatgpt-cli/config.yaml`, you can create a new one with the interactive\nsetup procedure provided by the tool, or you can import the one you have already used in\nyour previous version. If choose to create a new one, You will need to input your OpenAI\nAPI key and proxy settings (if any). You can also get an OpenAI API key\n[here](https://platform.openai.com/account/api-keys) if you do not have one.\n\nAfter configuring your settings, a welcome panel with help information will be displayed,\nand you can start chatting with ChatGPT using a variety of commands.\n\nA template of `config.yaml` is shown below:\n\n```yaml\n# ChatGPT CLI Configuration File\nopenai:\n  api_key: \u003cYOUR_API_KEY\u003e\n  default_prompt:\n    - role: system\n      content: You are ChatGPT, a language model trained by OpenAI. Now you are responsible for answering any questions the user asks.\nproxy:\n  http_proxy: http://127.0.0.1:7890\n  https_proxy: http://127.0.0.1:7890\nchat:\n  use_streaming: true\n```\n\nYou can remove the `proxy` section or leave its value empty if you do not need to use a\nproxy.\n\n## Commands\n\nWe've provided several commands to help you use this tool more conveniently. You don't\nneed to remember all of them at once, as you can type `!help` whenever you want to have a\nlook. The following is a list a available commands:\n\n- `!help` or `!h`: shows the help message\n- `!show`: displays the current conversation messages\n- `!save`: saves the current conversation to a `JSON` file\n- `!load`: loads a conversation from a `JSON` file\n- `!new` or `!reset`: starts a new conversation\n- `!editor` or `!e`: use your default editor (e.g. vim) to submit a message\n- `!regen`: regenerates the last response\n- `!resend`: resends your last prompt to generate response\n- `!edit`: selects messages for editing\n- `!drop`: selects messages for deletion\n- `!exit` or `!quit` or `!q`: exits the program\n\nFeatures (under development):\n\n- `!tmpl` or `!tmpl load`: select a template to use\n- `!tmpl show`: show all templates with complete information\n- `!tmpl create`: create a new template\n- `!tmpl edit`: edit an existing template (not implemented yet)\n- `!tmpl drop`: drop an existing template (not implemented yet)\n\nThese commands are designed to enable you to use this tool much like you would use the\nofficial web client. If you find that you need additional command support, feel free to\nopen an issue.\n\n## Todos\n\nWe have some todos for future improvements, such as:\n\n- [x] Detect `[Ctrl]+[C]` hotkey and prompt to confirm exiting\n- [ ] `!token`: Count tokens in conversation and display the total number\n- [ ] `!sum`: Generate a summary of the conversation to reduce token usage\n- [x] `!tmpl`: Choose system prompt templates\n- [ ] `!conv`: Show conversation list, Delete and Rename saved conversations\n- [ ] `!sys \u003ccommand\u003e`: Enable you to run system command\n\n## Contributing\n\nIf you'd like to contribute to ChatGPT CLI, please feel free to submit a pull request or\nopen an issue!\n\n## References\n\n- The idea of using the `rich.panel` package comes from\n  [mbroton's chatgpt-api](https://github.com/mbroton/chatgpt-api).\n- The `!sum` command for generating a summary of the current conversation to guide the\n  user in continuing the conversation is inspired by 沙漏/u202e.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FefJerryYang%2Fchatgpt-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FefJerryYang%2Fchatgpt-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FefJerryYang%2Fchatgpt-cli/lists"}