See a full example that uses Scoopika here.

Server-side

npm install @scoopika/scoopika
import express from "express";
import endpoint from "./scoopika"; // path to your Scoopika endpoint

const app = express();
app.use(express.json()); // Required middleware

app.post("/scoopika", (req, res) => {
	endpoint.handleRequest({
		request: req.body,
		stream: (s) => res.write(s),
		end: () => res.end()
	});
})

Client-side

npm install @scoopika/client
import { Client, Agent } from "@scoopika/client";

const client = new Client("API_URL");
const agent = new Agent("AGENT_ID", client);

(async () => {
	const response = await agent.run({
		inputs: { message: "Hello!" },
		hooks: {
			onToken: (t) => console.log(t)
		}
	});

	console.log(response);
})();