Build with the API / Connect the SDK
Connect the SDK
One client for every route, with one timeout, one error type and retries that only touch reads.
Install#
npm install @superbworks/sdk
@superbworks/sdk is published to npm. It has no dependencies, runs in Node 20+, browsers and edge runtimes, and ships TypeScript declarations generated from the reading schema. To run the engine in your own process instead of calling the API, install @superbworks/read (Read a passage).
Create one client#
import { Superb, SuperbError } from '@superbworks/sdk';
const superb = new Superb({ timeoutMs: 15000 }); // https://superb.works; pass { baseUrl } for your own deployment
try {
const reading = await superb.read({ text: 'Refunds are processed promptly.' });
console.log(reading.propositions[0].gaps); // [{ slot: 'actor', ask: 'Who does this?' }, { slot: 'time', ask: 'By when, exactly?' }]
} catch (error) {
if (error instanceof SuperbError) console.error(error.status, error.code, error.message);
else throw error;
}
An API key (new Superb({ apiKey })) is needed only for the model reading. Keep it server-side.
Choose a method#
| Goal | Method | Guide |
|---|---|---|
| Read a text or conversation as one document | read |
Read a passage |
| Validate a reading, yours or a model's | validateReading |
Read a passage |
| One word's sense in its passage | resolve |
Resolve a word |
| A usage's stable identity and evidence | identify |
Semantic identities |
| The terms a conversation turns on | profileMeaning |
Meaning profiles |
| The dictionary, a word, its origins | lexicon, words, word, origins |
API map |
| Releases and datasets | releases, release, datasets, dataset, datasetRecords, datasetRecord, downloadDataset |
Pin a release |
Cancel and time out#
Pass { signal } as the second argument to any method. timeoutMs bounds the whole call, retries included. Reads retry on 429, 502, 503, 504 and dropped connections; writes never do.
Next: Access and errors. Every method signature is in the SDK reference.