SuperAPI AI Directory

chatgpt-vscode

VS Code extension for ChatGPT-powered coding support.

Open website

About this tool

Genie is a Visual Studio Code extension designed to integrate OpenAI's GPT-4, GPT-3.5, GPT-3, and Codex models into VS Code, providing an AI pair programming experience. This repository is mainly used for documentation, bug reports, and feature requests.

Key capabilities

  • Call models such as GPT-4o, GPT-4, GPT-3.5, GPT-3, and Codex directly within VS Code.
  • Support using your own OpenAI API Key or Azure OpenAI Service deployment.
  • Generate commit messages based on git changes.
  • Store conversation history on the local disk and continue at any time.
  • Explain compile-time errors in the Problems window and suggest fixes.
  • View the diff between the code and Genie's suggestions in the editor with one click.
  • Rename and personalize the assistant.
  • Get streaming responses in the editor or sidebar, and stop responses to save tokens.
  • Create files or fix code with one click or via keyboard shortcuts.
  • Export all conversation history at once in Markdown format.
  • Customize the system message/context (genieai.systemMessage setting).
  • Support models such as o1-mini, o1-preview, gpt-4o, and gpt-4-turbo.
  • Support commit message generation for multi-folder workspaces.
  • Can disable quick fix actions (genieai.quickFix.enable) and commit message generation (genieai.enableGenerateCommitMessage).
  • All context menu items are consolidated under the Genie submenu.

How to use

  1. Get an API Key from OpenAI, and refer to the official OpenAI documentation to learn about available models.
  2. After installing the extension in VS Code, select a code snippet and ask a question; provide the API Key on first use.
  3. If there is a problem with the API Key, you can use the Genie: Clear API Key command to re-enter or clear it.
  4. The extension provides context menu commands, one-click copy/move of suggested code to the editor, a conversation window, and customization options for OpenAI ChatGPT prompts.
  5. You can assign keyboard shortcuts to the following commands through VS Code's built-in keyboard shortcuts menu.### Available commands
  • Genie: Ad-hoc prompt: Use a custom prompt prefix for the selected code; the extension will remember this string for subsequent queries.
  • Genie: Add tests: Write tests for the selected code.
  • Genie: Find bugs: Analyze and find bugs in the code.
  • Genie: Optimize: Add optimization suggestions for the code.
  • Genie: Explain: Explain the selected code.
  • Genie: Add comments: Add comments to the selected code.
  • Genie: Custom prompt 1 / 2: Custom prompts, disabled by default.
  • Genie: Generate code: Appears when a Codex model is selected and does not provide context to ChatGPT.
  • Genie: Clear API Key: Clear the API Key from VS Code Secrets Storage.
  • Genie: Show conversations: List stored conversations after conversation history is enabled.
  • Genie: What's new: View recent releases.
  • Genie: Start a new chat: Start a new conversation.
  • Genie: Ask anything: Ask free-text questions in the conversation window.
  • Genie: Reset session: Clear the current session and reset the connection to ChatGPT.
  • Genie: Clear conversation: Clear the conversation window and reset the thread.
  • Genie: Export conversation: Export the entire conversation in Markdown.
  • Genie: Focus on Genie View: Focus the Genie window; you can drag the icon to the right sidebar or bottom bar.

Conversation history

  • Experimental feature, which must be opted into via the genieai.enableConversationHistory setting.
  • Conversations are stored only on the local machine, using the VS Code global storage API.
  • All conversations are initially named "New chat", which can be modified in the genie.json file.
  • This feature may have bugs; use at your own risk. The extension cannot modify stored files and can only write new threads.

Quick Fix

  • Click the lightbulb icon at the underlined code error to let Genie quickly fix the problem.

Use Cases

  • Daily coding where AI assistance is needed to explain, optimize, find errors, add tests, or add comments.
  • Want to use GPT models for conversational programming directly within VS Code.
  • Need to generate commit messages or manage conversation history.
  • Developers using Azure OpenAI Service.

Limitations and Notes

  • Requires your own OpenAI API Key or Azure OpenAI deployment; API costs are billed separately from a ChatGPT Plus subscription.
  • Using GPT-4 models requires GPT-4 API access (different from GPT-4 in ChatGPT Plus).
  • The editor view currently uses the text-davinci-003 model (by design).
  • Conversation history is an experimental feature and may have bugs.
  • The extension is not guaranteed to run continuously without issues; use at your own risk.
  • The extension does not use or store personally identifiable information.
  • Telemetry is disabled by default; when enabled, it collects metadata to improve features.
  • You may encounter errors such as HTTP 429, 404, 400, etc.; check your quota, model settings, or conversation length.
  • It may not work in remote development environments; add "remote.extensionKind": {"genieai.chatgpt-vscode": ["ui"]} to settings.json.
  • For proxy support, refer to the related issue.
  • The API Key cannot be viewed after storage.
  • If you encounter persistent problems, try resetting the session, clearing the API Key, or restarting VS Code.