Docs/Web SDK Overview

Web SDK Overview

What the Mistscale Web SDK gives you and how the pieces fit together.

The Mistscale Web SDK connects a browser game, chat UI, or interactive fiction project to the NPCs you build in the dashboard. You create one client with your API key, open a connection to an NPC, and the character can hold a conversation: text, voice, or both. Memory, mood, relationships, and fact grounding all run on Mistscale's side of the connection, so there is nothing to host and no model to manage.

Streaming text chat

Send a player message with one method call. Replies stream token by token, or arrive as one settled message if you don't need to render the stream.

Realtime WebSocket

One socket per NPC, typed events for every frame the server sends: chunks, revisions, quota, mood, and more.

Spatial context

Tell the NPC where it is, what time it is, and what the weather is doing. Replies follow.

How it works

Each NPC your game talks to gets its own realtime connection to Mistscale, authenticated with your project's API key. When a player sends a message, the SDK sends it over that connection; the reply streams back as text, and as raw audio frames when voice is in play. Everything stateful, including what the NPC remembers about each player and how its mood shifts over time, happens server-side and persists between sessions automatically.

What you need before starting

  • A Mistscale account with a project. The free tier is enough.
  • At least one NPC created in the dashboard. See Creating an NPC.
  • An API key for the project, generated from Project Settings.
  • Node.js and a package manager (npm, pnpm, or yarn) to install the package, and a modern browser to run it in.

The guides in this section

Not using JavaScript?
The SDK speaks an open REST + WebSocket protocol shared by every Mistscale client. See Unity, Godot, Unreal, or REST & WebSocket API to integrate directly, without this package.