TABLE OF CONTENTS

QUICK START

Get your first AStack integration running in under 5 minutes.

1

GET YOUR API KEY

Sign up for an AStack account and create your first API key from the dashboard.

SIGN UP →
2

INSTALL THE SDKS

# Client SDK (browser)
$ npm install @aether-stack-dev/client-sdk
# Server SDK (backend)
$ npm install @aether-stack-dev/developer-sdk
3

CREATE A SESSION (SERVER)

Your backend creates a session and generates a token for the client.

import { AStackSDK } from '@aether-stack-dev/developer-sdk';
const sdk = new AStackSDK({
apiKey: process.env.ASTACK_API_KEY,
apiSecret: process.env.ASTACK_API_SECRET,
});
// Create session and generate a client token
const { session, token } = await sdk.createSession('user_123');
const sessionToken = await sdk.generateSessionToken(session.id);
// Return sessionToken and workerUrl to your frontend
4

CONNECT FROM THE CLIENT

Your frontend connects to the worker with the session token and starts a call.

import { AStackCSRClient } from '@aether-stack-dev/client-sdk';
const client = new AStackCSRClient({
workerUrl: 'wss://worker.astack.dev',
sessionToken: sessionToken, // from your backend
});
await client.connect();
client.on('transcript', (text) => {
console.log('User said:', text);
});
client.on('response', (text) => {
console.log('AI response:', text);
});
client.on('blendshapeUpdate', (blendshapes) => {
// 52 ARKit blendshape values for avatar animation
});
await client.startCall();

REACT INTEGRATION

Use the React hook for a simpler integration.

import { useAStackCSR } from '@aether-stack-dev/client-sdk/react';
function CallUI() {
const {
isConnected, callStatus, transcript, response,
blendshapes, error, connect, startCall, stopCall
} = useAStackCSR({
workerUrl: 'wss://worker.astack.dev',
sessionToken: sessionToken,
});
return (
<div>
<p>Status: {callStatus}</p>
<p>Transcript: {transcript}</p>
<p>Response: {response}</p>
<button onClick={() => connect().then(() => startCall())}>
Start Call
</button>
<button onClick={stopCall}>Stop Call</button>
</div>
);
}

NEXT STEPS