# Add an AI chatbot to your website

URL: https://bridge.wekoya.tech/guides/ai-chatbot-for-your-website
Updated: 2026-11-19

**In short:** Add a small route to your server that sends each visitor's message to a model on Bridge by Wekoya with your business details, and a chat box on your page that calls that route. You pay per message from a naira balance, and you can cap what each visitor spends.

## How it fits together

1. [Create a free account](https://bridge.wekoya.tech/sign-up), top up in naira by bank transfer, and create a key under API keys. The key stays on your server, never in the page.
2. Add a route to your server that takes the visitor's messages, adds what the bot should know about your business, and asks Bridge for a reply.
3. Add a chat box to your page that sends the visitor's message to your route and shows the reply.

## The server route

Bridge works with the OpenAI SDK: point it at Bridge and pick any model. This route uses Node.js with Express; the same few lines work in any framework.

```javascript
import express from "express"
import OpenAI from "openai"

const bridge = new OpenAI({ apiKey: process.env.BRIDGE_API_KEY, baseURL: "https://wekoya-api.wekoya.tech/v1" })
const app = express()
app.use(express.json())

// What the bot knows. Keep it short and true: prices, hours, delivery, how to order.
const BUSINESS = "You are the assistant for Ada's Salon in Yaba, Lagos. Open 9am to 7pm, Monday to Saturday. Braids from N15,000. Book on WhatsApp: 0803 000 0000. If you do not know an answer, say so and give the WhatsApp number."

app.post("/api/chat", async (req, res) => {
  // Keep the last few turns only, so a long chat does not grow the cost of every reply.
  const history = (req.body.messages ?? []).slice(-10)
  const reply = await bridge.chat.completions.create({
    model: "gpt-6-luna",
    max_tokens: 500,
    messages: [{ role: "system", content: BUSINESS }, ...history],
  })
  res.json({ reply: reply.choices[0].message.content })
})

app.listen(3000)
```

## The chat box

```html
<div id="chat"></div>
<form id="ask"><input id="text" placeholder="Ask us anything" required /><button>Send</button></form>
<script>
  const messages = []
  document.getElementById("ask").addEventListener("submit", async (event) => {
    event.preventDefault()
    const input = document.getElementById("text")
    messages.push({ role: "user", content: input.value })
    show("You", input.value)
    input.value = ""
    const response = await fetch("/api/chat", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ messages }) })
    const data = await response.json()
    messages.push({ role: "assistant", content: data.reply })
    show("Us", data.reply)
  })
  function show(who, text) {
    const line = document.createElement("p")
    line.textContent = who + ": " + text
    document.getElementById("chat").append(line)
  }
</script>
```

## What it costs

You pay per message from your naira balance, with nothing to renew. Work out a month of chats on any model:

| Model | One everyday message | 50 a day for 30 days |
| --- | --- | --- |
| [DeepSeek V4.1 Flash 1017](https://bridge.wekoya.tech/models/deepseek-v4-1-flash) | ₦0.568 | ₦851 |
| [Gemini 3.8 Flash](https://bridge.wekoya.tech/models/gemini-3-8-flash) | ₦5.01 | ₦7,518 |
| [Claude Haiku 5.5](https://bridge.wekoya.tech/models/claude-haiku-5-5) | ₦0.668 | ₦1,002 |

## Keep spending under control

- Put a naira limit on the key under API keys, so the bot can never spend more than you set in a month. See [key limits](https://bridge.wekoya.tech/docs/restrict-models).
- Give each signed-in visitor their own budget with [your users' budgets](https://bridge.wekoya.tech/docs/end-users): Bridge stops one person's chats when their budget is used, without touching anyone else's.
- To call Bridge straight from the page or a phone app instead of through your server, give each visitor a short-lived [guest key](https://bridge.wekoya.tech/docs/guest-keys) with a spending cap. Never put your own key in the page.
- For a bot that answers from a long catalogue or manual, look up the relevant part first with [embeddings](https://bridge.wekoya.tech/docs/embeddings) and send only that.

[Create a free account](https://bridge.wekoya.tech/sign-up)

## Common questions

**How much does a website chatbot cost to run?**

It depends on the model and how many messages your visitors send. The calculator above shows today's cost in naira per message, per day and per month for any model on Bridge.

**Can the chatbot answer in Yoruba, Hausa or Igbo?**

You can use N-ATLAS, Nigeria's own model, which reads and writes English, Yoruba, Hausa and Igbo. See [Yoruba, Hausa and Igbo AI translation](https://bridge.wekoya.tech/guides/yoruba-hausa-igbo-ai-translator).

**Is my API key safe in a website?**

Only on your server. The page talks to your server, and your server talks to Bridge. To call Bridge from the page itself, use a short-lived guest key with a spending cap.

## Read next

- [Build an AI WhatsApp bot](https://bridge.wekoya.tech/guides/whatsapp-ai-bot)
- [AI cost calculator in naira](https://bridge.wekoya.tech/guides/ai-cost-calculator-naira)
- [Add AI to your app from Nigeria](https://bridge.wekoya.tech/guides/add-ai-to-your-app-nigeria)
