Quickstart
Start building realistic AI interactions in minutes
Setup
Let’s get you started building your first AI interaction in minutes in javascript.
If you prefer to jump right into the code instead, you can clone our starter repo
Get your API key
You will need an API key to authenticate your requests to our API and to use our SDKs. You can find your API keys on your dashboard.
Install the SDK
Get the javascript SDK from npm or yarn.
Add a video element
Add a video element to your html that would be used to display the AI’s video feed.
Create an interaction session
You would need to create a session. A session is used to preconfigure your interaction before connecting to the AI and allows you to continue conversations across multiple interactions.
In production, you should make the session request from your backend to avoid exposing your API key.
Connect to the AI
In order to connect to the AI, you would need to provide:
- the session id
- the video element that would be used to display the AI’s video feed.
- your own audio stream to enable the AI to hear you and respond.
One last thing, disconnecting.
You’ll need to disconnect the session when you’re done with it.
Disconnecting an interaction allows you continue the conversation at a later date/time
by passing same session_id
into the SDK again. To permanently terminate your session, see Terminate Session
You’re ready!
Now run your code, it may takes a sec to connect and you should be able to have a conversation with your AI.
See the full source code here
Learn More
Explore the full capabilities of the Diarupt platform.