Agent Integration
There are three ways to let your AI agent provision servers from MachineMarket. Pick the one that matches your setup.
┌─────────────────────────────────────────────────────────┐
│ How is your agent running? │
├────────────────────┬────────────────────────────────────┤
│ │ │
│ Claude Code │ Other agent framework │
│ (terminal) │ (LangChain, CrewAI, Vercel AI, │
│ │ custom code, etc.) │
│ │ │ │ │
│ ▼ │ ▼ │
│ ┌──────────────┐ │ ┌──────────────────────────────┐ │
│ │ Option A │ │ │ Option B Option C │ │
│ │ Plugin/Skill │ │ │ x402 protocol Direct API │ │
│ │ (one command)│ │ │ (auto-pay) (manual pay) │ │
│ └──────────────┘ │ └──────────────────────────────┘ │
└────────────────────┴────────────────────────────────────┘Option A: Claude Code Plugin
If your agent runs in Claude Code, install the plugin and get a /server-setup slash command that handles everything: configuration, payment, and SSH credentials.
Install the plugin
Run this once inside Claude Code. The plugin is available in every session after that.
claude
> /install-plugin https://github.com/stein-hashx0/machinemarket-pluginUse it
You can invoke the skill explicitly or just describe what you need:
# Explicit slash command
> /server-setup
# Or just ask naturally — the skill triggers automatically:
> "I need a server to run this project"
> "Spin up a VPS for me"
> "Deploy this to a server"
> "Launch a compute instance"What happens
The skill walks through the full flow:
- Mode selection — Auto (agent decides everything from your project context) or Interactive (you choose template, tier, duration, region).
- Configuration — In auto mode, the agent reads your project files to pick the right template and tier. In interactive mode, you get one question at a time.
- Payment — The plugin detects the best method automatically:
1. WALLET_PRIVATE_KEY + cast installed → Auto-send USDC via Foundry
2. moonpay CLI in PATH → Auto-send via MoonPay
3. Neither available → Shows payment details for manual send- Provisioning — Calls the API, waits for the server to be ready, displays SSH credentials.
Environment variables
| Field | Type | Required | Description |
|---|---|---|---|
WALLET_PRIVATE_KEY | string | no | Enables fully automated payment. The agent sends USDC without asking. |
WALLET_ADDRESS | string | no | Sender wallet. Derived from private key if unset. |
MACHINEMARKET_API_URL | string | no | Override API base URL. Default: https://machinemarket.ai |
WALLET_PRIVATE_KEY and the agent can provision servers without any user interaction. Just say what you need and the agent handles everything.Example session
$ claude
> /server-setup
? How would you like to configure? Auto
Analyzing project... Found package.json with Next.js.
Choosing: node template, Small tier, 24h, fsn1 region.
Total cost: 0.672 USDC
Sending 0.672 USDC on Base...
Payment confirmed (tx: 0xabc...def)
Spawning server...
Instance mm_s7k2x is running!
IP: 185.233.x.x
SSH: ssh root@185.233.x.x
Expires: 2026-03-03T12:00:00Z
Cost: 0.672 USDCOption B: x402 Protocol (Agent Auto-Pay)
If your agent supports the x402 payment protocol, it can pay automatically without any manual USDC transfer. The agent sends the API request, gets a 402 Payment Required response, and settles the payment through the x402 facilitator.
1. Agent calls POST /v1/spawn (no payment)
2. API returns 402 with Payment-Required header
3. Agent's x402 client reads the payment requirements
4. Agent signs a payment authorization
5. Agent retries the request with Payment-Signature header
6. API verifies with facilitator → provisions server → settles payment
7. Agent receives credentialsThis works out of the box with any x402-compatible agent client. The agent never touches USDC directly — the facilitator handles settlement.
/v1/spawn and /v1/instances/:id/extend. The agent just makes the API call and the protocol handles payment.Option C: Direct API (Manual Payment)
For any agent or script that can make HTTP requests and send USDC. This is the most flexible option — works with LangChain, CrewAI, Vercel AI SDK, or plain code.
The flow
1. GET /v1/pricing → Calculate cost
2. Send USDC on Base → ERC-20 transfer to MM wallet
3. Wait for confirmation → 12+ blocks (~24 seconds)
4. POST /v1/spawn → { tx_hash, wallet_address, tier, ... }
5. Poll GET /v1/instances/:id → Until status = "running"
6. SSH into the server → Using returned credentialsGive your agent instructions
Add this to your agent's system prompt or tool description so it knows how to use MachineMarket:
You can provision cloud servers via MachineMarket.
API: https://api.machinemarket.ai
Payment: USDC on Base chain to 0x8997292508bAbbe5B40d28a89588a5926d342992
USDC contract: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Steps:
1. GET /v1/pricing — get tier costs
2. Send USDC transfer on Base for the calculated amount
3. POST /v1/spawn with { tier, template, duration, tx_hash, wallet_address }
4. Poll GET /v1/instances/:id?wallet_address=<wallet> until status is "running"
Tiers: Nano ($0.015/hr), Small ($0.028/hr), Medium ($0.055/hr), Large ($0.105/hr)
Templates: base, node, python, agent, openclaw
Durations: 1h, 24h, 7d, 30d
To extend: POST /v1/instances/:id/extend { duration, tx_hash, wallet_address }
— wallet must match the original spawn wallet
To destroy: DELETE /v1/instances/:id { wallet_address, signature }
— sign message "machinemarket:delete:<instance_id>" with the owner walletAs a tool definition
If your framework uses structured tool definitions (LangChain, Vercel AI SDK, etc.), define MachineMarket as a tool:
const machineMarketTool = {
name: "provision_server",
description: "Provision a cloud VPS. Sends USDC on Base and returns SSH credentials.",
parameters: {
tier: "Nano | Small | Medium | Large",
template: "base | node | python | agent | openclaw",
duration: "1h | 24h | 7d | 30d",
region: "fsn1 | nbg1 | hel1 | ash | hil (optional, default fsn1)",
},
execute: async ({ tier, template, duration, region }) => {
// 1. Calculate cost
const pricing = await fetch("https://api.machinemarket.ai/v1/pricing").then(r => r.json());
const tierInfo = pricing.tiers.find(t => t.name === tier);
const hours = { "1h": 1, "24h": 24, "7d": 168, "30d": 720 }[duration];
const cost = tierInfo.hourly * hours;
// 2. Send USDC (use your wallet library)
const txHash = await sendUsdc(cost);
// 3. Spawn instance
const result = await fetch("https://api.machinemarket.ai/v1/spawn", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
tier, template, duration,
region: region || "fsn1",
tx_hash: txHash,
wallet_address: WALLET_ADDRESS,
}),
}).then(r => r.json());
return result;
},
};Which option should I use?
| Field | Type | Required | Description |
|---|---|---|---|
Claude Code Plugin | Option A | no | Best for: Claude Code users. One /install-plugin command, then /server-setup. Handles everything. |
x402 Protocol | Option B | no | Best for: Agents with x402 support. Zero setup — just call the API and the protocol handles payment. |
Direct API | Option C | no | Best for: Custom agents, scripts, or any framework. Most flexible. You handle USDC transfer yourself. |
Next steps
- Quickstart — Step-by-step spawn with curl or SDK
- Payment Flow — How on-chain verification and ownership work
- API Reference — Full endpoint documentation