Quickstart

Spawn a VPS with USDC in under 5 minutes. This guide walks through getting pricing, sending payment, and provisioning a server.

Prerequisites

  • A wallet with USDC on Base (even a few cents is enough for a 1h Nano)
  • Node.js 18+ (for SDK examples) or curl

Step 1: Check pricing

Fetch available tiers and durations to calculate the exact cost.

curl
curl https://api.machinemarket.ai/v1/pricing
SDK
import { MachineMarket } from "@machinemarket/sdk";

const mm = new MachineMarket({
  baseUrl: "https://api.machinemarket.ai",
});

const pricing = await mm.getPricing();
console.log(pricing.tiers);
// [{ name: "Nano", hourly: 0.015, ... }, ...]

For a Small tier for 24 hours, the cost is 0.028 * 24 = 0.672 USDC.

Step 2: Send USDC

Transfer USDC on Base to the MachineMarket wallet. This example uses viem:

viem
import { createWalletClient, http, parseUnits } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

const USDC = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
const MM_WALLET = "0x..."; // MachineMarket recipient wallet

const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const client = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

const txHash = await client.writeContract({
  address: USDC,
  abi: [{
    name: "transfer",
    type: "function",
    inputs: [
      { name: "to", type: "address" },
      { name: "amount", type: "uint256" },
    ],
    outputs: [{ type: "bool" }],
  }],
  functionName: "transfer",
  args: [MM_WALLET, parseUnits("0.672", 6)],
});

console.log("Payment tx:", txHash);
!Warning
Wait for at least 1 block confirmation before calling spawn. The API verifies the transaction receipt on-chain.

Step 3: Spawn an instance

curl
curl -X POST https://api.machinemarket.ai/v1/spawn \
  -H "Content-Type: application/json" \
  -d '{
    "tier": "Small",
    "template": "node",
    "duration": "24h",
    "region": "fsn1",
    "tx_hash": "0xabc...def",
    "wallet_address": "0x1234...5678"
  }'
SDK
const result = await mm.spawn({
  tier: "Small",
  template: "node",
  duration: "24h",
  region: "fsn1",
  tx_hash: txHash,
  wallet_address: account.address,
});

console.log("Instance ID:", result.instance.id);
console.log("SSH host:", result.credentials.ssh_host);
console.log("Status:", result.instance.status);

If you don't provide an ssh_pubkey, the API generates a keypair and returns the private key in credentials.ssh_private_key.

Step 4: Connect via SSH

terminal
# If you got a generated key:
echo "$SSH_PRIVATE_KEY" > /tmp/mm_key
chmod 600 /tmp/mm_key
ssh -i /tmp/mm_key root@185.233.x.x

# If you provided your own pubkey:
ssh root@185.233.x.x
iNote
The instance status may be provisioning initially. Poll GET /v1/instances/:id until it becomes running with an IP address (usually under 60 seconds).

Step 5: Extend or destroy

Extend
// Send another USDC payment, then:
const extended = await mm.extendInstance(result.instance.id, {
  duration: "24h",
  tx_hash: newTxHash,
  wallet_address: account.address,
});
console.log("New expiry:", extended.expires_at);
Destroy
const destroyed = await mm.destroyInstance(result.instance.id);
console.log(destroyed.status); // "destroyed"

Next steps