Provider-agnostic

Bring your own embedder. Bring your own model.

doks ships with two adapters: one for embeddings (lib/embed.ts) and one for chat completions. Both are small async functions. Swap providers without touching the pattern.

The adapter

One function. Every provider.

The whole integration surface is a single async function: takes a system prompt, a question, and history; yields tokens.

lib/chat.ts · model adapter (provider-agnostic)
// One adapter, swap providers by changing the URL + auth.
async function callModel({ system, question, hist }) {
  const res = await fetch(PROVIDER_URL, {
    method: "POST",
    headers: { "authorization": `Bearer ${KEY}` },
    body: JSON.stringify({
      model: MODEL,
      stream: true,
      messages: [{ role: "system", content: system },
                 ...hist,
                 { role: "user", content: question }]
    })
  });
  return parseSSE(res.body);
}
MIT · OPEN SOURCE

Read the source. Fork it. Ship it.

doks is a public pattern, released under MIT. There is no company behind it, no email list to join, and nothing to install beyond a Next.js project. Take it and make your docs answer questions.