Wallet-rooted AI agents. Pay per call.
Non-human inference callers identified by their Solana wallet. Register once, fund a session, call any OpenAI-compatible endpoint until your cap is hit. No human in the loop.
Four steps from wallet to first call.
- 01Register. POST your wallet pubkey, sign a server-issued nonce with your ed25519 private key, receive a fresh
a2e-agent-*api key. One-time, free. - 02Fund a session. POST to
/v1/agents/sessionswith an x402 payment ($1 / $5 / $10 / $25 USDC tiers on Solana). The paid amount becomes your session's spend cap. - 03Call inference. Include the session id as
X-A2E-Session-Idon every chat/embeddings/audio/image call. Every call atomically debits the session's spent counter. - 04Cap hits, session closes. When the next call would exceed the cap, you get a clean 402 and the session moves to
status=CLOSED. Open another session to keep going.
Quickstart (cURL).
Full registration to session to inference. The signing step assumes you have a Solana keypair (e.g. from @solana/web3.js or a wallet adapter).
1. Get a challenge
curl -X POST https://a2e-api.onrender.com/v1/agents/register/challenge \
-H "content-type: application/json" \
-d '{"walletAddress": "<your-base58-pubkey>"}'2. Sign the challenge with your wallet ed25519 key, then submit
curl -X POST https://a2e-api.onrender.com/v1/agents/register \
-H "content-type: application/json" \
-d '{
"walletAddress": "<your-base58-pubkey>",
"nonceHex": "<from step 1>",
"signatureBase58": "<base58 of 64-byte ed25519 signature>"
}'
# Response: { "apiKey": "a2e-agent-<48-hex>", ... }3. Open a session (x402-funded; pick a tier amount in atomic USDC)
# First call returns 402 with PaymentRequirements in the
# 'payment-required' response header. Decode it, sign a Solana
# TransferChecked for the chosen amount, base64 the PaymentPayload,
# then retry:
curl -X POST https://a2e-api.onrender.com/v1/agents/sessions \
-H "Authorization: Bearer a2e-agent-..." \
-H "PAYMENT-SIGNATURE: <base64 PaymentPayload>" \
-H "content-type: application/json" \
-d '{}'
# Response: { "id": "ses_...", "capUsd": 5.0, "fundingTxHash": "...", ... }4. Make inference calls
curl -X POST https://a2e-api.onrender.com/v1/chat/completions \
-H "Authorization: Bearer a2e-agent-..." \
-H "X-A2E-Session-Id: ses_..." \
-H "content-type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "What is the capital of Japan?"}]
}'Production-grade primitives.
Atomic cap enforcement
Every call atomically debits session.spentUsd via raw SQL conditional UPDATE. You cannot accidentally exceed your cap, even under concurrent calls.
Signed inference receipts
Every successful call emits an ed25519-signed receipt. Verify offline with @tokenosdeai/receipt-verifier — no platform trust required.
Per-agent rate limit
100 requests per minute default. Protects you (runaway loops can't drain your session in milliseconds) and the platform. Override per-agent if you have a trusted high-throughput workload.
No-human-in-the-loop lifecycle
Agents self-revoke (DELETE /v1/agents/me), self-close sessions, and idle sessions auto-close after 1h.
Works with your stack.
TokenOS is OpenAI-compatible. Point any framework at our base URL, add your session header, done. LangChain, LlamaIndex, CrewAI, Vercel AI SDK, the raw OpenAI SDK — all work with a two-line change.
LangChain (Python)
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://a2e-api.onrender.com/v1",
api_key="a2e-agent-...",
model="gpt-4o-mini",
default_headers={"X-A2E-Session-Id": "ses_..."},
)Claude Desktop / Cursor (MCP)
{
"mcpServers": {
"tokenos": {
"command": "npx",
"args": ["-y", "@tokenosdeai/mcp-server"],
"env": {
"A2E_AGENT_API_KEY": "a2e-agent-...",
"A2E_SESSION_ID": "ses_..."
}
}
}
}Up front.
- —Unused session cap is forfeited on any close path (idle timeout, self-close, agent revoke, cap exhausted). The funding USDC settles on-chain at session open; no automatic refund. On-chain refund flow is on the roadmap.
- —Audio + image inference are supported via sessions as of Phase 3.3.c. Pre-funded agent balance (top-up-once, debit-many) is on the roadmap.
- —x402 protocol on Solana mainnet. USDC on Solana required. Platform pays the SOL gas fee for the session-open transaction (you only need USDC, not SOL).
Ready when you are.
The full specification with every endpoint, response shape, and failure mode is documented in docs/AGENT_AUTH.md on GitHub. The npm SDK ships under the TokenOS DeAI org.