Javascript SDK Overview
Integrate AI text generation, image generation, and NPC conversations in web games
JavaScript SDK
PlayKit provides a TypeScript/JavaScript SDK for building AI-native web games and applications. The SDK covers the same feature set as the Unity and Unreal integrations — text generation, image generation, NPC conversations, speech recognition, and player management — and works in any modern browser or Node.js environment.
The easiest way to get started with the SDK is to install and initialize it via npm.
Before You Begin
- You need to create an application on the PlayKit Platform and obtain a Game ID
- Your project needs to support modern JavaScript (ES2017+)
- A modern browser
Installation
Via Vibe Coding Tools
Visit the Vibe Coding page and copy the prompt into your AI development tool (such as Cursor, Trae, or Claude Code).
Via npm
npm install playkit-sdkVia yarn
yarn add playkit-sdkVia CDN (UMD)
When loaded as a UMD bundle, window.PlayKitSDK is the constructor itself — call it directly:
<script src="https://unpkg.com/playkit-sdk@latest/dist/playkit-sdk.umd.js"></script>
<script>
const sdk = new PlayKitSDK({
gameId: 'your-game-id',
apiKey: 'your-api-key'
});
</script>