Chat API Endpoints
DeepWikiOpen provides powerful chat capabilities with streaming responses, deep research mode, conversation management, and real-time WebSocket connections.Authentication
All chat endpoints require authentication using Bearer tokens:Rate Limits
- Standard Chat: 100 requests per minute
- Research Mode: 20 requests per minute
- WebSocket: 1000 messages per minute
- History Operations: 200 requests per minute
POST /chat/stream
Stream chat responses with RAG (Retrieval-Augmented Generation) capabilities.string
required
The user’s message or question
string
Unique identifier for conversation continuity. Auto-generated if not provided.
string
default:"gpt-4-turbo"
AI model to use for response generationOptions:
gpt-4-turbo, gpt-3.5-turbo, claude-3-opus, claude-3-sonnetnumber
default:"0.7"
Response creativity (0.0 to 2.0)
number
default:"2048"
Maximum response length (1 to 4096)
array
Specific knowledge sources to queryOptions:
wikipedia, academic_papers, news, documentation, allobject
Request Example
Streaming Response Format (SSE)
The response is streamed using Server-Sent Events (SSE) format:string
Type of stream chunkValues:
start, content, sources, metadata, end, errorstring
Text content (for
content type chunks)array
object
Example Stream Response
POST /chat/research
Trigger deep research mode for comprehensive, multi-source analysis.string
required
Research question or topic
string
default:"standard"
Depth of research analysisOptions:
quick, standard, deep, comprehensivearray
Types of sources to include in researchOptions:
academic, wikipedia, news, documentation, books, patentsobject
number
default:"20"
Maximum number of sources to analyze (5 to 100)
string
default:"structured"
Response format structureOptions:
structured, narrative, bullet_points, academicRequest Example
Response Format
string
Unique identifier for the research session
string
Original research query
string
Executive summary of findings
array
string
Comprehensive analysis text
array
object
GET /chat/history
Retrieve conversation history for a specific conversation or user.string
Specific conversation ID to retrieve
string
User ID to get all conversations for
number
default:"50"
Maximum number of messages to return (1 to 1000)
number
default:"0"
Number of messages to skip for pagination
string
Filter messages after this date (ISO 8601)
string
Filter messages before this date (ISO 8601)
Request Example
Response Format
string
Conversation identifier
array
Array of conversation messages
string
Unique message identifier
string
Message sender roleValues:
user, assistant, systemstring
Message content
string
Message timestamp (ISO 8601)
object
DELETE /chat/history
Clear conversation history for a specific conversation or user.string
Specific conversation to clear (optional if user_id provided)
string
Clear all conversations for user (optional if conversation_id provided)
string
Only clear messages before this date (ISO 8601)
Request Example
Response Format
boolean
Whether the operation was successful
number
Number of messages deleted
number
Number of conversations affected
WebSocket /ws/chat
Real-time bidirectional chat connection with live streaming and collaborative features.Connection URL
Query Parameters
string
required
Your API authentication token
string
Conversation ID to connect to (auto-generated if not provided)
string
User identifier for multi-user conversations
Connection Example
Message Types
Client to Server Messages
string
required
Message typeValues:
message, typing, stop_generation, join_room, leave_roomstring
Message content (for
message type)string
AI model to use (for
message type)string
Room to join/leave (for room operations)
Server to Client Messages
string
Response typeValues:
content, sources, user_message, typing, error, connection_infostring
Response content or user message
string
Username for user messages and typing indicators
string
Current conversation identifier
Real-time Features
Typing Indicators
Multi-user Chat Rooms
Stop AI Generation
Error Handling
HTTP Error Codes
Bad Request
Invalid request parameters or malformed JSON
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions or quota exceeded
Not Found
Conversation or resource not found
Too Many Requests
Rate limit exceeded
Internal Server Error
Server error - try again later
Error Response Format
WebSocket Error Codes
Invalid Token
Authentication token is invalid or expired
Rate Limited
Too many messages sent too quickly
Invalid Message
Message format is invalid or unsupported
Conversation Not Found
Specified conversation ID doesn’t exist
Real Conversation Examples
Basic Q&A with Streaming
Deep Research Mode
WebSocket Multi-user Chat
SDK Libraries
For easier integration, use our official SDK libraries:- Python:
pip install deepwikiopen - JavaScript/Node.js:
npm install deepwikiopen-sdk - Go:
go get github.com/deepwikiopen/go-sdk - Rust:
cargo add deepwikiopen