Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>AutoPilot AINew to Visual Studio Code? Get it now.
AutoPilot AI

AutoPilot AI

Vivek Paste

|
405 installs
| (1) | Free
AutoPilot AI Searchbar is a Visual Studio Code extension that integrates OpenAI models into your coding workflow with chat, code explanation, refactoring, and documentation tools.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AutoPilot AI

AutoPilot AI is a VS Code extension that adds a sidebar chat assistant for coding tasks. It can answer general questions, explain selected code, refactor snippets, generate documentation, and apply generated code into the active editor.

Features

  • Sidebar chat view inside VS Code (AutoPilot AI activity bar item)
  • OpenAI-backed chat with API-key sign-in flow
  • Context-aware prompting:
    • none: no editor context for general questions
    • selection: selected code context when relevant
    • file: current file context for file-wide questions
  • Hybrid request routing:
    • Heuristic classifier
    • Optional mini-model router for ambiguous requests
  • Task-aware response depth:
    • quick, normal, deep
  • Selection-based editor actions:
    • Explain selection
    • Refactor selection
    • Document selection
  • "Apply Code" button on generated code blocks to insert/replace in editor

Requirements

  • VS Code ^1.100.0
  • Node.js 20+
  • An OpenAI Project API key (for example sk-proj-...)

Getting Started

  1. Clone and install dependencies:
npm install
  1. Compile:
npm run compile
  1. Run extension in development:
  • Press F5 in VS Code to launch the Extension Development Host.
  1. In the extension UI, click Sign In and provide:
  • OpenAI Project API key (stored in VS Code global state)

Commands

The extension contributes these commands:

  • autopilot-searchbar.search — Open AutoPilot AI
  • autopilot-searchbar.logout — Logout
  • autopilot-searchbar.explainSelection — Explain with AutoPilot AI
  • autopilot-searchbar.refactorCode — Refactor Code with AutoPilot AI
  • autopilot-searchbar.documentSelection — Document It with AutoPilot AI
  • autopilot-searchbar.applyCode — Apply Code from AutoPilot AI

Selection commands are also available in the editor context menu when text is selected.

Extension Settings

This extension contributes the following settings:

  • autopilot.apiKey (string): API key field (primary sign-in uses secure global state flow).
  • autopilot.enableAiRouter (boolean, default true): Enables mini-model request classification when heuristics are uncertain.
  • autopilot.routerModel (string, default gpt-4o-mini): Model used for the lightweight request router.

How Context Routing Works

For normal chat messages, the extension plans each request before sending it to the main model:

  1. Detect intent/context need (none / selection / file)
  2. Detect response depth (quick / normal / deep)
  3. Build minimal prompt payload
  4. Send to OpenAI

This reduces unnecessary token usage and improves latency versus always attaching full-file context.

Development Scripts

  • npm run compile — Build extension
  • npm run watch — Build in watch mode
  • npm run package — Production bundle
  • npm run lint — Lint source
  • npm run check-types — Type-check only
  • npm run test — Run extension tests

Packaging and Publishing

1. Prepare package.json

Ensure at least the following are set:

  • name
  • displayName
  • publisher
  • version
  • engines.vscode

2. Create a VSIX package

npx vsce package

This generates a file like:

  • autopilot-ai-<version>.vsix

3. Publish to Visual Studio Marketplace

  1. Create/manage publisher: https://marketplace.visualstudio.com/manage
  2. Create Azure DevOps PAT with Marketplace publish permissions
  3. Publish:
npx vsce publish -p <YOUR_PAT>

Troubleshooting

  • If authentication fails, verify you are using a valid OpenAI Project API key.
  • If responses are empty due to token limits, ask a narrower question or reduce file/selection size.
  • If network errors occur, check proxy/firewall settings in your environment.

Security Notes

  • API key is read from VS Code global state in this extension.
  • Review your organization policy before using personal or shared keys.

License

See LICENSE (add one before marketplace publish if missing).

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft