ChatGPT Reborn is a Visual Studio Code extension that allows you to use the ChatGPT API to write, refactor, and improve your code.
Search for "ChatGPT Reborn" in the VSCode extension search.
Or install directly:
Or build this extension yourself (see below).
This is a fork of the popular, but now discontinued vscode-chatgpt extension. Full credit to @gencay for building the original extension and open-sourcing it. Note that this version is API-only, the browser code was not open-sourced by Gencay (due to OpenAI ToS issue).
Gencay has released a new extension, "ChatGPT: Genie AI", that is a continuation of his work in an API-only format: https://github.com/ai-genie/chatgpt-vscode
I will be continuing work on this extension, I have some ideas for features that focus on automation. Please understand that this means there are fairly major changes on the horizon in the name of a better dev experience. I suggest building from gencay/vscode-gencay source if you do not want an extension that may occasionally break as it evolves.
As a FOSS advocate, I feel compelled to note that Genie AI is not open-source and it sounds (to me at least) like it may at some point have paid features. I don't have a personal issue with that, it will allow the Genie AI team to spend more time improving their extension. But, you can expect "Reborn" to stay FOSS, and if you're a fan of open-source - feedback, issues, and PRs are welcome.
To set up the project, first clone the repository:
git clone https://github.com/christopher-hayes/vscode-chatgpt-reborn.git
Next, change into the project directory and install the dependencies using Yarn:
cd vscode-chatgpt-reborn
yarn install
You can run the following scripts using Yarn:
yarn run build
yarn run watch
yarn run fmt
yarn run test
To test the vscode-chatgpt-reborn extension in Visual Studio Code, follow these steps:
-
Open the project directory in Visual Studio Code.
-
Press
F5
or clickRun > Start Debugging
in the menu to start a new Extension Development Host instance with the extension loaded. -
In the Extension Development Host instance, test the extension's functionality.
-
Use the Debug Console in the main Visual Studio Code window to view any output or errors.
-
To make changes to the extension, update the code, and then press
Ctrl + Shift + F5
/Cmd + Shift + F5
(or clickRun > Restart Debugging
) to reload the extension. -
Once you are satisfied with your changes, submit a pull request to this repository.
- Let users that are using
gpt-3.5-turbo-16k
know when their prompt is well below 4K tokens. To recommend usinggpt-3.5-turbo
instead to save on costs. - Add way to manage custom prompts in UI.
- Add option to stream directly into the editor.
- Inline diff
- "Smart" actions based on the type of file open.
- "Smart" actions on that run at a project level.
- AI-generated git commit messages
- Support davinci models in place of ChatGPT models
Initial i18n support has been added in v3.15.0
, but I need help translating to different languages. If you're able to help at all see this discussion.
This extension can be used with a proxy if you put the proxy's URL path in the "Api Base Url" config setting.
Update 4.8.2023 - I've set up a proxy for anyone that needs it at https://openai-proxy.dev/v1
. It's running x-dr/chatgptProxyAPI code on CloudFlare Workers.
Yarn - TypeScript - VSCode Extension API - React - Redux - React Router - Tailwind CSS
- The UI is built with TailwindCSS. But, respecting VSCode's UI consistency and theme support is still a priority.
- This does not use VSCode's WebView UI Toolkit. But, I'm open to switching to the WebView UI toolkit since it better aligns with VSCode's UI.
This project is licensed under the ISC License - see the LICENSE file for details.
- ๐ง [Fixes] Fixes bugs with
gpt-4-turbo
context being limited to 4,096 tokens, instead of its full 128,000 context window. - Thank you for the report @xmjiao - ๐ฎ [QoL] Minor improvements to token counting. Token modal now shows full token breakdown. Token counter turns red when above context limit.
- โจ [Feature] Added support for the
gpt-4-1106-preview
model. This model supports 128,000 token input context. The output token limit is 4,096. It's ~3x less expensive thangpt-4
. - Thank you for the suggestion @xmjiao - ๐ฎ [QoL] The context menu items have been consolidated into a single "ChatGPT" submenu to reduce clutter.
- ๐ง [Fixes] Fix highlighting of HTML characters. - Thank you for the PR @ZsgsDesign
- ๐ฎ [QoL] OpenAI is beginning to have different prompt and complete token limits. The model selector now has more specific model info, including token prompt/complete limits.
- ๐ง [Fixes] When HTML code is used in the question, the code should no longer be injected.
- ๐ฎ [QoL] Allow the user to set a proxy/alternative API base URL at the setup screen. - Thank you for the report @zzy-life
- ๐ง [Fixes] The right-click menu had "Add tests" twice, the label for the 2nd one is fixed to be "Add comments". - Thank you for the report @wojtekcz
- ๐ง [Fixes] Bullet points were not showing in ChatGPT's response. - Thank you for the report @wojtekcz
- ๐ง [Fixes] "export to markdown" button was not correctly showing markdown in the export. - Thank you for the report @wojtekcz
- ๐ฉ [Behind the scenes] More of the UI is being separated into components to improve maintainability.
- ๐ [i18n] Fix syntax errors in translation files. - Thank you for the PR @PeterDaveHello
- ๐ [i18n] Taiwan localization improved with native Mandarin translations. - This PR is highly appreciated @PeterDaveHello
- ๐ง [Fixes] Token count calculation bugs fixed. Updated to reflect new OpenAI pricing.
- โจ [Feature] Added support for the
gpt-3.5-turbo-16k
model. This model is a 16,000 token version of GPT-3.5. It's a good option if you need more tokens than the 4,000 token version of GPT-3.5. It's ~2x more expensive thangpt-3.5-turbo
; however, it's still much cheaper thangpt-4
. - Thank you for the PR @raphael2692 - ๐ [i18n] Added Traditional Chinese translation for Taiwan-based users.
- ๐ง [Fixes] Onboarding - Fix api key verification issue relating to the api url config setting. - Thanks for the PR @zzy-life
- ๐ง [Fixes] Onboarding - Fix api key verification not working with proxy api endpoints.
- ๐ [i18n] Translation file refactor to work more predictably. Right-click menu is now translated. - Thanks for the PR @zzy-life
- ๐ง [Fixes] Expanded the VSCode support to version
v1.70.0
(July 2022). Previously it was tov1.73.0
(October 2022). Can lower more if needed. - Thanks for the bug report @zzy-life - ๐ฅ๏ธ [UI] Text about this being a fork has been removed since it's no longer really needed, and clutters the UI. - Thanks for the suggestion @danyalaytekin
- ๐ง [Fixes] Using a proxy causes "unexpected end of JSON" error. - Thanks for the bug report @lvii
- ๐ฅ๏ธ [UI] Made error messages a little more helpful.
- ๐ฅ๏ธ [UI] "Actions" page added. A couple actions are available, more will be added in the future. Automate your workflow with AI!
- ๐ฅ๏ธ [UI] Codeblock buttons are now sticky.
- ๐ฅ๏ธ [UI] UI fixes for light themes.
- ๐ฅ๏ธ [UI] Token breakdown now warns about gpt-4 pricing.
- ๐ [i18n] Initial i18n support, localization is still a work in progress.
- ๐ง [Fixes] Fix 404 error due to invalid API base URL. - Thanks for the bug report @hakula139
- ๐ฅ๏ธ [UI] Add token count UI
- ๐ฅ๏ธ [UI] "Clear" button added for clearning the conversation. Highly recommend using it to avoid expensive token usage with long conversations.
- ๐ฅ๏ธ [UI] Minor tweaks to mini buttons below input box to prefer wrapping on smaller windows and ui fixes to actions menu on smaller windows.
- ๐ง [Fixes] Token counting issues causing
4096
maxTokens config setting to fail. - Thanks for the bug report @PeterDaveHello - ๐ฉ [Behind the scenes] API provider refactor. Moving towards using the
OpenAI
library and its SDK for better maintainability. Note thatbaseUrl
setting should now end in/v1
, which matches OpenAI's SDK forbasePath
.
- ๐ [Security] API key is now stored in VSCode secure storage. It will automatically put your API key in secure storage if you have it in your settings config and then remove it from your settings config. - Thanks for the feature request @flutterrausch
- ๐ฅ๏ธ [UI] Added a "Verbosity" config setting and UI select.
- ๐ฅ๏ธ [UI] User messages will now include a code block if editor text selection is sent.
- ๐ฅ๏ธ [UI] Moved "Feedback", "Settings" and "Export" to "More Actions" menu.
- ๐ฅ๏ธ [UI] New users greeted with a "Getting started" page and API key input.
- ๐ฎ [QoL] Added "Disable Multiple Conversations" setting.
- ๐ฎ [QoL] Added "Minimal UI" setting.
- ๐ง [Fixes] Chat now scrolls to the bottom after context menu actions.
- ๐ง [Fixes] Modified default prompt for adding code comments.
- ๐ง [Fixes] Overlapping issues with tooltips fixed.
- ๐ฅ๏ธ [UI] General UI look/feel updates. Note that these UI upates have a heavy focus on VSCode's UI guidelines and respecting each theme's color palette.
- ๐ฅ๏ธ [UI] Added multiple chats and model selector.
- ๐ฅ๏ธ [UI] Added a model selector. This will only show the models your API key has access to and links to the GPT-4 waitlist if your key does not have access.
- ๐ฉ [Behind the scenes] Refactor to use React+Redux for the UI. This will make it easier to build a dynamic UI.
- ๐ฎ [QoL] Updated scroll behavior. You can now scroll up as code is being generated, or scroll back to the bottom to "re-lock" the auto-scroll.
- ๐ฎ [QoL] When opening code in a new text editor, VSCode should now automatically know how to syntax highlight it.
- ๐ฎ [QoL] Configuring "System message" is now an extension setting.