Javascript SDK Overview
Integrate AI text generation, image generation, and NPC conversations in web games
JavaScript SDK
We know you love using web technologies, so in addition to mainstream game engines, we provide PlayKit's TypeScript/JavaScript library, enabling you to develop AI-native games using web technologies.
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>
// Recommended: window.PlayKitSDK is the SDK class.
const sdk = new PlayKitSDK({
gameId: 'your-game-id',
developerToken: 'your-token'
});
// Legacy v1.x form is preserved as a self-reference and still works:
// const sdk = new PlayKitSDK.PlayKitSDK({ ... });
// Named exports are attached as static properties:
// PlayKitSDK.ChatClient / PlayKitSDK.NPCClient / PlayKitSDK.AuthManager ...
</script>