Build with the API
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, or an agent account.
Install the client
Section titled “Install the client”npm install @amplerun/sdk@0.1.1Make 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
Section titled “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.
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,});node quote.mjstemplate.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
Section titled “Before reserving”Read budgets and receipts and rental lifecycle. 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 or the full API reference.
Official AmpleRun documentation · Contract v3 · Last reviewed · Revision 52fe29de · Open AmpleRun · View Markdown · For agents