AI Chat SDK Platform API Reference
Table of Contents
Introduction #
The AI Chat SDK Platform provides a comprehensive set of APIs for integrating AI conversational capabilities into your applications. This document serves as a reference for all available API endpoints, WebSocket interactions, and common usage patterns.
Base URLs #
-
REST API:
https://api.zeebee.ai/v1
-
WebSocket:
wss://api.zeebee.ai/v1/ws
Authentication #
API Key Authentication
Most API endpoints require authentication using an API key. Include
your API key in all requests using the
Authorization
header:
X-API-Key: your_api_key
You can manage your API keys in the dashboard or through the API key management endpoints.
Session Authentication
For web applications, you can use session-based authentication. The platform uses HTTP cookies to maintain session state.
Common Parameters #
All endpoints accept the following common parameters:
Parameter | Type | Description |
---|---|---|
user_id |
string | (Required) Identifier for the user. Use a consistent ID to maintain conversation history |
conversation_id |
string | (Optional) ID of an existing conversation. If not provided, a new conversation will be created |
model |
string | (Optional) AI model to use. Defaults to "gpt-4o" |
REST API Endpoints #
Health Check #
{
"status": "ok",
"service": "AI Chat SDK Platform",
"version": "0.1.0"
}
Chat #
{
"messages": [
{"role": "system", "content": "You are a helpful assistant."}, // Optional
{"role": "user", "content": "Hello, how can you help me?"}
],
"model": "gpt-4o", // AI model to use
"conversation_id": "conv_12345", // Optional ID of existing conversation
"stream": false, // Whether to stream the response
"temperature": 0.7, // Controls randomness (0-1)
"max_tokens": 2048, // Maximum tokens in the response
"user_id": "user123" // User identifier
}
{
"message": "Hello! I'm an AI assistant powered by GPT-4o...",
"conversation_id": "conv_12345",
"message_id": "msg_67890"
}
Available Models #
{
"models": [
{
"id": "model_1",
"name": "gpt-4o",
"display_name": "GPT-4o",
"provider": "OpenAI",
"max_tokens": 8192,
"context_length": 128000
},
{
"id": "model_2",
"name": "claude-3-5-sonnet",
"display_name": "Claude 3.5 Sonnet",
"provider": "Anthropic",
"max_tokens": 4096,
"context_length": 200000
},
{
"id": "model_3",
"name": "grok-2-1212",
"display_name": "Grok 2",
"provider": "xAI",
"max_tokens": 4096,
"context_length": 131072
},
{
"id": "model_4",
"name": "qwen-max",
"display_name": "Qwen Max",
"provider": "Alibaba Cloud",
"max_tokens": 6144,
"context_length": 32768
},
{
"id": "model_5",
"name": "gpt-3.5-turbo",
"display_name": "GPT-3.5 Turbo",
"provider": "OpenAI",
"max_tokens": 4096,
"context_length": 16385
},
{
"id": "model_6",
"name": "claude-3-opus",
"display_name": "Claude 3 Opus",
"provider": "Anthropic",
"max_tokens": 4096,
"context_length": 200000
}
]
}
Available Features #
{
"features": [
{
"id": "feature_1",
"name": "voice_chat",
"enabled": true
},
{
"id": "feature_2",
"name": "semantic_search",
"enabled": true
},
{
"id": "feature_3",
"name": "agent_orchestration",
"enabled": true
},
{
"id": "feature_4",
"name": "autonomous_routing",
"enabled": true
},
{
"id": "feature_5",
"name": "dynamic_layout_engine",
"enabled": true
},
{
"id": "feature_6",
"name": "policy_engine",
"enabled": true
},
{
"id": "feature_7",
"name": "multi_model_access",
"enabled": true
}
]
}
Prompt Templates #
{
"templates": [
{
"id": "template_1",
"name": "standard_assistant",
"display_name": "Standard Assistant",
"description": "A general-purpose AI assistant"
},
{
"id": "template_2",
"name": "expert_assistant",
"display_name": "Expert Assistant",
"description": "An expert-level AI assistant for specialized topics"
},
{
"id": "template_3",
"name": "customer_support_assistant",
"display_name": "Customer Support",
"description": "An assistant specialized in customer support interactions"
}
]
}
-
template_name
: Name of the template to retrieve
{
"id": "template_1",
"name": "standard_assistant",
"display_name": "Standard Assistant",
"description": "A general-purpose AI assistant",
"system_prompt": "You are a helpful AI assistant named Zeebee. Be concise, accurate, and helpful in your responses.",
"variables": ["additional_instructions"],
"example_usage": "You can add additional instructions like {\"additional_instructions\": \"Focus on technical explanations\"}"
}
-
conversation_id
: ID of the conversation to update
{
"template_name": "expert_assistant",
"variables": {
"additional_instructions": "Focus on providing technical explanations with code examples."
}
}
{
"status": "success",
"conversation_id": "conv_12345",
"template": "expert_assistant"
}
Feedback #
{
"conversation_id": "conv_12345",
"message_id": "msg_67890",
"feedback_type": "thumbs_up",
"feedback_value": 1,
"comment": "Great response!",
"user_id": "user123"
}
{
"status": "success",
"feedback_id": "feedback_12345"
}
-
conversation_id
: ID of the conversation to analyze
{
"conversation_id": "conv_12345",
"total_messages": 10,
"messages_with_feedback": 5,
"positive_feedback": 4,
"negative_feedback": 1,
"average_rating": 4.5,
"feedback_details": [
{
"message_id": "msg_67890",
"feedback_type": "thumbs_up",
"feedback_value": 1,
"timestamp": "2025-04-20T10:30:45Z"
}
]
}
Speech Transcription #
{
"providers": {
"openai": "OpenAI Whisper",
"google": "Google Speech-to-Text",
"azure": "Azure Speech Services"
}
}
{
"audio": "base64_encoded_audio_data",
"config": {
"encoding": "LINEAR16",
"sample_rate": 16000,
"channels": 1,
"language_code": "en-US"
},
"model": "whisper",
"provider": "openai" // Optional, defaults to "openai"
}
{
"text": "Hello, how can you help me today?",
"detected_language": "en",
"confidence": 0.98
}
Speech Transcription #
{
"providers": {
"openai": "OpenAI Whisper",
"google": "Google Speech-to-Text",
"azure": "Azure Speech Services"
}
}
{
"audio": "base64_encoded_audio_data",
"config": {
"encoding": "LINEAR16",
"sample_rate": 16000,
"channels": 1,
"language_code": "en-US"
},
"model": "whisper",
"provider": "openai" // Optional, defaults to "openai"
}
{
"text": "Hello, how can you help me today?",
"detected_language": "en",
"confidence": 0.98
}
{
"text": "Hello, I'm your AI assistant. How can I help you today?",
"voice_id": "default",
"language_code": "en-US",
"model": "openai_tts"
}
{
"audio": "base64_encoded_audio_data",
"format": "mp3",
"sample_rate": 24000,
"duration_seconds": 3.5
}
{
"user_id": "user123",
"model": "gpt-4o",
"conversation_id": "conv_12345", // Optional
"stt_model": "whisper",
"tts_model": "openai_tts",
"voice_id": "default",
"language_code": "en-US"
}
{
"session_id": "session_12345",
"token": "session_token_for_websocket_auth",
"websocket_url": "wss://api.zeebee.ai/voice/stream/session_12345"
}
Conversation Management #
-
limit
: (Optional) Maximum number of conversations to return (default: 20) -
offset
: (Optional) Offset for pagination (default: 0) -
status
: (Optional) Filter by status (active/archived/all, default: active) -
order
: (Optional) Sort order (desc/asc, default: desc)
{
"conversations": [
{
"id": "conv_12345",
"title": "Help with programming",
"created_at": "2025-04-20T09:15:30Z",
"updated_at": "2025-04-20T10:30:45Z",
"message_count": 8,
"status": "active"
},
{
"id": "conv_67890",
"title": "Travel recommendations",
"created_at": "2025-04-19T14:22:10Z",
"updated_at": "2025-04-19T15:05:22Z",
"message_count": 12,
"status": "active"
}
],
"total": 25,
"limit": 20,
"offset": 0
}
{
"title": "New Conversation", // Optional
"description": "Conversation about programming", // Optional
"model": "gpt-4o", // Optional
"system_prompt": "You are a helpful assistant specialized in programming.", // Optional
"metadata": {} // Optional additional metadata
}
{
"id": "conv_12345",
"title": "New Conversation",
"description": "Conversation about programming",
"created_at": "2025-04-20T11:30:00Z",
"updated_at": "2025-04-20T11:30:00Z",
"system_prompt": "You are a helpful assistant specialized in programming.",
"model": "gpt-4o"
}
conversation_id
: ID of the conversation
{
"id": "conv_12345",
"title": "Help with programming",
"description": "Conversation about Python programming",
"created_at": "2025-04-20T09:15:30Z",
"updated_at": "2025-04-20T10:30:45Z",
"message_count": 8,
"system_prompt": "You are a helpful assistant specialized in programming.",
"model": "gpt-4o",
"status": "active",
"metadata": {}
}
Agent API #
{
"agent_types": [
{
"id": "RetrievalAgent",
"name": "Retrieval Agent",
"description": "Agent for retrieving information from knowledge bases",
"capabilities": ["document_retrieval", "knowledge_base_search"]
},
{
"id": "SummarizationAgent",
"name": "Summarization Agent",
"description": "Agent for summarizing long-form content",
"capabilities": ["text_summarization", "key_point_extraction"]
},
{
"id": "ReasoningAgent",
"name": "Reasoning Agent",
"description": "Agent for performing logical reasoning and analysis",
"capabilities": ["logical_reasoning", "problem_solving"]
},
{
"id": "GenerationAgent",
"name": "Generation Agent",
"description": "Agent for generating creative content",
"capabilities": ["text_generation", "creative_writing"]
},
{
"id": "WebAgent",
"name": "Web Agent",
"description": "Agent for interacting with web resources",
"capabilities": ["web_search", "content_extraction"]
},
{
"id": "StructureAgent",
"name": "Structure Agent",
"description": "Agent for processing and transforming structured data",
"capabilities": ["data_processing", "table_generation"]
}
]
}
{
"agents": [
{
"id": "agent_1",
"name": "Research Assistant",
"description": "Retrieves and analyzes research information",
"agent_type": "RetrievalAgent",
"created_at": "2025-05-01T12:00:00Z",
"updated_at": "2025-05-02T14:30:00Z",
"is_public": false,
"model_id": "gpt-4o"
},
{
"id": "agent_2",
"name": "Code Reviewer",
"description": "Reviews code and suggests improvements",
"agent_type": "ReasoningAgent",
"created_at": "2025-05-01T12:30:00Z",
"updated_at": "2025-05-01T12:30:00Z",
"is_public": true,
"model_id": "claude-3-5-sonnet"
}
]
}
{
"name": "Data Analysis Agent",
"agent_type": "StructureAgent",
"configuration": {
"processing_steps": ["clean", "analyze", "visualize"],
"output_format": "json"
},
"description": "Analyzes data and provides insights", // Optional
"model_id": "claude-3-5-sonnet", // Optional
"is_public": false // Optional, defaults to false
}
{
"id": "agent_3",
"name": "Data Analysis Agent",
"description": "Analyzes data and provides insights",
"agent_type": "StructureAgent",
"model_id": "claude-3-5-sonnet",
"created_at": "2025-05-04T15:30:00Z",
"updated_at": "2025-05-04T15:30:00Z",
"is_public": false,
"configuration": {
"processing_steps": ["clean", "analyze", "visualize"],
"output_format": "json"
}
}
agent_id
: ID of the agent to retrieve
{
"id": "agent_1",
"name": "Research Assistant",
"description": "Retrieves and analyzes research information",
"agent_type": "RetrievalAgent",
"created_at": "2025-05-01T12:00:00Z",
"updated_at": "2025-05-02T14:30:00Z",
"is_public": false,
"model_id": "gpt-4o",
"configuration": {
"search_providers": ["google_scholar", "pubmed"],
"result_count": 5
}
}
agent_id
: ID of the agent to update
{
"name": "Improved Research Assistant", // Optional
"description": "Enhanced agent for research tasks", // Optional
"configuration": { // Optional
"search_providers": ["google_scholar", "pubmed", "arxiv"],
"result_count": 10
},
"model_id": "claude-3-opus", // Optional
"is_public": true // Optional
}
{
"id": "agent_1",
"name": "Improved Research Assistant",
"description": "Enhanced agent for research tasks",
"agent_type": "RetrievalAgent",
"created_at": "2025-05-01T12:00:00Z",
"updated_at": "2025-05-04T16:45:00Z",
"is_public": true,
"model_id": "claude-3-opus",
"configuration": {
"search_providers": ["google_scholar", "pubmed", "arxiv"],
"result_count": 10
}
}
agent_id
: ID of the agent to delete
{
"success": true,
"message": "Agent deleted successfully",
"id": "agent_1"
}
agent_id
: ID of the agent to execute
{
// Input data depends on the agent type
"query": "Analyze the latest trends in renewable energy adoption.",
"parameters": {
"max_results": 5,
"include_charts": true
}
}
{
"success": true,
"execution_id": "exec_12345",
"result": {
"analysis": "Based on recent data, renewable energy adoption is accelerating globally...",
"key_findings": [
"Solar PV installations increased by 25% in 2024",
"Wind power capacity expanded by 19% year-over-year",
"Green hydrogen projects have tripled since 2023"
],
"chart_data": {
"labels": ["2020", "2021", "2022", "2023", "2024"],
"datasets": [...]
}
},
"metrics": {
"execution_time_ms": 2400,
"tokens_used": 1256
}
}
Pipeline API #
{
"name": "Search and Summarize",
"stages": [ // Optional
{
"agent_id": "agent_1",
"name": "Web Search",
"input_mapping": {"query": "$.input.search_query"},
"output_mapping": {"search_results": "$.output.results"}
},
{
"agent_id": "agent_2",
"name": "Summarize",
"input_mapping": {"text": "$.stages.Web Search.search_results"},
"output_mapping": {"summary": "$.output.summary"}
}
],
"description": "Pipeline that searches the web and summarizes the results", // Optional
"visual_layout": { // Optional
"nodes": [...],
"edges": [...]
}
}
{
"pipeline_id": "pipeline_12345",
"name": "Search and Summarize",
"description": "Pipeline that searches the web and summarizes the results",
"created_at": "2025-05-04T17:30:00Z",
"updated_at": "2025-05-04T17:30:00Z",
"stages": [
{
"id": "stage_1",
"agent_id": "agent_1",
"name": "Web Search",
"input_mapping": {"query": "$.input.search_query"},
"output_mapping": {"search_results": "$.output.results"}
},
{
"id": "stage_2",
"agent_id": "agent_2",
"name": "Summarize",
"input_mapping": {"text": "$.stages.Web Search.search_results"},
"output_mapping": {"summary": "$.output.summary"}
}
]
}
-
pipeline_id
: ID of the pipeline to retrieve
{
"pipeline": {
"id": "pipeline_12345",
"name": "Search and Summarize",
"description": "Pipeline that searches the web and summarizes the results",
"created_at": "2025-05-04T17:30:00Z",
"updated_at": "2025-05-04T17:30:00Z",
"configuration": {
"stages": [
{
"id": "stage_1",
"agent_id": "agent_1",
"name": "Web Search",
"input_mapping": {"query": "$.input.search_query"},
"output_mapping": {"search_results": "$.output.results"}
},
{
"id": "stage_2",
"agent_id": "agent_2",
"name": "Summarize",
"input_mapping": {"text": "$.stages.Web Search.search_results"},
"output_mapping": {"summary": "$.output.summary"}
}
]
},
"visual_layout": {
"nodes": [...],
"edges": [...]
}
}
}
pipeline_id
: ID of the pipeline to update
{
"name": "Improved Search and Summarize", // Optional
"description": "Enhanced pipeline for search and summarization", // Optional
"stages": [ // Optional
{
"agent_id": "agent_1",
"name": "Web Search",
"input_mapping": {"query": "$.input.search_query"},
"output_mapping": {"search_results": "$.output.results"}
},
{
"agent_id": "agent_3",
"name": "Analysis",
"input_mapping": {"data": "$.stages.Web Search.search_results"},
"output_mapping": {"analysis": "$.output.analysis"}
},
{
"agent_id": "agent_2",
"name": "Summarize",
"input_mapping": {"text": "$.stages.Analysis.analysis"},
"output_mapping": {"summary": "$.output.summary"}
}
],
"visual_layout": { // Optional
"nodes": [...],
"edges": [...]
}
}
{
"id": "pipeline_12345",
"name": "Improved Search and Summarize",
"description": "Enhanced pipeline for search and summarization",
"created_at": "2025-05-04T17:30:00Z",
"updated_at": "2025-05-05T09:15:00Z",
"stages": [
{
"id": "stage_1",
"agent_id": "agent_1",
"name": "Web Search",
"input_mapping": {"query": "$.input.search_query"},
"output_mapping": {"search_results": "$.output.results"}
},
{
"id": "stage_3",
"agent_id": "agent_3",
"name": "Analysis",
"input_mapping": {"data": "$.stages.Web Search.search_results"},
"output_mapping": {"analysis": "$.output.analysis"}
},
{
"id": "stage_2",
"agent_id": "agent_2",
"name": "Summarize",
"input_mapping": {"text": "$.stages.Analysis.analysis"},
"output_mapping": {"summary": "$.output.summary"}
}
]
}
pipeline_id
: ID of the pipeline to delete
{
"success": true,
"message": "Pipeline deleted successfully",
"id": "pipeline_12345"
}
pipeline_id
: ID of the pipeline to execute
{
// Input data depends on the pipeline's input_mapping
"search_query": "What are the health benefits of meditation?",
"max_results": 5,
"conversation_id": "conv_12345" // Optional
}
{
"execution_id": "exec_67890",
"status": "completed",
"pipeline_id": "pipeline_12345",
"output": {
"summary": "Meditation has been found to have numerous health benefits, including reduced stress and anxiety...",
"key_points": [
"Reduces stress and anxiety",
"Lowers blood pressure",
"Improves sleep quality",
"Enhances focus and concentration",
"May reduce age-related memory loss"
]
},
"metrics": {
"execution_time_ms": 4320,
"stages_completed": 3
}
}
pipeline_id
: ID of the pipeline
{
"executions": [
{
"id": "exec_67890",
"pipeline_id": "pipeline_12345",
"status": "completed",
"created_at": "2025-05-05T10:30:00Z",
"completed_at": "2025-05-05T10:30:04Z",
"execution_time_ms": 4320
},
{
"id": "exec_67891",
"pipeline_id": "pipeline_12345",
"status": "failed",
"created_at": "2025-05-05T09:15:00Z",
"completed_at": "2025-05-05T09:15:02Z",
"execution_time_ms": 2100,
"error": "Error in Web Search stage: Failed to connect to search API"
}
],
"total": 2
}
-
execution_id
: ID of the execution to retrieve
{
"execution": {
"id": "exec_67890",
"pipeline_id": "pipeline_12345",
"status": "completed",
"created_at": "2025-05-05T10:30:00Z",
"completed_at": "2025-05-05T10:30:04Z",
"execution_time_ms": 4320,
"input": {
"search_query": "What are the health benefits of meditation?",
"max_results": 5
},
"output": {
"summary": "Meditation has been found to have numerous health benefits...",
"key_points": [...]
},
"stages": [
{
"id": "stage_1",
"name": "Web Search",
"agent_id": "agent_1",
"status": "completed",
"started_at": "2025-05-05T10:30:00Z",
"completed_at": "2025-05-05T10:30:02Z",
"execution_time_ms": 2000,
"input": {
"query": "What are the health benefits of meditation?"
},
"output": {
"search_results": [...]
}
},
{
"id": "stage_3",
"name": "Analysis",
"agent_id": "agent_3",
"status": "completed",
"started_at": "2025-05-05T10:30:02Z",
"completed_at": "2025-05-05T10:30:03Z",
"execution_time_ms": 1000,
"input": {
"data": [...]
},
"output": {
"analysis": [...]
}
},
{
"id": "stage_2",
"name": "Summarize",
"agent_id": "agent_2",
"status": "completed",
"started_at": "2025-05-05T10:30:03Z",
"completed_at": "2025-05-05T10:30:04Z",
"execution_time_ms": 1320,
"input": {
"text": [...]
},
"output": {
"summary": "Meditation has been found to have numerous health benefits...",
"key_points": [...]
}
}
]
}
}
Routing API #
{
"message": "Can you analyze this dataset and create a visualization?",
"conversation_id": "conv_12345" // Optional
}
{
"success": true,
"intent": {
"id": "intent_12345",
"text": "Can you analyze this dataset and create a visualization?",
"category": "DATA_ANALYSIS",
"confidence": 0.95,
"timestamp": "2025-05-04T15:50:00Z",
"metadata": {
"detected_entities": ["dataset", "visualization"],
"complexity": "medium"
}
}
}
{
"message": "Can you analyze this dataset and create a visualization?",
"conversation_id": "conv_12345", // Optional
"context": { // Optional
"history": [
{"role": "user", "content": "I have a CSV file with sales data."},
{"role": "assistant", "content": "Great! What would you like to do with this sales data?"}
],
"preferences": {
"preferred_models": ["gpt-4o"],
"routing_strategy": "performance"
}
}
}
{
"success": true,
"route_to": "DataAnalysisAgent",
"route_type": "agent",
"confidence": 0.85,
"intent": {
"id": "intent_12345",
"category": "DATA_ANALYSIS",
"confidence": 0.95
},
"rationale": "The user is requesting data analysis and visualization, which aligns with the capabilities of the DataAnalysisAgent.",
"alternative_routes": [
{
"route_to": "VisualizationPipeline",
"route_type": "pipeline",
"confidence": 0.70
},
{
"route_to": "gpt-4o",
"route_type": "model",
"confidence": 0.65
}
]
}
{
"message": "Can you analyze this dataset and create a visualization?",
"selected_route": "CodeAssistantAgent",
"conversation_id": "conv_12345" // Optional
}
{
"success": true,
"message": "Feedback recorded successfully",
"feedback_id": "feedback_12345"
}
Dynamic Layout API #
{
"message": "Can you create a table comparing different programming languages?",
"routing_result": { // Optional
"route_to": "StructureAgent",
"route_type": "agent",
"suggested_template": "table-layout",
"content_analysis": {
"contentTypes": ["table", "comparison"],
"complexity": "medium"
}
}
}
{
"success": true,
"layout": {
"template": "table-layout",
"components": [
{
"type": "table",
"id": "comparison-table",
"config": {
"headers": true,
"striped": true,
"sortable": true
}
},
{
"type": "text",
"id": "explanation",
"config": {
"format": "markdown"
}
}
],
"styling": {
"color_scheme": "technical",
"fonts": {
"headings": "Roboto",
"body": "Open Sans"
}
},
"content_analysis": {
"contentTypes": ["table", "comparison"],
"complexity": "medium"
}
}
}
WebSocket API #
The WebSocket API allows for real-time communication, particularly for voice chat functionality. For detailed information, see the WebSocket API Documentation.
Connection
Connect to the WebSocket server using the URL from the WebSocket configuration endpoint:
const socket = new WebSocket('ws://localhost:6789');
Message Types
All WebSocket messages use JSON format with a type
field
that determines the message's purpose. Key message types include:
init
- Initialization messagetext
- Text messageaudio
- Audio messagetext_response
- Text response from the AIaudio_response
- Audio response from the AItranscript
- Transcription resulterror
- Error message
Rate Limits #
The platform implements rate limiting to ensure fair usage:
Tier | Requests per minute | Requests per day |
---|---|---|
Free | 10 | 100 |
Basic | 60 | 1,000 |
Pro | 120 | 5,000 |
Enterprise | 500 | 50,000 |
When rate limits are exceeded, the API will return a 429 status code with information about when the rate limit will reset.
Error Codes #
Status Code | Meaning | Description |
---|---|---|
200 | OK | Request succeeded |
400 | Bad Request | Invalid request format or parameters |
401 | Unauthorized | Missing or invalid API key |
403 | Forbidden | Valid API key but insufficient permissions |
404 | Not Found | Resource not found |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Server encountered an error |
SDKs and Client Libraries #
The AI Chat SDK Platform provides client libraries for easy integration:
Example Usage #
Basic Chat Example (JavaScript)
import { ZeebeeAI } from 'zeebee-ai-client';
// Initialize the client
const client = new ZeebeeClient({
apiKey: 'YOUR_API_KEY',
userId: 'user123'
});
// Send a message and get a response
async function sendMessage() {
const response = await client.chat({
message: 'Hello, how can you help me?',
model: 'gpt-4o'
});
console.log(response.message);
console.log(`Conversation ID: ${response.conversation_id}`);
}
sendMessage();
For more examples and implementation patterns, see the Examples page.