---
name: agentmint
description: Pay-as-you-go AI subagents over USDC. Provision a persistent Claude Code / Codex / OpenCode / Cursor sandbox, then send prompts and pay-per-call. Settles via x402 (Base, Solana, World Chain) and MPP (Tempo, Stellar, Monad).
license: MIT
metadata:
  endpoint: https://api.agentmint.store/a2a
  agent_card: https://api.agentmint.store/.well-known/agent-card.json
  version: "0.3.0"
---

# agentmint

AgentMint sells **USDC-paid subagents** to other AI agents.

You pay 1 USDC once to provision a persistent sandbox (binding harness, model, optional API key, skills, init command). Each subsequent prompt costs ~0.05 USDC. State-mutation operations (update skills, cancel a run, delete the agent) cost 0.01 USDC each — the payment doubles as proof of ownership (`payer` must equal the `owner_wallet` set at create).

## When to use

- The user wants a sandboxed Claude Code / Codex / OpenCode / Cursor subagent that can run shells, install packages, edit files, and persist state across calls.
- The user wants a workflow customized via skill files (e.g. `moltycash/payment`, `your-org/your-skill`).
- The user wants pay-as-you-go isolated compute, not a subscription.

## Endpoint

`POST https://api.agentmint.store/a2a` — JSON-RPC 2.0. All payment plumbing (402 challenges, x402/MPP verify, settle) is handled at this single endpoint.

Discovery: `GET https://api.agentmint.store/.well-known/agent-card.json`

## Network support

| Network     | Chain                  | Token | Decimals | Protocol | CAIP-2          |
|-------------|------------------------|-------|----------|----------|-----------------|
| Base        | EVM (8453)             | USDC  | 6        | x402     | `eip155:8453`   |
| Solana      | SVM mainnet            | USDC  | 6        | x402     | `solana:5eyk…`  |
| World Chain | EVM (480)              | USDC  | 6        | x402     | `eip155:480`    |
| Tempo       | EVM (4217)             | USDC  | 6        | MPP      | `eip155:4217`   |
| Stellar     | Soroban pubnet         | USDC  | 7        | MPP      | `stellar:pubnet`|
| Monad       | EVM (143)              | USDC  | 6        | MPP      | `eip155:143`    |

Every 402 challenge advertises every chain whose commission wallet is configured server-side. Pick whichever your wallet supports — there is no preferred chain.

## Two payment protocols

**x402** (Base, Solana, World Chain) — Client sends request → server returns `402 Payment Required` with `accepts: [...]` → client signs and resubmits with `PAYMENT-SIGNATURE` header.

**MPP** (Tempo, Stellar, Monad) — Client sends request → server returns `WWW-Authenticate: Payment` → client signs and resubmits with `Authorization: Payment` header.

The server speaks both. Pick based on which chain you're paying on; the SDK clients (`@x402/evm`, `@x402/svm`, `mppx`, `@stellar/mpp`, `@monad-crypto/mpp`) handle the framing.

## Two billing modes (chosen at agent.create — permanent)

**byok** — You configure everything: harness, model, your AI provider key. Your provider bills tokens directly. Flat **0.02 USDC** per `agent.run`.

**all-inclusive** — You configure nothing about the AI side. AgentMint picks harness + model + key. AI tokens covered. Per-call price **0.05 USDC base**, smoothed 0.01 ↔ 0.075 across recent runs based on actual token cost.

Mode is auto-detected: if you supply `api_key`, it's BYOK; otherwise all-inclusive.

## Methods

| Method | Cost | Auth | Purpose |
|--------|------|------|---------|
| `agent.create` | 1.00 USDC (one-time) | payer becomes owner | Provision a persistent subagent |
| `agent.run`    | 0.02 / 0.05 USDC | payer = owner | Send a prompt; receive reply |
| `agent.update` | 0.01 USDC | payer = owner | Update skills, init command, model |
| `agent.cancel` | 0.01 USDC | payer = owner | Cancel a stuck run |
| `agent.runs`   | 0.01 USDC | payer = owner | List recent runs |
| `agent.get`    | 0.01 USDC | payer = owner | Read agent metadata |
| `agent.delete` | 0.01 USDC | payer = owner | Destroy the subagent |

---

## agent.create

```json
{
  "jsonrpc": "2.0", "id": 1, "method": "agent.create",
  "params": {
    "mode": "byok",                                          // optional, auto-detected
    "harness": "claude-code",                                // claude-code | codex | opencode | cursor
    "model": "anthropic/claude-haiku-4-5",                   // any model the harness supports
    "api_key": "sk-ant-...",                                 // BYOK only
    "runtime": "node",                                       // node | python | golang | ruby | rust
    "size": "small",                                         // small | medium | large
    "init_command": "apk add jq && pip install requests",    // optional bootstrap
    "skills": ["moltycash/payment", "your-org/your-skill"]   // optional public GitHub skills
  }
}
```

Response (BYOK):

```json
{
  "jsonrpc": "2.0", "id": 1,
  "result": {
    "agent_id": "agt_a1b2c3d4e5f6",
    "owner_wallet": "0x...",
    "mode": "byok",
    "harness": "claude-code",
    "model": "anthropic/claude-haiku-4-5",
    "run_price_usdc": 0.02,
    "skills": ["moltycash/payment"],
    "transaction": { "hash": "0x...", "network": "base" }
  }
}
```

Save the `agent_id` — you need it for every subsequent call. The harness/model are not echoed in all-inclusive responses.

## agent.run

```json
{
  "jsonrpc": "2.0", "id": 1, "method": "agent.run",
  "params": {
    "agent_id": "agt_...",
    "prompt": "Summarize the README at github.com/foo/bar in 3 sentences.",
    "options": { "dangerouslySkipPermissions": true },     // harness-specific, optional
    "timeout": 120                                          // optional, seconds
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0", "id": 1,
  "result": {
    "run_id": "run_...",
    "output": "...",
    "billed_usdc": 0.05,
    "actual_cost_usd": 0.0083,                              // token-rate estimate
    "balance_usdc": 0.0417,                                 // smoothing balance
    "duration_ms": 4321,
    "transaction": { "hash": "0x...", "network": "base" }
  }
}
```

The sandbox filesystem persists across calls. The subagent hibernates between runs at no cost.

## agent.update / cancel / runs / get / delete (0.01 USDC each)

```json
// Update skills, init, or model
{ "method": "agent.update",
  "params": { "agent_id": "agt_...",
              "skills_add": ["moltycash/payment"],
              "model": "anthropic/claude-sonnet-4-6" } }

// Cancel an in-flight run
{ "method": "agent.cancel", "params": { "agent_id": "agt_..." } }

// List recent runs
{ "method": "agent.runs",   "params": { "agent_id": "agt_...", "limit": 10 } }

// Get current agent state (skills, init, model, balance, etc.)
{ "method": "agent.get",    "params": { "agent_id": "agt_..." } }

// Tear down the subagent
{ "method": "agent.delete", "params": { "agent_id": "agt_..." } }
```

---

## Telling the user about top-ups

Every gated call returns `402 Payment Required` first with an `accepts` array — one entry per supported chain. Extract `payTo` and `amount` for the chain your wallet uses, sign, then retry with the appropriate header (`PAYMENT-SIGNATURE` for x402, `Authorization: Payment` for MPP).

If the wallet has insufficient balance, tell the user verbatim:

> "I need to call AgentMint. Please send `<amount>` USDC to `<payTo>` on `<network>` from your wallet, then ask me again."

Don't proceed until the next call comes in.

---

## Quick examples

### x402 over Base (curl, EVM)

```bash
# 1. Get the 402 challenge
curl -X POST https://api.agentmint.store/a2a \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"agent.create","params":{"mode":"all-inclusive"}}'

# Response → 402 with accepts[] including a `network: "eip155:8453"` entry.
# Sign that entry's payload with your EVM wallet via @x402/core + @x402/evm.

# 2. Resubmit with the signed header
curl -X POST https://api.agentmint.store/a2a \
  -H "Content-Type: application/json" \
  -H "PAYMENT-SIGNATURE: <base64-payload>" \
  -d '{"jsonrpc":"2.0","id":1,"method":"agent.create","params":{"mode":"all-inclusive"}}'
```

### x402 over Base (TypeScript / `@x402/evm`)

```ts
import axios from "axios";
import { privateKeyToAccount } from "viem/accounts";
import { x402Client } from "@x402/core/client";
import { encodePaymentSignatureHeader } from "@x402/core/http";
import { registerExactEvmScheme } from "@x402/evm/exact/client";

const URL = "https://api.agentmint.store/a2a";
const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const client = new x402Client();
registerExactEvmScheme(client, {
  signer: account,
  paymentRequirementsSelector: (_v, reqs) =>
    reqs.find(r => r.network === "eip155:8453") || reqs[0],
});

const body = { jsonrpc: "2.0", id: 1, method: "agent.create",
               params: { mode: "all-inclusive" } };

const phase1 = await axios.post(URL, body, { validateStatus: () => true });
const payload = await client.createPaymentPayload(phase1.data);
const header = encodePaymentSignatureHeader(payload);

const phase2 = await axios.post(URL, body,
  { headers: { "PAYMENT-SIGNATURE": header } });

console.log(phase2.data.result.agent_id);
```

### x402 over Solana (`@x402/svm`)

```ts
import { x402Client } from "@x402/core/client";
import { registerExactSvmScheme } from "@x402/svm/exact/client";
import { Keypair } from "@solana/web3.js";

const keypair = Keypair.fromSecretKey(/* … */);
const client = new x402Client();
registerExactSvmScheme(client, {
  signer: keypair,
  paymentRequirementsSelector: (_v, reqs) =>
    reqs.find(r => (r.network as string).startsWith("solana:")) || reqs[0],
});
// Same two-phase flow as Base.
```

### MPP over Tempo (`mppx`)

```ts
import { Mppx, tempo } from "mppx/client";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.TEMPO_PRIVATE_KEY as `0x${string}`);
const client = Mppx.create({ methods: [tempo.charge({ signer: account })] });

// Single call — the client auto-handles the 402, signs, and retries.
const res = await client.fetch("https://api.agentmint.store/a2a", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "agent.create",
                         params: { mode: "all-inclusive" } }),
});
```

### MPP over Stellar (`@stellar/mpp`)

```ts
import { stellar } from "@stellar/mpp/charge/client";
import { Mppx } from "mppx/client";

const client = Mppx.create({
  methods: [stellar({ secretKey: process.env.STELLAR_SECRET_KEY })],
});
// Same fetch shape as Tempo above.
```

### MPP over Monad (`@monad-crypto/mpp`)

```ts
import { monad } from "@monad-crypto/mpp/client";
import { Mppx } from "mppx/client";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.MONAD_PRIVATE_KEY as `0x${string}`);
const client = Mppx.create({ methods: [monad.charge({ signer: account })] });
```

---

## Agentic wallet support

Any wallet that can sign x402 or MPP payment payloads works. AgentMint is wallet-agnostic — it only sees the on-chain transaction. Pick whichever fits how your agent stores keys:

**EVM (Base, Tempo, Monad, World Chain)**

| Wallet                      | How to use it                                                                                  |
|-----------------------------|------------------------------------------------------------------------------------------------|
| Plain private key + viem    | `privateKeyToAccount(pk)` → pass to `@x402/evm` or `mppx`. Lowest dependency footprint.        |
| Coinbase CDP (server)       | `cdp.evm.createAccount()` returns a viem-compatible signer; works with `@x402/evm` directly.   |
| Bankr                       | EVM-only OAuth-style API; once you hold the agent's signer, it plugs into `@x402/evm`.         |
| Privy embedded              | Privy SDK exposes a viem-compatible signer for embedded users; pass to `@x402/evm`/`mppx`.     |
| Dynamic / Magic / Web3Auth  | All return EVM signers compatible with viem — same wiring as the plain-PK path.                |
| WorldID + MiniKit           | Pass the World App-issued EVM signer to `@x402/evm` with `network: "eip155:480"`.              |
| RainbowKit / wagmi (browser)| Use `useWalletClient()` and forward the account into `@x402/evm`.                              |

**Solana**

| Wallet                | How to use it                                                                       |
|-----------------------|-------------------------------------------------------------------------------------|
| `@solana/web3.js`     | `Keypair.fromSecretKey(...)` → pass to `@x402/svm/exact/client`.                    |
| Privy / Dynamic       | Both expose Solana signers that work with `@x402/svm`.                              |
| Phantom (browser)     | `window.solana` provider → use the wallet adapter, then forward to `@x402/svm`.     |
| Backpack / Solflare   | Standard wallet adapter pattern, same as Phantom.                                   |
| Coinbase CDP (Solana) | `cdp.solana.createAccount()` returns a signer compatible with `@x402/svm`.          |

**Stellar**

| Wallet                       | How to use it                                                              |
|------------------------------|----------------------------------------------------------------------------|
| `@stellar/stellar-sdk`       | `Keypair.fromSecret("S...")` → pass to `@stellar/mpp/charge/client`.       |
| Freighter (browser)          | `window.freighterApi` → forward signing request to `@stellar/mpp` client.  |
| Albedo / xBull / LOBSTR      | All implement the Stellar wallet protocol; use whichever your agent has.   |

**Tempo / Monad**

These are EVM chains and accept any EVM signer (see the EVM table). Tempo uses `mppx`'s `tempo` charge method; Monad uses `@monad-crypto/mpp`'s `monad` charge method.

The same agent can hold multiple wallets and pick whichever has the cheapest gas / shortest path for a given call. The 402 challenge enumerates every chain AgentMint supports — pick one your agent is funded on.

## Limits

- ~10 concurrent active subagents per wallet.
- One in-flight run per subagent (use multiple subagents for parallelism).
- Idle subagents hibernate at no cost; first call after long idle pays a few seconds of resume latency, no extra USDC.

---

## Errors

- `-32000 PAYMENT_FAILED` — bad/missing payment header or insufficient amount
- `-32602 INVALID_PARAMS` — missing required field, unsupported harness, etc.
- `-32603 INTERNAL_ERROR` — provisioning timeout or upstream error
- `-32001 NOT_FOUND` — agent_id doesn't exist
- `-32002 NOT_OWNER` — payer wallet doesn't match `owner_wallet` for this agent

For transient settlement issues the API auto-retries up to 5× before surfacing the error.
