SUPREME Setu API — Early Access
The SUPREME Setu OpenAI-compatible endpoints preview the upcoming public release. Want early access or custom organizational quota limits? Contact our solutions engineering team.
TypeScript / JavaScript SDK
Use the standard openai npm package configured with the Setu base URL to build Node.js scripts, backend APIs, or Next.js server actions.
Installation
bash
npm install openai
# or
pnpm add openaiBasic Completion
typescript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.SUPREME_API_KEY,
baseURL: 'https://supremeai.services/api/setu/v1',
});
async function run() {
const completion = await client.chat.completions.create({
model: 'quantum-lite',
messages: [
{ role: 'system', content: 'You are a helpful software engineer assistant.' },
{ role: 'user', content: 'Explain TypeScript generics in 2 bullet points.' },
],
});
console.log(completion.choices[0]?.message?.content);
}
run();Streaming with async iterables
typescript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.SUPREME_API_KEY,
baseURL: 'https://supremeai.services/api/setu/v1',
});
async function streamResponse() {
const stream = await client.chat.completions.create({
model: 'quantum-lite',
messages: [{ role: 'user', content: 'Explain recursion.' }],
stream: true,
});
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content || '';
process.stdout.write(text);
}
}
streamResponse();