Introduction

Quickstart

Get started with the Napster API in minutes

This guide walks you through building and deploying your first Omniagent — a single AI agent with consistent voice, personality, and knowledge, available on any channel.

Don't have an account yet? Sign up at napster.com/developer — you start with $6 of free credits, roughly 100 minutes of conversation. Or create a resource in the Azure Portal if you prefer billing through your Azure subscription.

Before you start, you'll need an API key. You can generate one from the dashboard — see Authentication for details.

Your API key is a secret. Keep it private and only use it on the server side — never expose it in client-side code.

Choose a companion

Start by choosing a companion — the identity layer that defines your agent's appearance, personality, and behavior. It's a separate resource from the agent itself so one companion can front several agents, and the avatar is generated once no matter how often you reconfigure them — see Companion vs. Omniagent. Browse the catalog or create a custom one.

Browse the companion catalog (API reference):

curl -X GET https://napster-api.napster.com/public/companions/napster-stock \
  -H "X-Api-Key: $NAPSTER_API_KEY"

Or create a custom one (API reference):

curl -X POST https://napster-api.napster.com/public/companions \
  -H "X-Api-Key: $NAPSTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Alex",
    "lastName": "Chen",
    "description": "A senior tech support specialist who has been helping customers for over a decade. Warm, patient, and detail-oriented. Explains technical concepts in plain language and always walks users through solutions step by step. Keeps a professional but approachable tone, occasionally uses light humor to put frustrated users at ease.",
    "pictureUrl": "https://example.com/images/alex-avatar.png"
  }'

This uses the default v1 avatar model (image input). For higher quality avatars using a video reference, set version to "v2" and provide a videoUrl instead. See Avatar Models for details.

You can also equip your agent with tools and knowledge to expand what it can do and what it knows.

Learn more about building your Omniagent

Create your Omniagent

Bring everything together into a persistent agent. This combines the companion, voice, tools, knowledge, and model settings into a single reusable resource (API reference):

curl -X POST https://napster-api.napster.com/public/agents \
  -H "X-Api-Key: $NAPSTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "companionId": "comp_abc123",
    "name": "Support Agent",
    "voiceId": "alloy",
    "functions": ["func_abc123", "func_def456"],
    "providerSettings": {
      "temperature": 0.7
    }
  }'

The response returns an agent id that you use to deploy it to any channel.

Deploy to a channel

Create a WebRTC session from your Omniagent with a single call (API reference):

curl -X POST https://napster-api.napster.com/public/agents/agent_abc123/connections \
  -H "X-Api-Key: $NAPSTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channelType": "webrtc"
  }'

The response returns a token and a connection object with an id. The Web SDK uses the token to connect and show the agent in your application. Store the connection id on your backend to retrieve session details later, such as transcripts or duration.

Make this call from your backend, never from the browser, and expose it as an endpoint your page can reach, for example POST /api/avatar-session returning { "token": "..." }. See Add a token endpoint.

Install the Web SDK:

npm install @touchcastllc/napster-companion-api@2 @reduxjs/toolkit

Then use it in your React app. The SDK calls getToken itself, right before it connects:

import { useEffect } from "react";
import { NapsterCompanionApiSdk } from "@touchcastllc/napster-companion-api";
import type { NapsterCompanionApiInstance } from "@touchcastllc/napster-companion-api";
import "@touchcastllc/napster-companion-api/styles";

async function getToken() {
  const response = await fetch("/api/avatar-session", { method: "POST" });
  const { token } = await response.json();
  return token;
}

export function AgentWidget() {
  useEffect(() => {
    let instance: NapsterCompanionApiInstance | null = null;
    let cancelled = false;

    // Wait one microtask, so React StrictMode's development-only
    // mount → unmount → mount cancels the first run before it starts the SDK.
    queueMicrotask(() => {
      if (cancelled) return;
      NapsterCompanionApiSdk.init(getToken).then(
        (created) => {
          if (cancelled) created.destroy();
          else instance = created;
        },
        (error) => console.error(error),
      );
    });

    return () => {
      cancelled = true;
      instance?.destroy();
    };
  }, []);

  return null;
}

The agent appears as a floating widget in the bottom-right corner of the page.

For examples in Vue, Angular, and vanilla JavaScript, see Examples in the Web SDK section, and the full Web SDK docs for configuration, events, and methods. You can also deploy the same agent to WebSockets, VoIP, or SIP.

Learn more about deploying your Omniagent

Monitor your agent

Once your agent is live, track how it's performing. Review analytics, browse conversation logs, and use those insights to refine your agent over time.

Learn more about monitoring your agent

On this page