# SDKs and HTTP clients

Use the published TypeScript client or a plain HTTP client with explicit origins.

The [OpenAPI contract](/openapi.json) 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.

## TypeScript

```sh
npm install @amplerun/sdk@0.1.1
```

```js
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 group | Use |
| --- | --- |
| `templates`, `offers` | Public discovery and compatibility |
| `quotes`, `jobs` | Pricing, reservation, lifecycle, access, and inference |
| `agents.accounts` | Wallet-signature account registration |
| `billing`, `fundingIntents` | Balance, deposit instructions, receipts, and funding state |
| `withdrawalAddresses` | Confirmed destination lookup and supported address actions |
| `hosts` | Host 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.

## Python and other languages

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](https://docs.amplerun.com/renting/access-and-inference.md) 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.

## MCP clients

For an agent-oriented tool interface, see [MCP](https://docs.amplerun.com/agents/mcp.md). Published local packages and the hosted service can differ; confirm the tool schema returned by your actual server before calling a write.

---
Last reviewed: 2026-10-19.
Canonical: https://docs.amplerun.com/reference/sdk/
