Make your first request
Assume you already created a client with a wallet.
Inference
const response = await client.inference.chat({
model: "openai:gpt-4o-mini",
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0]?.message.content);
console.log(response.usage);
console.log(response.cost);
List models first if you need a valid ID:
const { data } = await client.inference.models.list();
console.log(data.map((m) => m.id));
Marketplace
const result = await client.marketplace.call({
path: "/p/demo-api/summarize",
method: "POST",
body: { text: "Summarize this" },
});
Or build the path from directory metadata:
const result = await client.marketplace.callEndpoint({
projectSlug: "demo-api",
pathTemplate: "/wallets/{address}/history",
pathParams: { address: "0x..." },
method: "GET",
});
Errors
If payment fails or the API rejects the request, the SDK throws typed errors. See Errors.