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: |
|
Read them, and manage them with manifests. A plugin’s manifest kind is its class, e.g.
|
|
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_ENABLE_VECTORSTORE is true.
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_ENABLE_PROXY 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);