WiliChat Developer Documentation

Build powerful AI-powered applications with WiliChat SDK. Integrate chatbots, assistants, and analyzers in minutes.

Quick Start
Get started with WiliChat SDK in 3 simple steps
1

Install the SDK

npm install @wilichat/sdk
2

Get Your API Key

Sign up for a WiliChat account and navigate to Settings → API Keys to create your first API key.

export WILICHAT_API_KEY="your-api-key-here"
3

Make Your First Request

import WiliChat from '@wilichat/sdk';

const client = new WiliChat({
  apiKey: process.env.WILICHAT_API_KEY
});

const response = await client.chat.create({
  model: 'gpt-4',
  messages: [
    { role: 'user', content: 'Hello, WiliChat!' }
  ],
  stream: true
});

for await (const chunk of response) {
  process.stdout.write(chunk.content);
}

SDK Methods

Chat
client.chat.create()

Create a new chat conversation with streaming support

client.chat.stream()

Stream chat responses in real-time

client.chat.createConversation()

Create a new conversation thread

client.chat.getConversation()

Retrieve conversation history

Files & RAG
client.files.upload()

Upload files for document processing and RAG

client.files.list()

List all uploaded files

client.files.delete()

Delete a file

client.files.reprocess()

Reprocess a file for better indexing

Conversations
client.conversations.list()

List all conversations

client.conversations.get()

Get conversation details

client.conversations.delete()

Delete a conversation

client.conversations.messages()

Get messages from a conversation

Common Use Cases
Real-world examples to get you started quickly

Build Chatbots

Create intelligent chatbots for customer support, sales, and engagement

const chatbot = await client.chat.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: userMessage }],
  persona: 'customer-support'
});

Document Analysis

Upload documents and ask questions based on their content using RAG

// Upload document
const file = await client.files.upload({
  file: documentFile,
  type: 'pdf'
});

// Query the document
const response = await client.chat.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Summarize this document' }],
  fileId: file.id
});

Streaming Responses

Get real-time streaming responses for better user experience

const stream = await client.chat.stream({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Tell me a story' }]
});

for await (const chunk of stream) {
  displayChunk(chunk.content);
}
Supported Languages
JavaScript
TypeScript
Python
Node.js

Official SDKs available for popular languages. More coming soon!

Webhooks

Receive real-time notifications for events like new messages, conversation updates, and file processing.

Coming Soon
Authentication
Secure API key authentication

Using API Keys

Your API key is automatically used when you initialize the SDK:

const client = new WiliChat({
  apiKey: process.env.WILICHAT_API_KEY
});

Security Best Practices

  • • Never expose your API keys in client-side code
  • • Use environment variables to store API keys
  • • Rotate your API keys regularly
  • • Revoke compromised keys immediately

Ready to Build Amazing Things?

Get started with WiliChat SDK and build chatbots, assistants, and analyzers in minutes.