assisters
v0.2.0
Published
Official TypeScript SDK for the Assisters API (api.assisters.dev)
Maintainers
Readme
assisters
Official TypeScript SDK for the Assisters API.
One API key, one client, every model. Typed end to end, no runtime dependencies —
just fetch.
Install
npm install assistersNode 18+ (the SDK uses the built-in fetch).
Quick start
import { AssistersClient } from "assisters";
const client = new AssistersClient(process.env.ASSISTERS_API_KEY!);
const completion = await client.chat.create({
model: "assisters-chat-v1",
messages: [{ role: "user", content: "Explain prompt caching in one sentence." }],
});
console.log(completion.choices[0].message.content);Get a key from the dashboard.
Resources
The client exposes one namespace per API area:
| Namespace | Method | Does |
|---|---|---|
| client.chat | create(params) | Chat completions |
| client.embeddings | create(params) | Vectors for search, clustering, RAG |
| client.moderations | create(params) | Content-safety classification |
| client.rerank | create(params) | Order documents by relevance |
| client.translate | create(params) | Translate text |
| client.models | list(), retrieve(id) | The catalogue, with pricing |
| client.images | generate(params) | Text to image |
| client.audio | speech(), transcribe(), enhance() | TTS, STT, cleanup |
| client.webSearch | query(params) | Live web search with citations |
| client.usage | tokens(), cost(), rateLimit() | What you have spent |
const { data } = await client.embeddings.create({
model: "assisters-embed-v1",
input: "The quick brown fox",
});
const results = await client.webSearch.query({ query: "WCAG 2.2 contrast rules" });
const audio = await client.audio.speech({ input: "Hello there", voice: "nova" });
await writeFile("out.mp3", Buffer.from(audio));Not here, on purpose
credits, collections, notifications and apiKeys used to be namespaces on
this client. Every one of those endpoints authenticates with a signed-in browser
session rather than a Bearer key, so they returned 401 for any client built the
way this one is. Wallet, collections, notifications and key management live in
the dashboard. A marketplace search namespace was also removed — it is served
by assisters.io, not by api.assisters.dev.
Errors
Every failure throws a typed error, so you can branch on the cause rather than parse a message:
import { AssistersClient, RateLimitError, AuthError } from "assisters";
try {
await client.chat.create({ model: "assisters-chat-v1", messages });
} catch (err) {
if (err instanceof RateLimitError) {
// err.retryAfterMs tells you how long to wait
} else if (err instanceof AuthError) {
// key is missing, invalid or revoked
}
}AssistersError is the base class and carries the HTTP status;
RateLimitError, AuthError and NotFoundError extend it.
Configuration
const client = new AssistersClient(apiKey, {
baseUrl: "https://api.assisters.dev", // override for a private deployment
});Billing
Usage is billed per token against a shared prepaid wallet — no subscription.
Rates are per model and published at
assisters.dev/pricing; GET /v1/models
returns the same figures the meter charges. Prompt-cache reads are billed at 10%
of the input rate and cache writes at 1.25x.
Links
License
MIT
