Skip to main content

Node.js SDK overview

@toothfairyai/sdk@latest…

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

ManagerAccessorDomain
Agentsclient.agentsAPI
Agent Functionsclient.agentFunctionsAPI
Authorisationsclient.authorisationsAPI
Benchmarksclient.benchmarksAPI
Billingclient.billingAPI
Channelsclient.channelsAPI
Charting Settingsclient.chartingSettingsAPI
Chatclient.chatAPI + AI
Connectionsclient.connectionsAPI
Dictionaryclient.dictionaryAPI
Documentsclient.documentsAPI + AI
Embeddingsclient.embeddingsAI
Embeddings Settingsclient.embeddingsSettingsAPI
Entitiesclient.entitiesAPI
Foldersclient.foldersAPI
Hooksclient.hooksAPI
Membersclient.membersAPI
Promptsclient.promptsAPI
Predictionsclient.predictionsAI streaming
Request Logsclient.requestLogsAPI
Scheduled Jobsclient.scheduledJobsAPI
Secretsclient.secretsAPI
Sitesclient.sitesAPI
Streamsclient.streamsAPI
Streamingclient.streamingAI streaming
Triggersclient.triggersAPI
Fine-Tuning is Python-only

The Fine-Tuning manager (client.finetuning) is only available in the Python SDK. The Node.js SDK does not ship a fine-tuning manager.

Conventions

  • Async: every manager method is async and returns a Promise.
  • 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 fire data, chunk, complete, error, and end events over SSE.