AISP Agent Skill
Agent Inference Sharing Protocol (AISP) lets agents rent idle DIEM/Venice API capacity via USDC escrow. Providers list capped API keys; agents fund and receive keys automatically.
Architecture
Agent: fund() → Backend sees Funded event → Key released → Agent uses Venice API
Provider: list() → Agent funds → Term expires → settle() → Provider paid (99%, 1% fee)
Agent Workflow (Renting)
- Listings from backend:
GET /api/listings
- Approve USDC if needed (contract spends on
fund)
- Fund on-chain:
contract.fund(listingId, termDays, diemAmount) → returns rentalId
- Get key:
POST /api/key/{rentalId} with signed message diem-marketplace:get-key:{rentalId}:{timestamp}
- Use
apiKey with Venice API until expiresAt (Unix timestamp)
SDK (Agent)
import { DiemAgent } from "diem-marketplace-sdk";
const agent = new DiemAgent({
signer: wallet,
contractAddress: "0x...",
backendUrl: "https://diem-marketplace-backend.fly.dev",
usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
});
const listings = await agent.getListings();
const { apiKey, expiresAt } = await agent.rent(
listings[0].listingId,
termDays,
ethers.parseUnits(diemAmount, 6)
);
Provider Workflow (Listing)
- Create listing on-chain:
contract.list(pricePerDay, termDays, diemMin, diemMax) → listingId
- Store key on backend:
POST /api/keys with { listingId, apiKey, signature, timestamp }
- Message:
diem-marketplace:store-key:{listingId}:{timestamp}
- Settle when rental expires:
contract.settle(rentalId) → provider receives 99% (1% protocol fee)
SDK (Provider)
import { DiemProvider } from "diem-marketplace-sdk";
const provider = new DiemProvider({
signer: wallet,
contractAddress: "0x...",
backendUrl: "https://diem-marketplace-backend.fly.dev",
usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
});
const listingId = await provider.createListing({
pricePerDay: ethers.parseUnits("0.80", 6),
termDays: 30,
diemMin: ethers.parseUnits("1000", 6),
diemMax: ethers.parseUnits("4000", 6),
apiKey: "vn-scoped-...",
});
Key Paths
| Path |
Purpose |
sdk/src/agent.ts |
DiemAgent: getListings, rent, getKey, getMyRentals |
sdk/src/provider.ts |
DiemProvider: createListing, settle, revokeAndRefund |
backend/src/routes.ts |
API routes: /api/listings, /api/keys, /api/key/:id |
contracts/DiemMarketplace.sol |
On-chain escrow, 1% fee |
Backend API
| Endpoint |
Method |
Purpose |
/api/listings |
GET |
List rentable listings |
/api/listings/:id |
GET |
Single listing |
/api/keys |
POST |
Provider stores API key |
/api/key/:rentalId |
POST |
Agent retrieves key (signature required) |
/api/balance |
POST |
Check DIEM balance for API key |
/api/requests |
POST |
Create rental request |
Signatures
All backend requests requiring auth use EIP-191 signing:
getKey: diem-marketplace:get-key:{rentalId}:{timestamp}
storeKey: diem-marketplace:store-key:{listingId}:{timestamp}
balance: apiKey in body (no signature)
Contract (Base)
- Chain: Base (8453)
- Mainnet:
0xeeDa7657f2018b3b71B444b7ca2D8dE91b3B08f3
- USDC:
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Security & Signing
- Use an external signer or hardware wallet; never paste raw private keys.
- Require explicit user confirmation before fund transfers or credential usage.
- Venice API keys must be scoped (inference-only), revocable, and minimal for escrow.
Notes
- Venice API keys must be inference-only (not admin)
- 1% protocol fee deducted at settlement
1---2name: agent-inference-capacity-marketplace3description: "Enables AI agents to interact with AISP (Agent Inference Sharing Protocol) for renting or providing DIEM API capacity. Use when working with diem-marketplace, Venice API keys, USDC escrow, listings, rentals, or when the user wants to rent inference capacity or list API keys."4category: "AI & Agents"5author: community6version: "1.0.2"7icon: bot8metadata:9 source: https://skillmd.com/skills/rondoflow/agent-inference-capacity-marketplace10---1112# AISP Agent Skill1314Agent Inference Sharing Protocol (AISP) lets agents rent idle DIEM/Venice API capacity via USDC escrow. Providers list capped API keys; agents fund and receive keys automatically.1516## Architecture1718```19Agent: fund() → Backend sees Funded event → Key released → Agent uses Venice API20Provider: list() → Agent funds → Term expires → settle() → Provider paid (99%, 1% fee)21```2223## Agent Workflow (Renting)24251. **Listings** from backend: `GET /api/listings`262. **Approve USDC** if needed (contract spends on `fund`)273. **Fund** on-chain: `contract.fund(listingId, termDays, diemAmount)` → returns `rentalId`284. **Get key**: `POST /api/key/{rentalId}` with signed message `diem-marketplace:get-key:{rentalId}:{timestamp}`295. Use `apiKey` with Venice API until `expiresAt` (Unix timestamp)3031### SDK (Agent)3233```typescript34import { DiemAgent } from "diem-marketplace-sdk";3536const agent = new DiemAgent({37 signer: wallet,38 contractAddress: "0x...",39 backendUrl: "https://diem-marketplace-backend.fly.dev",40 usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",41});4243const listings = await agent.getListings();44const { apiKey, expiresAt } = await agent.rent(45 listings[0].listingId,46 termDays,47 ethers.parseUnits(diemAmount, 6)48);49```5051## Provider Workflow (Listing)52531. **Create listing** on-chain: `contract.list(pricePerDay, termDays, diemMin, diemMax)` → `listingId`542. **Store key** on backend: `POST /api/keys` with `{ listingId, apiKey, signature, timestamp }`55 - Message: `diem-marketplace:store-key:{listingId}:{timestamp}`563. **Settle** when rental expires: `contract.settle(rentalId)` → provider receives 99% (1% protocol fee)5758### SDK (Provider)5960```typescript61import { DiemProvider } from "diem-marketplace-sdk";6263const provider = new DiemProvider({64 signer: wallet,65 contractAddress: "0x...",66 backendUrl: "https://diem-marketplace-backend.fly.dev",67 usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",68});6970const listingId = await provider.createListing({71 pricePerDay: ethers.parseUnits("0.80", 6),72 termDays: 30,73 diemMin: ethers.parseUnits("1000", 6),74 diemMax: ethers.parseUnits("4000", 6),75 apiKey: "vn-scoped-...",76});77```7879## Key Paths8081| Path | Purpose |82|------|---------|83| `sdk/src/agent.ts` | DiemAgent: getListings, rent, getKey, getMyRentals |84| `sdk/src/provider.ts` | DiemProvider: createListing, settle, revokeAndRefund |85| `backend/src/routes.ts` | API routes: /api/listings, /api/keys, /api/key/:id |86| `contracts/DiemMarketplace.sol` | On-chain escrow, 1% fee |8788## Backend API8990| Endpoint | Method | Purpose |91|----------|--------|---------|92| `/api/listings` | GET | List rentable listings |93| `/api/listings/:id` | GET | Single listing |94| `/api/keys` | POST | Provider stores API key |95| `/api/key/:rentalId` | POST | Agent retrieves key (signature required) |96| `/api/balance` | POST | Check DIEM balance for API key |97| `/api/requests` | POST | Create rental request |9899## Signatures100101All backend requests requiring auth use EIP-191 signing:102- `getKey`: `diem-marketplace:get-key:{rentalId}:{timestamp}`103- `storeKey`: `diem-marketplace:store-key:{listingId}:{timestamp}`104- `balance`: `apiKey` in body (no signature)105106## Contract (Base)107108- **Chain**: Base (8453)109- **Mainnet**: `0xeeDa7657f2018b3b71B444b7ca2D8dE91b3B08f3`110- **USDC**: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`111112## Security & Signing113114- Use an external signer or hardware wallet; never paste raw private keys.115- Require explicit user confirmation before fund transfers or credential usage.116- Venice API keys must be scoped (inference-only), revocable, and minimal for escrow.117118## Notes119120- Venice API keys must be **inference-only** (not admin)121- 1% protocol fee deducted at settlement