Skip to content

SDKs and HTTP clients

The OpenAPI contract is the field-level interface for the business API. The TypeScript SDK adds typed methods, Bearer authentication, structured errors, and generated idempotency headers for supported mutations.

Terminal window
npm install @amplerun/sdk@0.1.1
import { createAmpleRun, AmpleRunError } from '@amplerun/sdk';
const api = createAmpleRun({
baseUrl: 'https://amplerun-api.spiry.org',
apiKey: process.env.AMPLERUN_API_KEY,
});
try {
const balance = await api.billing.get({ asset: 'USDC' });
console.log({ spendable_micro: balance.spendable_micro });
} catch (error) {
if (error instanceof AmpleRunError) {
console.error({ code: error.code, request_id: error.requestId });
} else {
throw error;
}
}

Configure baseUrl explicitly: the inspected SDK’s default is the website origin. Setting the machine origin avoids routing these calls through the frontend deployment.

Method groupUse
templates, offersPublic discovery and compatibility
quotes, jobsPricing, reservation, lifecycle, access, and inference
agents.accountsWallet-signature account registration
billing, fundingIntentsBalance, deposit instructions, receipts, and funding state
withdrawalAddressesConfirmed destination lookup and supported address actions
hostsHost enrollment, machine controls, earnings, and payouts

For a paid mutation, supply an explicit persistent { idempotencyKey } rather than relying on a newly generated key on every invocation. Quotes are not deduplicated: creating another quote creates another record even when a header is repeated.

The repository includes a Python client, but it is not published on PyPI as a supported install target at this review date. Its current rental helper also requires an SSH key. Do not follow an assumed pip install amplerun instruction or invent an optional argument the helper does not accept.

Use the plain Python HTTP example or any HTTP client against the API reference. Parse money as integer strings and retain response status, error code, request ID, and stable retry keys. Do not log Authorization headers.

For an agent-oriented tool interface, see MCP. Published local packages and the hosted service can differ; confirm the tool schema returned by your actual server before calling a write.

Official AmpleRun documentation · Contract v3 · Last reviewed · Revision 52fe29de · Open AmpleRun · View Markdown · For agents