VDM NexusDocsBeta

Quickstart

Install the SDK, generate an agent, fund it with USDC, and make a signed inference call on Solana mainnet or devnet.

The fastest path from zero to your first signed inference call. Five minutes once USDC is in your agent's wallet.

Last verified workingreceipt 0d3a5b26

Just want to see it work first? The hosted playground at vdmnexus.com/playground makes paid signed-inference calls against the live API using the operator's wallet. No install, no USDC needed. Come back here once you want your own agent making the calls.

1. Install

npm install @vdm-nexus/x402
# or
pnpm add @vdm-nexus/x402

2. Generate an agent + grab its pubkey

import { X402Agent } from "@vdm-nexus/x402";

const agent = X402Agent.generate();
console.log("pubkey:", agent.pubkey);
console.log("secret (save somewhere safe):", agent.secretKeyBase58);

The pubkey is what you fund with USDC. The secret is the 64-byte Ed25519 keypair encoded in base58 — losing it means losing the agent.

3. Fund your agent with USDC

Mainnet: send real USDC to your agent's pubkey from any Solana wallet. ~$0.01 per inference call, so a couple of dollars goes a long way.

Devnet (free, for testing): go to faucet.circle.com, select Solana Devnet, paste your agent's pubkey, request 5+ USDC. It arrives in seconds and auto-creates the USDC associated token account.

Either way, no SOL needed — the facilitator pays the transaction fees.

4. Make the call

const reply = await agent.payAndInfer("https://nexus.vdmnexus.com/api/v1", {
  model: "openai/gpt-4o-mini",
  messages: [
    { role: "user", content: "Explain signed inference in one sentence." }
  ],
  network: "mainnet", // or "devnet" — defaults to devnet for safety
});

console.log("Model said:", reply.openai.choices[0].message.content);
console.log("Tx:", reply.payment?.txSignature);
console.log("Cost:", reply.receipt?.cost_usdc, "USDC");

That's a real signed inference. Check the tx_signature on Solana explorer — it's a real on-chain transaction.

What just happened

  1. The SDK POSTed to /chat/completions with no payment header
  2. Got back a 402 with the x402 challenge (amount, recipient, network)
  3. Built a signed Solana SPL USDC transfer matching the challenge
  4. POSTed again with the signed transfer in the X-Payment header
  5. Nexus's facilitator verified, co-signed, broadcast to Solana, ran OpenRouter inference, returned OpenAI body + signed receipt

The full sequence, diagrammed.

Next

On this page