Resources
Each resource family is a property of the client. Every family that has a REST API can list()
its resources, retrieve() one by its id or hashed id, and find() one by name, and every
family has the manifest operations described in Manifests. Beyond those, each
family has the actions that its REST API offers. Every method returns a promise, and takes a last
options object with its own optional arguments, and signal, timeout and headers.
What a user can see and do is decided by the platform: the API key’s user reads the resources of their account, and only a resource’s owner may change it. Some endpoints, e.g. the Smarter Journal, are for superusers only.
Property |
Resources and actions |
|---|---|
|
Any kind, through the manifest API. See Manifests. |
|
LLMClients: |
|
Guardrails: |
|
MCPClients: |
|
Vectorstores: |
|
LLMHosts: |
|
Orchestrators, multi-agent workflows
over LLMClients: |
|
Read them, and manage them with manifests. A plugin’s manifest kind is its class, e.g.
|
|
The platform’s extensions and the extension
registry: |
|
Accounts, and |
|
The chat sessions, their tool calls and their plugin uses, newest first: the user’s own, their account’s users’ for an account admin, and every one for a superuser. |
|
The Smarter Journal, page by page. Superusers only. |
|
The LLM providers that the platform is configured for, and their models. |
|
Proxies to LLM providers’ own APIs: |
|
The API key’s user and account, the platform’s version and state, and its resource kinds. |
Guardrails
Dry-run a Guardrail on a text, e.g. to test a new pattern before you rely on it. Nothing is saved.
const result = await client.guardrails.evaluate(guardrail.id, "My card is 4111 1111 1111 1111");
if (result.triggered) console.log(result.disposition, result.text); // e.g. redacted "My card is [REDACTED]"
for (const event of (await client.guardrails.events(guardrail.id, { reviewed: false })).events) {
console.log(event.createdAt, event.llmclient, event.disposition);
}
MCP clients
const tools = await client.mcpClients.tools(mcpclient.id);
for (const tool of tools.tools) console.log(tool.name, tool.inputSchema);
const result = await client.mcpClients.callTool(mcpclient.id, "aws___search_documentation", { search_phrase: "S3" });
console.log(result.isError, result.content);
Only an MCPClient’s owner may call its tools.
Vectorstores
await client.vectorstores.addText(store.id, "Our refund window is 30 days.", { name: "refunds" });
await client.vectorstores.addUrl(store.id, "https://example.com/faq");
await client.vectorstores.addFiles(store.id, ["handbook.pdf", "policies.docx"]);
const found = await client.vectorstores.search(store.id, "How long is the refund window?", { k: 3 });
for (const hit of found.results) console.log(hit.score, hit.text);
addFiles() takes paths, file: urls, or File objects. Documents are split, embedded and
loaded asynchronously, and only once the vectorstore is deployed. The platform serves these
endpoints when SMARTER_APP_VECTORSTORE_ENABLE is true.
Vectorsearches
A Vectorsearch is a saved retrieval pipeline over a vectorstore: its search type, k, score
threshold and metadata filter. run() searches with them, and an optional filter narrows the
results further; the Vectorsearch’s own metadataFilter wins where both name the same key.
const found = await client.vectorsearches.run("rMTAwMDAxMgx", "How long is the refund window?", {
filter: { topic: "refunds" },
});
for (const hit of found.results) console.log(hit.score, hit.text, hit.metadata);
The platform answers 400 (BadRequestError) when the Vectorsearch is disabled, and 402
(PaymentRequiredError) when a budget forbids the
search.
Extensions
Extensions add tools to the LLMClients that use them. Every user reads the extensions that their account may use; a superuser also sees their settings, and manages them. An extension is installed disabled: configure its settings, then enable it.
const installed = await client.extensions.list();
for (const extension of installed.objects) console.log(extension.slug, extension.installedVersion, extension.enabled);
for (const item of (await client.extensions.registry()).objects) console.log(item.slug, item.action);
// superusers only
await client.extensions.install("weather");
await client.extensions.configure("weather", {
values: { weather_api_url: null }, // null resets a setting to its default
secrets: { google_maps_api_key: { secretId: 6 } }, // one of the platform admin's Secrets, or { value: "..." }
});
const result = await client.extensions.enable("weather");
console.log(result.message, result.extension?.tools.map((tool) => tool.functionName));
upload() installs an extension from its .zip archive (a path, a file: url, or a File),
setAvailability(slug, false, { accountIds }) limits it to some accounts, and rollback(slug,
versionId) runs one of its earlier installed versions. A user who is not a superuser gets a
PermissionDeniedError from every action.
Token usage and data exports
Every user may read the tokens and cost of their own LLM requests, the series that the web console’s dashboard charts (see Cost Accounting), one point per hour, day or month. Its points are snake_case, as the platform sends them.
const usage = await client.accounts.usage({ periodicity: "7_days" }); // 12_hours, 24_hours (the default), 7_days, 1_month or 1_year
for (const point of usage.points) console.log(point.period_start, point.total_tokens, point.total_cost);
A data export is a zip file of the manifest of every resource that the user owns, with Secrets’ values redacted. The platform builds it in the background, and emails the user a link to it: the API never returns the link or the file.
const overview = await client.accounts.dataExports.overview();
console.log(overview.email, overview.exportsLeftToday, overview.latest?.status);
const started = await client.accounts.dataExports.start();
console.log((await client.accounts.dataExports.retrieve(started.id)).step);
start() returns the export that is already in progress, if there is one. It throws a
RateLimitError (429) when the user has no email address or has started too many exports today,
and the SDK doesn’t retry that refusal.
LLMHosts
An LLMHost serves an open-weight model on the platform’s own cluster. plan() shows the
Kubernetes resources that deploy() would create, without creating them. Deploying creates real,
billable infrastructure, which may include GPU nodes.
for (const model of await client.llmHosts.discover({ query: "qwen", task: "chat", limit: 5 })) {
console.log(model.repository, model.downloads);
}
const manifest = await client.llmHosts.discoverManifest("Qwen/Qwen2.5-7B-Instruct");
await client.llmHosts.apply(manifest);
console.log((await client.llmHosts.report()).totals);
Proxies
A Proxy gives authenticated, governed access to an LLM provider’s own API: the platform holds the provider’s key, and you use your Smarter API key instead. The easiest client of a proxy is the provider’s own SDK:
import OpenAI from "openai";
import { Smarter } from "@smarter.sh/api";
const smarter = new Smarter();
const openai = new OpenAI({ baseURL: smarter.proxies.baseUrl("openai"), apiKey: smarter.apiKey });
The platform serves proxies when SMARTER_APP_PROXY_ENABLE is true.
Endpoints the SDK does not wrap
client.http is the SDK’s authenticated transport. Use it for an endpoint that the SDK doesn’t
wrap yet, with the same retries and errors, and a Zod schema of the response:
import { JsonValue } from "@smarter.sh/api";
const data = await client.http.request("GET", "llmhosts/report/", JsonValue);