reapi-sdk
v0.1.0
Published
OpenAI-compatible SDK for the reAPI gateway (https://reapi.ai). Use the OpenAI client you already know, pointed at reAPI.
Maintainers
Readme
reapi-sdk
OpenAI-compatible SDK for the reAPI gateway.
reAPI speaks the OpenAI API. This package is a thin wrapper around the official
openai client, pre-pointed at https://api.reapi.ai/v1 — so you keep every
method, type, and streaming helper you already know.
Install
npm install reapi-sdkQuick start
import { createReapi } from "reapi-sdk"
// Reads your key from process.env.REAPI_API_KEY, or pass { apiKey }.
const client = createReapi()
// Models are discovered at runtime — nothing is hard-coded:
const { data: models } = await client.models.list()
const res = await client.chat.completions.create({
model: models[0].id,
messages: [{ role: "user", content: "Hello from reAPI" }],
})
console.log(res.choices[0].message.content)Streaming
const stream = await client.chat.completions.create({
model: "<model-id>",
messages: [{ role: "user", content: "Stream this" }],
stream: true,
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "")
}API key
Get an API key at reapi.ai. Provide it either way:
const client = createReapi({ apiKey: "YOUR_KEY" })export REAPI_API_KEY=YOUR_KEYLicense
MIT — see LICENSE.
