Integrations · JavaScript
Build a React Chatbot
Build an AI-powered chatbot in React with streaming responses. Connect to XALEN API for astrology Q&A or temple assistance.
1. Install
npm install xalen-sdk
2. Code
// React component with streaming
#89B4FA;">const [messages, setMessages] = useState([]);
#89B4FA;">async function sendMessage(content) {
#89B4FA;">const response = await fetch('https://api.xalen.io/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer xln_test_YOUR_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'vedika-standard',
messages: [...messages, { role: 'user', content }],
stream: true
})
});
// Process SSE stream...
}
Related Tutorials
Next.js API Routes Integrations · JavaScript
Flutter Integration Integrations · Dart
LangChain Integration Integrations · Python
LlamaIndex Integration Integrations · Python
Python Quickstart Getting Started · Python
JavaScript Quickstart Getting Started · JavaScript
200+ AI models. One API. Start building in 5 minutes.
Get API KeyLast updated: 2026-05-21