The pu-client TypeScript SDK for the Upstreet platform—installation, authentication, and subclient reference.
pu-client SDK
pu-client is the official TypeScript SDK for the Upstreet platform. Use it to create AI generations, manage assets, build wiki and web projects, control NPCs and parties, and interact with the low-level REST API—all from Node.js or the browser.
Installation
npm install pu-clientpnpm add pu-clientyarn add pu-clientAuthentication
Get your API key from Account Settings in the Developer tab. Use it to authenticate all SDK requests.
import { PUClient } from 'pu-client';
const client = new PUClient({
apiKey: process.env.PU_API_KEY!,
baseUrl: 'https://upstreet.ai', // optional; defaults to app origin or production
});| Parameter | Type | Description |
|---|---|---|
apiKey | string | Your API key from /account |
baseUrl | string (optional) | API base URL. Omitted: uses location.origin in browser, or production Upstreet URL in Node |
Subclient Reference
The PUClient exposes domain-specific subclients. Each handles a distinct area of the platform:
| Subclient | Purpose | Docs |
|---|---|---|
client.generations | Create and manage AI generations | Generations |
client.characters | Character asset binaries | Assets |
client.scenes | Scene asset binaries | Assets |
client.items | Item asset binaries | Assets |
client.sprites | Sprite asset binaries | Assets |
client.mobs | Mob asset binaries | Assets |
client.music | Music asset binaries | Assets |
client.soundEffects | Sound effect binaries | Assets |
client.voices | Voice asset binaries | Assets |
client.wiki | Wiki projects and pages | Wiki |
client.web | Web projects and sites | Web |
client.blog | Blog projects and posts | Blog |
client.npcs | NPC management | NPCs |
client.parties | Multi-agent parties | Parties |
client.containers | sprites.dev containers | Containers |
client.api | Low-level REST API client | — |
Additional Exports
Beyond PUClient, the package exports:
| Export | Description |
|---|---|
ChatApiClient | Chat and messaging API for levels |
AiClient | Base AI chat client |
NpcAiClient | NPC-specific AI client |
PartyAiClient | Multi-agent party AI client |
AgentClientBase | Base class for agent clients |
Quick Example
import { PUClient } from 'pu-client';
const client = new PUClient({ apiKey: process.env.PU_API_KEY! });
// Create a character generation
const id = await client.generations.create({
type: 'character',
input: { prompt: 'A steampunk fox inventor', smartPrompt: true },
});
console.log(`Generation started: ${id}`);
// Poll until complete
const gen = await client.generations.get(id);
console.log(`State: ${gen.state}`);Explore the SDK
Generations
Create characters, scenes, music, sprites, and more with the AI generation API.
NPCs
SDK reference for NPC CRUD, tools, and chat threads.
Wiki
Wiki projects and pages—create, edit, and resolve content.
Blog
Blog projects and AI-generated posts.
Web
Web projects, assets, and content fetching.
Parties
Multi-agent parties and group conversations.
Containers
Cloud containers via sprites.dev—files, exec, rsync.
Assets
Characters, scenes, items, sprites, music, voices.
Platform Overview
Architecture and core concepts of the Upstreet platform.