🚀 AutoAPI VS Code Extension
AutoAPI is a Visual Studio Code extension that integrates with the autoapi-cli
tool to generate and run tests from your OpenAPI specification using OpenAI's GPT models. It simplifies test automation and improves API test coverage directly from your editor.
✨ Features
- ⚙️ One-click setup with
AutoAPI: Init
- 🧪 Run
AutoAPI: Test
directly from VS Code
- 🧠 Automatically generates API tests using OpenAI
- 📁 Detects changes in
openapi.yaml
or openapi.json
and prompts re-testing
- 🔐 Prompt to enter and persist your OpenAI API key securely
- 📊 View test results in a custom AutoAPI Results sidebar tree
- 🖥️ View command output in the AutoAPI Output Channel
- 📂 Webview-based sidebar UI to edit
.autoapi.config.json
- 📡 Automatically reloads results if
.autoapi/results/last-run.json
is updated
- 🌐 Tunnel Mode to expose
localhost
APIs using a custom subdomain (via localtunnel
)
📦 Requirements
Install globally:
npm install -g autoapi-cli
⚙️ Extension Settings
Setting |
Description |
autoapi.openaiKey |
Your OpenAI API key used for GPT-powered testing |
Set it in your VS Code settings.json
:
{
"autoapi.openaiKey": "sk-..."
}
📁 Example Workflow
- Open your project containing
openapi.yaml
or openapi.json
.
- Open the AutoAPI sidebar or run the command:
AutoAPI: Init
.
- Enter:
- OpenAPI spec path
- Base URL of your API
- Optional headers (e.g.,
Authorization
)
- K6 server URL (for performance testing)
- Optionally enable Tunnel Mode
- Set port (e.g.,
3000
)
- Set subdomain (e.g.,
my-api
)
- Click "Save Config" or "Update Config"
- Click "Run Tests" to generate and execute tests
- View test results in the AutoAPI Results view or
.autoapi/results/last-run.json
🌐 Tunnel Mode
If your API is running on localhost
, you can expose it to the internet using a secure tunnel:
- Enable Tunnel Mode
- Set:
Port
: Local port of your API (e.g., 3000)
Subdomain
: Unique subdomain for public access (e.g., my-api
)
- AutoAPI uses
localtunnel
to generate a live base_url
💡 Tunnel will auto-close and regenerate on "Restart Tunnel"
🗂 File Structure
.your-project/
├── openapi.yaml
├── .autoapi.config.json # Stores config like base_url, headers, etc.
└── .autoapi/
└── results/
└── last-run.json # Contains latest test results
📝 Release Notes
2.2.0
- ✅ Tunnel Mode support added via
localtunnel
- New UI
- Generate spec file using curl option
2.1.0
- ✅ Tunnel Mode support added via
localtunnel
- Custom port and subdomain
- One-click tunnel restart
- Automatically updates base_url
2.0.0
- 📂 Sidebar UI to configure
.autoapi.config.json
- 🧪 Run tests and 📊 show results from sidebar
1.0.0
autoapi init
autoapi test
- Result Tree View
.autoapi.config.json
generation
- OpenAI key integration
- Auto-refresh on result change
📚 Resources
🙌 Contributing
We welcome contributions! Please create issues or pull requests at GitHub Repo
🧩 Extension Guidelines
This extension follows official VS Code Extension Guidelines
Enjoy using AutoAPI!