ChatAI Copilot
A powerful VS Code extension that provides AI-powered code assistance using your custom Chat AI endpoint. Get intelligent code completions, explanations, and chat-based assistance directly in your editor.
Features
- 💬 Conversational AI Assistant: Chat naturally with an AI that asks thoughtful questions about your code
- 🤖 AI-Powered Chat Panel: Interactive chat interface for code-related questions and assistance
- ✨ Smart Code Completions: Get intelligent inline suggestions as you type
- 📝 Docstring Generation: Automatically generate documentation for your functions
- 🔍 Code Explanation: Get detailed explanations of selected code
- ⚙️ Easy Configuration: Simple setup for your custom AI endpoint
- 🎨 VS Code Theme Integration: Seamlessly integrates with your editor's theme
Installation
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "ChatAI Copilot"
- Click Install
Or install from the command line:
code --install-extension SamarthNagpal.chatai-copilot
Screenshots
Screenshots coming soon! The extension features a beautiful dark blue glass theme with conversational AI assistance.
Features Showcased:
- Chat Panel: Interactive conversational AI assistance
- Autocomplete: AI-powered code suggestions
- Hover Tooltips: Intelligent code insights
- Multi-language Support: Works with 20+ programming languages
- Modern UI: Dark blue glass morphism design
Quick Start with GPT-4o
Get an OpenAI API Key:
- Visit OpenAI Platform
- Create a new API key
- Copy the key (it starts with
sk-
)
Configure the Extension:
- Open Command Palette (Ctrl+Shift+P)
- Run
ChatAI: Configure API Endpoint and Key
- Select "OpenAI (GPT-4o)"
- Paste your OpenAI API key
Start Using:
- Open a code file
- Run
ChatAI: Open Chat Panel
to start chatting with GPT-4o
- Or just start typing - you'll get inline suggestions automatically!
Configuration
Before using the extension, you need to configure your AI service. The extension supports both OpenAI and custom API endpoints.
Option 1: OpenAI (Recommended)
- Open the Command Palette (Ctrl+Shift+P)
- Run
ChatAI: Configure API Endpoint and Key
- Select "OpenAI (GPT-4o)" from the dropdown
- Enter your OpenAI API key
- The extension will automatically configure for GPT-4o
Option 2: Custom API Endpoint
- Open the Command Palette (Ctrl+Shift+P)
- Run
ChatAI: Configure API Endpoint and Key
- Select "Custom API Endpoint" from the dropdown
- Enter your Chat AI API endpoint URL
- Enter your API key or access token
Configuration Settings
The extension adds the following settings to VS Code:
chatai-copilot.endpoint
: Your AI service endpoint URL (automatically set for OpenAI)
chatai-copilot.apiKey
: Your API key or access token
chatai-copilot.model
: The AI model to use (default: gpt-4o for OpenAI)
Usage
Chat Panel
- Command:
ChatAI: Open Chat Panel
- Opens an interactive chat interface for conversational coding assistance
- Ask questions about your code, get explanations, or just chat about what you're working on
- The AI will ask thoughtful questions to help you think deeper about your implementation
AI Autocomplete
- Automatic: Get intelligent suggestions as you type in supported languages
- Manual Trigger:
ChatAI: Trigger AI Autocomplete
- Get on-demand suggestions
- Context-Aware: AI analyzes your code context for relevant completions
- Multi-language: Supports 20+ programming languages and file types
AI-Powered Autocomplete
- Intelligent Suggestions: Get context-aware autocomplete suggestions as you type
- Multi-language Support: Works with Python, JavaScript, TypeScript, Java, C#, C++, Go, Rust, PHP, Ruby, Swift, Kotlin, Scala, HTML, CSS, JSON, YAML, and Markdown
- Smart Context Analysis: AI analyzes your code context to provide relevant suggestions
- Manual Trigger: Use
ChatAI: Trigger AI Autocomplete
command for on-demand suggestions
- Inline Completions: Ghost text suggestions appear as you type
- Hover Tooltips: AI-powered code review and suggestions on hover
Generate Docstring
- Command:
ChatAI: Generate Docstring
- Automatically generates documentation for your functions (coming soon)
Explain Code
- Command:
ChatAI: Explain Code
- Get detailed explanations of selected code (coming soon)
Requirements
- VS Code version 1.101.0 or higher
- A valid Chat AI endpoint and API key
- Internet connection for API calls
API Requirements
OpenAI API (Recommended)
The extension is optimized for OpenAI's API format. When using OpenAI, the extension automatically:
- Uses the correct endpoint:
https://api.openai.com/v1/chat/completions
- Formats requests according to OpenAI's chat completions API
- Handles authentication with Bearer tokens
- Supports GPT-4o, GPT-4, GPT-3.5-turbo, and other OpenAI models
Custom API Endpoint
Your custom Chat AI endpoint should accept POST requests with the following format:
{
"messages": [
{"role": "system", "content": "You are a code analysis assistant..."},
{"role": "user", "content": "Your question or code context"}
],
"temperature": 0.3,
"max_tokens": 1000
}
And return responses in this format:
{
"choices": [
{
"message": {
"content": "AI response text"
}
}
]
}
Troubleshooting
- Verify your endpoint URL is correct and accessible
- Check that your API key is valid and not expired
- Ensure your endpoint accepts the expected request format
- Check the Output panel (Log: Extension Host) for detailed error messages
"No workspace is open"
- Open a folder or workspace in VS Code before using the extension
Authentication Errors (401)
- Verify your API key is correct
- Some endpoints require OAuth 2 access tokens instead of simple API keys
- Check the API documentation for the correct authentication method
Development
Building from Source
- Clone the repository:
git clone https://github.com/samarthify/chatai-copilot.git
cd chatai-copilot
- Install dependencies:
npm install
- Build the extension:
npm run compile
- Press F5 in VS Code to launch the Extension Development Host
Project Structure
chatai-copilot/
├── src/
│ └── extension.ts # Main extension code
├── package.json # Extension manifest
├── README.md # This file
└── webpack.config.js # Build configuration
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
)
- Commit your changes (
git commit -m 'Add some amazing feature'
)
- Push to the branch (
git push origin feature/amazing-feature
)
- Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Release Notes
0.0.1
- Initial release
- Chat panel with AI integration
- Inline code completions
- Configuration management
- Support for Python, JavaScript, and TypeScript
Enjoy coding with AI assistance! 🚀