Follow these steps to install and run Vibekit:

Basic setup

Step 1: Install VibeKit Typescript SDK:
npm i @vibe-kit/sdk
Step 2: Configure your VibeKit client:
import { VibeKit } from "@vibe-kit/sdk";
import { createE2BProvider } from "@vibe-kit/e2b";

const e2bProvider = createE2BProvider({
  apiKey: process.env.E2B_API_KEY!,
  templateId: "vibekit-claude",
});

const vibeKit = new VibeKit()
  .withAgent({
    type: "claude",
    provider: "anthropic",
    apiKey: process.env.ANTHROPIC_API_KEY!,
    model: "claude-sonnet-4-20250514",
  })
  .withSandbox(e2bProvider);

Step 3: Add event listeners and execute commands:
// Add event listeners for command output
vibeKit.on("stdout", (output) => {
  console.log("Output:", output);
});

vibeKit.on("stderr", (error) => {
  console.error("Error:", error);
});

// Execute a command (recommended approach)
const claudeCommand = `echo "Create a simple web app that displays a list of users" | claude -p --output-format stream-json --verbose --allowedTools "Edit,Write,MultiEdit,Read,Bash" --model claude-sonnet-4-20250514`;
const result = await vibeKit.executeCommand(claudeCommand);

// Get host URL (optional)
const host = await vibeKit.getHost(3000);

// Clean up when done
await vibeKit.kill();

console.log("Result:", result);
console.log("Host:", host);
💡 Tip: You can also use the deprecated generateCode method, but we recommend migrating to executeCommand for better control and flexibility. See the migration guide for details.