Node.js SDK overview
The @toothfairyai/sdk package exposes a single ToothFairyClient whose
managers cover the whole platform. Each manager is one property on the client
and is documented on its own page with field tables sourced from the API spec.
import { ToothFairyClient } from "@toothfairyai/sdk";
const client = new ToothFairyClient({
apiKey: process.env.TF_API_KEY!,
workspaceId: process.env.TF_WORKSPACE_ID!,
});
const agent = await client.agents.create({
label: "Support",
mode: "retriever",
interpolationString: "You are a helpful assistant.",
goals: "Help customers",
temperature: 0.7,
maxTokens: 2000,
maxHistory: 10,
topK: 10,
docTopK: 5,
});
See Authentication & routing for all configuration options and the three routing domains (core API, AI service, streaming).
Managers
| Manager | Accessor | Domain |
|---|---|---|
| Agents | client.agents | API |
| Agent Functions | client.agentFunctions | API |
| Alerts | client.alerts | API |
| Authorisations | client.authorisations | API |
| Benchmarks | client.benchmarks | API |
| Billing | client.billing | API |
| Channels | client.channels | API |
| Charting Settings | client.chartingSettings | API |
| Chat | client.chat | API + AI |
| Connections | client.connections | API |
| Dictionary | client.dictionary | API |
| Documents | client.documents | API + AI |
| Embeddings | client.embeddings | AI |
| Embeddings Settings | client.embeddingsSettings | API |
| Entities | client.entities | API |
| Fine-Tuning | client.finetuning | Fine-Tuning |
| Folders | client.folders | API |
| Hooks | client.hooks | API |
| Media | client.media | Media |
| Members | client.members | API |
| Prompts | client.prompts | API |
| Predictions | client.predictions | AI streaming |
| Request Logs | client.requestLogs | API |
| Scheduled Jobs | client.scheduledJobs | API |
| Secrets | client.secrets | API |
| Sites | client.sites | API |
| Streams | client.streams | API |
| Streaming | client.streaming | AI streaming |
| Triggers | client.triggers | API |
Fine-Tuning and Media managers
The Fine-Tuning manager (client.finetuning) covers dataset generation,
training lifecycle, the adapter registry and serving modes — see
16-finetuning. The Media manager (client.media)
covers voice management (list/get/clone/delete) and audio/image/video
generation — see 19-media.
Conventions
- Async: every manager method is
asyncand returns aPromise. - Wire field names are
camelCase(e.g.interpolationString), matching the API spec field tables on each page. - Derived methods (e.g.
agents.getByMode,agents.search,agents.clone) delegate to another SDK call and perform no direct HTTP request; they are marked derived on their pages. - Streaming managers (
predictions,streaming) return event emitters that firedata,chunk,complete,error, andendevents over SSE.