AI SDK quickstart
The gateway in your codebase. One install, one environment variable, typed calls to supported gateway endpoints.
Prerequisites
- An AI Gateway API key (
sk-sc-...) — see the AI Gateway quickstart. - Node.js 22.23.2+ in the 22.x line, or 24.21.0+ in the 24.x line, and npm. Keep the SDK and key on your server.
1. Install
Download the SDK package, then install the local archive:
npm install ./setcloud-ai-0.1.0.tgz
2. Set your key
export SETCLOUD_API_KEY="sk-sc-..."
The client reads SETCLOUD_API_KEY from the environment.
3. Call a model
import { SetCloud } from '@setcloud/ai';
const ai = new SetCloud();
const reply = await ai.chat({
model: 'nova-micro',
messages: [{ role: 'user', content: 'Write a haiku about deploys.' }],
});
console.log(reply.content);
Model ids are the same as the gateway’s — list them with GET /v1/models or in the dashboard.
4. Stream the response
const stream = await ai.chat({
model: 'nova-lite',
messages: [{ role: 'user', content: 'Explain DNS to a five-year-old.' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.content ?? '');
}
Next
- API reference — the HTTP layer underneath.
- AI Gateway quickstart — keys, usage, the playground.