ZeebeeAI Chat SDK
Build powerful conversational AI experiences with voice and text capabilities. ZeebeeAI provides a comprehensive multi-model communication infrastructure with flexible configuration options for voice, language, and integration technologies.
Quickstart
Get started quickly with the ZeebeeAI Chat SDK. Set up your environment, make your first API call, and understand the core concepts.
API Reference
Explore the comprehensive API documentation, including endpoints, parameters, response formats, and example code.
Voice Integration
Learn how to integrate speech-to-text and text-to-speech capabilities for natural voice interactions.
SDKs
Install and use our client SDKs for JavaScript, Python, and Flutter to streamline integration with your applications.
Overview
The ZeebeeAI Chat SDK platform provides a unified interface to multiple AI models with advanced features for building conversational experiences. The platform handles all the complexities of model integration, conversation management, and streaming, allowing you to focus on building great user experiences.
Key Features
- Multi-model support: Access OpenAI, Anthropic, Google, and other AI providers through a single unified API.
- Real-time streaming: WebSocket-based streaming for responsive, real-time text interactions.
- Voice capabilities: Integrated speech-to-text and text-to-speech with support for multiple languages and voices.
- Conversation management: Persistent storage and retrieval of conversation history with context preservation.
- Semantic search: Vector-based search functionality to find relevant conversations and messages.
- Analytics and feedback: Tools to collect user feedback and monitor AI response quality.
- Policy engine: Configurable content filtering and safety rules with customizable templates.
- Multi-agent architecture: Advanced routing system with specialized agents for different tasks.
Quickstart
Follow these steps to get started with the ZeebeeAI Chat SDK:
1. Create an account
Sign up for a ZeebeeAI account at zeebee.ai to get your API key.
2. Install the SDK
npm install @zeebee-ai/chat-sdk
pip install zeebee-ai-chat
flutter pub add zeebee_ai_chat
3. Initialize the SDK
import { ZeebeeChat } from '@zeebee-ai/chat-sdk';
const chat = new ZeebeeChat({
apiKey: 'your-api-key',
model: 'gpt-4o' // Default model
});
from zeebee_ai_chat import ZeebeeChat
chat = ZeebeeChat(
api_key='your-api-key',
model='gpt-4o' # Default model
)
import 'package:zeebee_ai_chat/zeebee_ai_chat.dart';
final chat = ZeebeeChat(
apiKey: 'your-api-key',
model: 'gpt-4o' // Default model
);
4. Send your first message
// Send a message and get a response
const response = await chat.sendMessage('Hello, how can you help me today?');
console.log(response.content);
// Or create a conversation first (recommended for multi-turn interactions)
const conversation = await chat.createConversation();
const response = await conversation.sendMessage('Hello, how can you help me today?');
console.log(response.content);
# Send a message and get a response
response = chat.send_message('Hello, how can you help me today?')
print(response.content)
# Or create a conversation first (recommended for multi-turn interactions)
conversation = chat.create_conversation()
response = conversation.send_message('Hello, how can you help me today?')
print(response.content)
// Send a message and get a response
final response = await chat.sendMessage('Hello, how can you help me today?');
print(response.content);
// Or create a conversation first (recommended for multi-turn interactions)
final conversation = await chat.createConversation();
final response = await conversation.sendMessage('Hello, how can you help me today?');
print(response.content);
Note: Creating a conversation is recommended for multi-turn interactions as it automatically maintains context across messages.
Authentication
All requests to the ZeebeeAI API require authentication using an API key, which you can obtain from your account dashboard after signing up.
Using your API key
import { ZeebeeChat } from '@zeebee-ai/chat-sdk';
const chat = new ZeebeeChat({
apiKey: 'zeebee_sk_12345abcdef...',
});
from zeebee_ai_chat import ZeebeeChat
chat = ZeebeeChat(
api_key='zeebee_sk_12345abcdef...'
)
curl -X POST https://api.zeebee.ai/v1/chat \
-H "Content-Type: application/json" \
-H "Authorization: Bearer zeebee_sk_12345abcdef..." \
-d '{
"message": "Hello, how are you?",
"model": "gpt-4o"
}'
Important: Keep your API keys secure and never expose them in client-side code. Use environment variables or a secure vault service to store your keys.
AI Models
The ZeebeeAI Chat SDK provides access to a variety of AI models from different providers through a unified interface.
Available models
The following models are currently available:
- OpenAI: GPT-4o, GPT-4, GPT-3.5 Turbo
- Anthropic: Claude 3 Opus, Claude 3 Sonnet, Claude 3 Haiku
- Google: Gemini 1.5 Pro, Gemini 1.0 Pro
- Mistral: Mistral Large, Mistral Medium, Mistral Small
Selecting a model
// Specify a default model when initializing
const chat = new ZeebeeChat({
apiKey: 'your-api-key',
model: 'claude-3-opus'
});
// Override the model for a specific conversation
const conversation = await chat.createConversation({
model: 'gpt-4o'
});
// Or specify the model for a single message
const response = await chat.sendMessage('Hello', {
model: 'gemini-1.5-pro'
});
# Specify a default model when initializing
chat = ZeebeeChat(
api_key='your-api-key',
model='claude-3-opus'
)
# Override the model for a specific conversation
conversation = chat.create_conversation(
model='gpt-4o'
)
# Or specify the model for a single message
response = chat.send_message('Hello', model='gemini-1.5-pro')
Note: Model availability may depend on your subscription tier. The free tier includes access to GPT-3.5 Turbo and GPT-4o models.
Conversations
Conversations in the ZeebeeAI Chat SDK maintain context across multiple messages, allowing for more natural and coherent interactions.
Creating a conversation
// Create a simple conversation
const conversation = await chat.createConversation();
// Create a conversation with options
const conversation = await chat.createConversation({
model: 'gpt-4o',
system_prompt: 'You are a helpful programming assistant that provides code examples.',
metadata: {
user_id: '123',
conversation_type: 'support'
}
});
# Create a simple conversation
conversation = chat.create_conversation()
# Create a conversation with options
conversation = chat.create_conversation(
model='gpt-4o',
system_prompt='You are a helpful programming assistant that provides code examples.',
metadata={
'user_id': '123',
'conversation_type': 'support'
}
)
Sending messages
// Send a message in a conversation
const response = await conversation.sendMessage('How do I implement a binary search in JavaScript?');
// Send a message with options
const response = await conversation.sendMessage('What are the complexities of different sorting algorithms?', {
max_tokens: 1000,
temperature: 0.7,
stream: false // Set to true to enable streaming
});
# Send a message in a conversation
response = conversation.send_message('How do I implement a binary search in Python?')
# Send a message with options
response = conversation.send_message(
'What are the complexities of different sorting algorithms?',
max_tokens=1000,
temperature=0.7,
stream=False # Set to True to enable streaming
)
Streaming responses
// Stream a response
const stream = await conversation.streamMessage('Explain quantum computing in simple terms.');
// Process tokens as they arrive
stream.onToken((token) => {
console.log('Token:', token);
// Update UI with token
});
// Handle completion
stream.onComplete((response) => {
console.log('Complete response:', response.content);
// Final response processing
});
# Stream a response
stream = conversation.stream_message('Explain quantum computing in simple terms.')
# Process tokens as they arrive
for token in stream:
print(f"Token: {token}", end='', flush=True)
# Update UI with token
# Access the complete response
print(f"\nComplete response: {stream.response.content}")
Voice Chat
The ZeebeeAI Chat SDK provides integrated voice chat capabilities, allowing users to interact with AI through speech.
Setting up voice chat
// Enable voice capabilities
const voiceChat = chat.enableVoice({
speechToText: {
provider: 'openai',
language: 'en-US',
continuous: true
},
textToSpeech: {
provider: 'openai',
voice: 'alloy',
speed: 1.0
}
});
// Start listening for user speech
voiceChat.startListening();
// Handle transcribed text
voiceChat.onTranscript((text) => {
console.log('User said:', text);
// Send the transcribed text to the AI
conversation.sendMessage(text);
});
// Handle AI responses
voiceChat.onResponse((response) => {
console.log('AI response:', response.content);
// Speak the AI response
voiceChat.speak(response.content);
});
// Enable voice capabilities
final voiceChat = chat.enableVoice(
speechToText: SpeechToTextConfig(
provider: 'openai',
language: 'en-US',
continuous: true
),
textToSpeech: TextToSpeechConfig(
provider: 'openai',
voice: 'alloy',
speed: 1.0
)
);
// Start listening for user speech
voiceChat.startListening();
// Handle transcribed text
voiceChat.onTranscript((String text) {
print('User said: $text');
// Send the transcribed text to the AI
conversation.sendMessage(text);
});
// Handle AI responses
voiceChat.onResponse((Response response) {
print('AI response: ${response.content}');
// Speak the AI response
voiceChat.speak(response.content);
});
Available voices
You can choose from various voices for text-to-speech:
// Get available voices
const voices = await voiceChat.getAvailableVoices();
console.log(voices);
// Change voice settings
voiceChat.setVoicePreferences({
voice: 'echo',
speed: 1.2,
language: 'en-US'
});
Text Chat Integration
Here's an example of how to integrate text chat in a web application:
// Initialize the SDK
import { ZeebeeChat } from '@zeebee-ai/chat-sdk';
const chat = new ZeebeeChat({
apiKey: 'your-api-key',
model: 'gpt-4o'
});
// Create a conversation
let conversation;
let messageList = document.getElementById('message-list');
let messageInput = document.getElementById('message-input');
let sendButton = document.getElementById('send-button');
// Initialize
async function init() {
conversation = await chat.createConversation();
}
// Send message
async function sendMessage() {
const userMessage = messageInput.value.trim();
if (!userMessage) return;
// Clear input
messageInput.value = '';
// Add user message to UI
addMessageToUI('user', userMessage);
// Show typing indicator
showTypingIndicator();
try {
// Stream response for better UX
const stream = await conversation.streamMessage(userMessage);
// Create AI message element
let aiMessageContent = '';
const aiMessageEl = document.createElement('div');
aiMessageEl.className = 'message ai';
messageList.appendChild(aiMessageEl);
// Process streamed tokens
stream.onToken((token) => {
aiMessageContent += token;
aiMessageEl.textContent = aiMessageContent;
messageList.scrollTop = messageList.scrollHeight;
});
// Handle completion
stream.onComplete(() => {
hideTypingIndicator();
});
} catch (error) {
hideTypingIndicator();
addMessageToUI('system', 'Error: ' + error.message);
}
}
// Helper functions
function addMessageToUI(role, content) {
const messageEl = document.createElement('div');
messageEl.className = `message ${role}`;
messageEl.textContent = content;
messageList.appendChild(messageEl);
messageList.scrollTop = messageList.scrollHeight;
}
function showTypingIndicator() {
const indicator = document.createElement('div');
indicator.id = 'typing-indicator';
indicator.className = 'typing-indicator';
indicator.innerHTML = 'AI is typing...';
messageList.appendChild(indicator);
messageList.scrollTop = messageList.scrollHeight;
}
function hideTypingIndicator() {
const indicator = document.getElementById('typing-indicator');
if (indicator) indicator.remove();
}
// Event listeners
sendButton.addEventListener('click', sendMessage);
messageInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') sendMessage();
});
// Initialize on page load
init();
This code creates a basic chat interface that streams AI responses for a better user experience. For a complete working example, see our example projects.
Example Projects
Explore these example projects to see the ZeebeeAI Chat SDK in action:
Simple Chat
A basic chat application with text streaming and conversation history.
Voice Assistant
A voice-enabled chat application with speech recognition and text-to-speech.
Semantic Search
A demonstration of semantic search capabilities for finding conversations and messages.
Flutter Chat App
A mobile chat application built with Flutter, featuring both text and voice capabilities.