The vapi init command intelligently integrates Vapi into your existing codebase. It automatically detects your framework, installs the appropriate SDK, and generates production-ready code examples tailored to your project structure.
In this guide, youāll learn to:
Navigate to your project directory and run:
The CLI will:
The CLI analyzes your project structure to identify:
package.json, requirements.txt, go.mod, etc.Based on your framework, the CLI generates:
Generated files:
components/VapiButton.tsx - Voice call button componentpages/api/vapi/webhook.ts - Webhook handler endpointlib/vapi-client.ts - Vapi client setup.env.example - Environment variables templateInstalled packages:
@vapi-ai/web - Web SDK for browser integration@vapi-ai/server-sdk - Server SDK for webhooksInitialize in a specific directory:
Generate only example files without installing packages:
Override auto-detection:
Use your own templates:
After initialization, configure your environment:
For monorepos, run init in the specific package:
Add to your build process:
Include in your Dockerfile:
If the CLI canāt detect your framework:
--framework flag to specify manuallyFor permission issues during SDK installation:
If files already exist, the CLI will:
.backup extension)Use --force to skip confirmations:
After initializing your project:
vapi listen to test webhooksExample output: