For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
WebsiteStatusSupportDashboard
DocumentationAPI ReferenceMCPSDKsCLI (new)What's New?
DocumentationAPI ReferenceMCPSDKsCLI (new)What's New?
  • Getting Started
    • Overview
  • Core Features
    • Project Integration
    • MCP Integration
    • Webhook Testing
    • Authentication
  • Resources
    • GitHub Repository
    • Report Issues
LogoLogo
WebsiteStatusSupportDashboard
On this page
  • Overview
  • Quick start
  • How it works
  • Framework detection
  • What gets generated
  • Supported frameworks
  • Frontend frameworks
  • Mobile frameworks
  • Backend frameworks
  • Advanced options
  • Specify target directory
  • Skip SDK installation
  • Force framework
  • Custom templates
  • Environment setup
  • Common patterns
  • Adding to monorepos
  • CI/CD integration
  • Docker environments
  • Troubleshooting
  • Next steps
Core Features

Project integration

Was this page helpful?
Edit this page

MCP integration

Next
Built with

Overview

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:

  • Initialize Vapi in any project
  • Understand what files are generated
  • Customize the initialization process
  • Work with different frameworks

Quick start

Navigate to your project directory and run:

$cd my-project
$vapi init

The CLI will:

  1. Detect your project type and framework
  2. Install the appropriate Vapi SDK
  3. Generate example components and API routes
  4. Create environment configuration templates
  5. Provide next steps specific to your setup

How it works

Framework detection

The CLI analyzes your project structure to identify:

  • Package files: package.json, requirements.txt, go.mod, etc.
  • Configuration files: Framework-specific configs
  • Project structure: Directory patterns and file extensions
  • Dependencies: Installed packages and libraries

What gets generated

Based on your framework, the CLI generates:

React/Next.js
Python
Node.js
$vapi init
$# Detected: Next.js application

Generated files:

  • components/VapiButton.tsx - Voice call button component
  • pages/api/vapi/webhook.ts - Webhook handler endpoint
  • lib/vapi-client.ts - Vapi client setup
  • .env.example - Environment variables template

Installed packages:

  • @vapi-ai/web - Web SDK for browser integration
  • @vapi-ai/server-sdk - Server SDK for webhooks

Supported frameworks

Frontend frameworks

React
  • Create React App
  • Vite
  • Custom webpack
Vue.js
  • Vue 3
  • Nuxt.js
  • Vite
Angular
  • Angular 12+
  • Ionic
Next.js
  • App Router
  • Pages Router
  • API Routes
Svelte
  • SvelteKit
  • Vite
Vanilla JS
  • HTML/CSS/JS
  • Webpack
  • Parcel

Mobile frameworks

React Native
  • Expo
  • Bare workflow
Flutter
  • iOS & Android
  • Web support

Backend frameworks

Node.js
  • Express
  • Fastify
  • Koa
Python
  • Django
  • FastAPI
  • Flask
Go
  • Gin
  • Echo
  • Fiber
Ruby
  • Rails
  • Sinatra
Java
  • Spring Boot
  • Quarkus
C#/.NET
  • ASP.NET Core
  • Blazor

Advanced options

Specify target directory

Initialize in a specific directory:

$vapi init /path/to/project

Skip SDK installation

Generate only example files without installing packages:

$vapi init --skip-install

Force framework

Override auto-detection:

$vapi init --framework react
$vapi init --framework python

Custom templates

Use your own templates:

$vapi init --template @myorg/vapi-templates

Environment setup

After initialization, configure your environment:

1

Copy environment template

$cp .env.example .env
2

Add your API key

Get your API key from the Vapi Dashboard:

$VAPI_API_KEY=your-api-key-here
3

Configure webhook URL (optional)

For local development:

$VAPI_WEBHOOK_URL=https://your-domain.com/api/vapi/webhook

Common patterns

Adding to monorepos

For monorepos, run init in the specific package:

$cd packages/web-app
$vapi init
$
$cd ../api-server
$vapi init

CI/CD integration

Add to your build process:

1# GitHub Actions example
2- name: Setup Vapi
3 run: |
4 curl -sSL https://vapi.ai/install.sh | bash
5 vapi init --skip-install

Docker environments

Include in your Dockerfile:

1# Install Vapi CLI
2RUN curl -sSL https://vapi.ai/install.sh | bash
3
4# Initialize project
5RUN vapi init --skip-install

Troubleshooting

Framework not detected

If the CLI can’t detect your framework:

  1. Ensure you’re in the project root
  2. Check for required config files
  3. Use --framework flag to specify manually
$vapi init --framework react
Permission errors

For permission issues during SDK installation:

$# npm projects
$sudo npm install
$
$# Python projects
$pip install --user vapi-server-sdk
Existing files conflict

If files already exist, the CLI will:

  1. Ask for confirmation before overwriting
  2. Create backup files (.backup extension)
  3. Show a diff of changes

Use --force to skip confirmations:

$vapi init --force

Next steps

After initializing your project:

  • Test locally: Use vapi listen to test webhooks
  • Create assistants: Build your first voice assistant
  • Set up MCP: Enhance your IDE with Vapi intelligence

Example output:

$$ vapi init
$šŸ” Analyzing project...
$āœ“ Detected: Next.js 14 application
$
$šŸ“¦ Installing dependencies...
$āœ“ Installed @vapi-ai/web@latest
$āœ“ Installed @vapi-ai/server-sdk@latest
$
$šŸ“ Generating files...
$āœ“ Created components/VapiButton.tsx
$āœ“ Created app/api/vapi/webhook/route.ts
$āœ“ Created lib/vapi-client.ts
$āœ“ Created .env.example
$
$šŸŽ‰ Vapi initialized successfully!
$
$Next steps:
$1. Copy .env.example to .env
$2. Add your VAPI_API_KEY
$3. Run: npm run dev
$4. Test the voice button at http://localhost:3000