@keluhq/sdk lets any JavaScript app ask your knowledge base questions and get streamed answers with citations. Use it in browsers and React Native with a public key, or in Node.js 18 or later with a secret key pair.
Set up
Create a client key
Open the knowledge base, go to Integrations, and under Client Keys click Create key. Choose Public key for code that runs in a browser or app. Choose Secret pair for a server: you get a client ID (
kl_ci_…) and a secret (kl_cs_…). Copy the secret now; it is shown only once.The Developer SDKs tab beside it shows the code below with your knowledge base ID and a public key filled in. The ID is also the part of the dashboard address after /knowledge-bases/.Create the client
app.kelu.dev also needs a reCAPTCHA token on every request. The client gets one for you: see CAPTCHA. A secret pair never needs one.renderMarkdown so it looks the same as in the widget: see Showing the answer.
Label each citation with its index, not its position in the list. The list holds only the sources the answer cited, so the numbers can skip.
Every option, method, type and error code is in the @keluhq/sdk reference.