API Integration Copilot
An AI-powered VS Code extension that helps developers with API integration tasks, including type generation, documentation, and React Query implementation.
Features
- API Response Analysis: Automatically analyze JSON responses and generate helpful insights
- TypeScript Type Generation: Generate TypeScript types from JSON responses
- React Query Integration: Generate React Query hooks and mutations from API specifications
- AI-Powered: Utilizes Mistral AI for intelligent code generation and analysis
Installation
Install the extension from VS Code Marketplace
Set up Mistral LLM through Ollama:
Install Ollama from ollama.ai
Open terminal and run:
# Pull the Mistral model
ollama pull mistral
The model will be downloaded and started locally
Keep the Ollama process running while using the extension
The extension will automatically connect to your local Mistral instance
Usage
Analyzing API Responses
- Select a JSON response in your editor
- Right-click and select "API Copilot: Analyze API Response" or use the command palette
- The extension will analyze the response and provide insights
Example:
// Select this JSON response
{
"user": {
"id": 123,
"name": "John Doe",
"email": "john@example.com",
"preferences": {
"theme": "dark",
"notifications": true
},
"lastLogin": "2024-03-15T10:30:00Z"
},
"status": "active",
"role": "admin"
}
// The extension will generate analysis
Generating TypeScript Types
- Select a JSON response in your editor
- Right-click and select "API Copilot: Generate Types" or use the command palette
- TypeScript types will be generated based on the JSON structure
Example:
// Select this JSON response
{
"products": [
{
"id": 1,
"name": "Laptop",
"price": 999.99,
"inStock": true,
"specs": {
"cpu": "Intel i7",
"ram": "16GB"
}
}
],
"totalCount": 1
}
// The extension will generate types
Generating React Query Implementation
- Select an API specification in the following format:
Example:
// Select this API specification
POST https://api.example.com/users
Content-Type: application/json
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"role": "user"
}
Response:
{
"id": 123,
"name": "John Doe",
"email": "john@example.com",
"role": "user",
"createdAt": "2024-03-15T10:30:00Z"
}
// The extension will generate React Query implementation:
- Right-click and select "API Copilot: Generate React Query Implementation"
- A complete React Query implementation will be generated
Requirements
- VS Code 1.80.0 or higher
- Node.js and npm installed
- Mistral AI API key
- Local Mistral LLM setup:
- Download and install the Mistral LLM locally through Ollama on your machine
- The extension will automatically use your local Mistral LLM instance for AI operations
Development
- Clone the repository:
git clone https://github.com/ujjwal502/api-integration-copilot.git
- Install dependencies:
npm install
- Open in VS Code:
code .
- Press F5 to start debugging
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
Support
If you encounter any issues or have questions, please file them in the GitHub issues section.