A zero-API, zero-backend AI chat widget for any website.
No LLM. No API key. No server. Just drop in two files.
A gift from Opcelerate Neural to the world. π
Free. Forever. MIT licensed. Use it, fork it, ship it β no strings attached.
- π§ Pattern-based AI β answers questions from your knowledge base in milliseconds
- π¬ Chat history β saves & browses past conversations via localStorage (like ChatGPT)
- π Page-aware greetings β knows which page the visitor is on and tailors its opener
- β‘ Proactive engagement β bounces after a configurable delay to invite interaction
- π Lead capture β offers a name/email form after N messages (hooks to any webhook)
- π± Mobile-friendly β full-width bottom sheet on mobile, floating panel on desktop
- π LLM upgrade path β swap one function to add Gemini/GPT when you're ready
1. Copy the files into your project:
your-website/
βββ widget.js
βββ widget.css
βββ avatar.png β optional, use any square image
2. Add to your HTML:
<!-- In <head> -->
<link rel="stylesheet" href="widget.css" />
<!-- Before </body> -->
<script>
window.AgenticChatConfig = {
name: 'Aria', // Widget name
role: 'AI Assistant', // Subtitle
avatar: 'avatar.png', // Your avatar image
brand: '#6c63ff', // Primary brand color
brandDark: '#4b44cc', // Darker gradient shade
brandLight: '#8b85ff', // Lighter gradient shade
bg: '#0f172a', // Panel background
proactiveSec: 8, // Proactive bounce delay (0 = off)
leadNudgeAfter: 5, // Lead form after N messages (0 = off)
footerNote: 'Aria is an AI β for specific help, contact our team.',
};
</script>
<script src="widget.js" defer></script>3. Edit the knowledge base inside widget.js:
const KB = {
services: {
patterns: [/what do you (do|offer)|services?/i],
responses: ['We help businesses with...'],
chips: ['Learn more', 'Pricing', 'Contact us']
},
pricing: {
patterns: [/price|cost|fee|how much/i],
responses: ['Our plans start at $X/month...'],
chips: ['Get a quote', 'Talk to sales']
},
// ... add as many intents as you like
};That's it. No build step. No npm. No account.
| Key | Type | Default | Description |
|---|---|---|---|
name |
string | 'Sage' |
Widget display name |
role |
string | 'AI Assistant' |
Subtitle in header |
avatar |
string | '' |
Path to avatar image (falls back to β¦) |
brand |
string | '#6c63ff' |
Primary brand color |
brandDark |
string | '#4b44cc' |
Darker gradient shade |
brandLight |
string | '#8b85ff' |
Lighter gradient shade |
bg |
string | '#0f172a' |
Panel background color |
proactiveSec |
number | 8 |
Seconds before proactive bounce; 0 = disabled |
leadNudgeAfter |
number | 5 |
Messages before showing lead form; 0 = disabled |
footerNote |
string | '...' |
Small disclaimer text at panel bottom |
const KB = {
intentName: {
patterns: [/regex/i], // RegExp array to match user input
responses: ['Response string'], // Picked at random
chips: ['Quick reply 1', '...'], // Optional quick-reply buttons
navigate: 'page.html', // Optional "Take me there" link
handler: (text) => 'dynamic response', // Optional: overrides responses
},
fallback: {
// No patterns β always fires if nothing else matches
responses: ['I\'m not sure, but our team can help!'],
}
};Tips:
- Order intents specific β general (first match wins)
- Cover synonyms:
/price|cost|fee|how much|charge/i - Anchor greetings:
/^(hi|hello|hey)/i
| Intent | Patterns to include |
|---|---|
| Greeting | hi, hello, hey, good morning |
| Services | what do you do, offerings, help with |
| Pricing | price, cost, fee, how much |
| About | who are you, about you, background |
| Contact | contact, reach, email, call, support |
| Location | office, where, city, address |
| Get started | sign up, begin, how do I start |
| FAQ | how does it work, explain |
| Farewell | bye, thanks, that's all |
The regex approach handles ~95% of conversations. When you need full NLU:
// Replace classifyIntent() + getResponse() with:
async function askAI(text) {
const res = await fetch('/api/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: text, page: window.location.pathname })
});
const { reply } = await res.json();
return reply;
}Add a serverless function (Netlify, Vercel, Cloudflare Worker) β all the UI stays identical.
| Approach | Monthly Cost | Intelligence |
|---|---|---|
| AgenticChat (regex) | $0 | Pattern matching |
| + Gemini 2.0 Flash | ~$5β20 | True NLU |
| + GPT-4o-mini | ~$5β30 | True NLU |
| Intercom / Drift | $400β$1,000+ | Rules-based SaaS |
agentic-chat-widget/
βββ widget.js β Core widget (KB + engine + UI)
βββ widget.css β All styles
βββ index.html β Live demo / landing page
βββ avatar.png β Replace with your own
βββ README.md
python3 << 'PY'
import glob
WIDGET = '<script src="widget.js" defer></script>'
for page in glob.glob('*.html'):
with open(page, 'r') as f: content = f.read()
if 'widget.js' in content: print(f'SKIP {page}'); continue
content = content.replace('</body>', f' {WIDGET}\n</body>', 1)
with open(page, 'w') as f: f.write(content)
print(f'OK {page}')
PYMIT β free for personal and commercial use. No attribution required.
AgenticChat is Opcelerate's open-source contribution to the developer community.
Opcelerate Neural builds Industrial AI and Agentic AI solutions β from predictive analytics to full agentic software platforms. This widget is our gift to every developer building on the web.
If this helped your project, a GitHub star means everything. π
Bug reports and PRs are very welcome.