import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.neosantara.xyz/v1",
apiKey: process.env.NEOSANTARA_API_KEY,
});
// Turn 1: Persist context
const turn1 = await client.responses.create({
model: "deepseek-v4.1-flash",
input: "Hello, my name is Alex and I am a network engineer based in Jakarta.",
store: true,
});
console.log("Turn 1 Output:", turn1.output_text);
// Turn 2: Forward previous_response_id
const turn2 = await client.responses.create({
model: "deepseek-v4.1-flash",
input: "Based on my background, which certification should I pursue first?",
previous_response_id: turn1.id,
store: true,
});
console.log("Turn 2 Output:", turn2.output_text);
// Turn 3: Chain further
const turn3 = await client.responses.create({
model: "deepseek-v4.1-flash",
input: "What is the estimated examination cost for that certification in Indonesia?",
previous_response_id: turn2.id,
store: true,
});
console.log("Turn 3 Output:", turn3.output_text);