Bridge by Wekoya / Guides / Add an AI chatbot to your website

Add an AI chatbot to your website

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.

Updated

How it fits together

  1. Create a free account, 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.

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

<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:

ModelOne everyday message50 a day for 30 days
DeepSeek V4.1 Flash 1017₦0.568₦851
Gemini 3.8 Flash₦5.01₦7,518
Claude Haiku 5.5₦0.668₦1,002

Keep spending under control

Create a free account

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.

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