Upstreet Docs
    SDK

    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-client
    pnpm add pu-client
    yarn add pu-client

    Authentication

    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
    });
    ParameterTypeDescription
    apiKeystringYour API key from /account
    baseUrlstring (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:

    SubclientPurposeDocs
    client.generationsCreate and manage AI generationsGenerations
    client.charactersCharacter asset binariesAssets
    client.scenesScene asset binariesAssets
    client.itemsItem asset binariesAssets
    client.spritesSprite asset binariesAssets
    client.mobsMob asset binariesAssets
    client.musicMusic asset binariesAssets
    client.soundEffectsSound effect binariesAssets
    client.voicesVoice asset binariesAssets
    client.wikiWiki projects and pagesWiki
    client.webWeb projects and sitesWeb
    client.blogBlog projects and postsBlog
    client.npcsNPC managementNPCs
    client.partiesMulti-agent partiesParties
    client.containerssprites.dev containersContainers
    client.apiLow-level REST API client

    Additional Exports

    Beyond PUClient, the package exports:

    ExportDescription
    ChatApiClientChat and messaging API for levels
    AiClientBase AI chat client
    NpcAiClientNPC-specific AI client
    PartyAiClientMulti-agent party AI client
    AgentClientBaseBase 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