Guides
Call a capability
Reach any capability on Tael from your own code with a single API key. Payment happens automatically from the Card your key is linked to, so you never sign a transaction yourself.
Setup
Create a key in the dashboard under API Keys and link it to a funded Card. That Card's caps, both per call and per day, bound everything the key is allowed to spend.
pnpm add @tael/sdkimport { Tael } from "@tael/sdk";
const tael = new Tael({ apiKey: process.env.TAEL_KEY! });Call a capability
Reference a capability by its slug. Both get and post return the response data directly, so there is nothing else to unwrap.
const facts = await tael.get("cat-facts");
const reply = await tael.post("claude", { prompt: "Summarize this." });
// works for any capability, any method, with one key.Discover capabilities
List or search the marketplace to find slugs and prices at runtime.
const all = await tael.list(); // every capability
const found = await tael.search("weather"); // by name or description
// each: { slug, name, description, kind, method, price, logoUrl, verified }Receipts
Reach for call() when you want the full response: the data, the HTTP status, and the on-chain settlement receipt.
const res = await tael.call("cat-facts");
res.data; // the capability's response
res.status; // HTTP status
res.receipt?.txHash; // proof the USDC payment settled on StellarErrors
When a call fails, the client throws a TaelError that carries the gateway's message and its status code.
401means the key is unknown or has been revoked.402means the linked Card holds no USDC, or no Card is linked at all.403means the call exceeds the Card's per-call or daily cap.
import { Tael, TaelError } from "@tael/sdk";
try {
await tael.post("claude", { prompt: "hi" });
} catch (err) {
if (err instanceof TaelError) {
console.error(err.status, err.message); // e.g. 403 "Over this Card's per-call cap."
}
}Would you rather publish your own capability? See List your product as a capability.