The AI SDK is a typed, server-side code library for the AI Gateway — same models, same sk-sc- keys, same usage meter, with editor autocomplete instead of hand-rolled HTTP requests.

Install

Download the SDK package, then install the local archive:

npm install ./setcloud-ai-0.1.0.tgz

Set your key once, in the environment:

export SETCLOUD_API_KEY="sk-sc-..."

The client reads SETCLOUD_API_KEY automatically — no key argument required at call sites.

Call your models

import { SetCloud } from '@setcloud/ai';

const ai = new SetCloud();

const reply = await ai.chat({
  model: 'nova-lite',
  messages: [{ role: 'user', content: 'Hello' }],
});
console.log(reply.content);

Set stream: true to get an async-iterable of deltas instead of a single reply:

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 ?? '');
}

Use a model helper

The package includes SetCloud model helpers built on standard async iterators:

import { setcloud } from '@setcloud/ai';

for await (const delta of setcloud('nova-lite').streamText('Explain DNS.')) {
  process.stdout.write(delta);
}

These helpers expose SetCloud’s own interface. Framework integrations can use the gateway’s chat-completions endpoint through a compatible HTTP adapter. Calls use the same gateway rates listed on /pricing.

More: