# Build with the API

Discover compatible compute and request a quote with the TypeScript SDK.

This quickstart reads the catalog and creates a free, non-binding quote. It does not reserve a machine or transfer funds. You need Node.js 20 or later and a renter-scoped API key from [Account → API keys](https://amplerun.com/account#api-keys), or an [agent account](https://docs.amplerun.com/start/agent.md).

## Install the client

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

Make `AMPLERUN_API_KEY` available through your secret manager or local process environment. Do not commit it, paste it into a shared configuration, or enable HTTP header logging.

## Discover and quote

Save as `quote.mjs`. Set `AMPLERUN_TEMPLATE` to the ID or slug of a template you have selected. This example deliberately asks for confirmation of your selection instead of choosing the first catalog item for paid work.

```js
import { createAmpleRun } from '@amplerun/sdk';

if (!process.env.AMPLERUN_API_KEY || !process.env.AMPLERUN_TEMPLATE) {
  throw new Error('Set AMPLERUN_API_KEY and AMPLERUN_TEMPLATE first');
}
const api = createAmpleRun({
  apiKey: process.env.AMPLERUN_API_KEY,
  baseUrl: 'https://amplerun-api.spiry.org',
});
const template = await api.templates.get(process.env.AMPLERUN_TEMPLATE);
const page = await api.offers.list({ template_id: template.id });
const offer = page.items.find((item) => item.fit?.fits === true);
if (!offer) throw new Error('No compatible offer on this page; inspect the catalog');
const quote = await api.quotes.create({
  template_id: template.id,
  offer_id: offer.offer_id,
  duration_limit_s: 300,
  budget_micro: '1000000',
  asset: 'USDC',
});
console.log({
  quote_id: quote.quote_id,
  expires_at: quote.expires_at,
  estimated_total_micro: quote.estimated_total_micro,
  budget_micro: quote.budget_micro,
  platform_fee_bps: quote.platform_fee_bps,
});
```

```sh
node quote.mjs
```

`template.id` is the UUID used by offers and quotes. A template's human-readable slug is a different field. An empty page is an ordinary outcome; follow `next_cursor` if you want to search more pages.

## Before reserving

Read [budgets and receipts](https://docs.amplerun.com/billing/budgets-and-receipts.md) and [rental lifecycle](https://docs.amplerun.com/renting/lifecycle.md). A reservation uses `api.jobs.create({ quote_id }, { idempotencyKey })`; supply `ssh_public_key` only when you need SSH. Persist the request ID and idempotency key before sending a paid request. Do not rerun the whole quote-and-reserve workflow blindly after a timeout.

Continue with [access and inference](https://docs.amplerun.com/renting/access-and-inference.md) or the full [API reference](https://docs.amplerun.com/reference/api.md).

---
Last reviewed: 2026-10-19.
Canonical: https://docs.amplerun.com/start/developer/
