
Crypto RPC for Agents | Give your AI agent inference and on-chain access
Venice gives your agent both inference (230+ models) and blockchain access (10 EVM chains plus Starknet) through a single credential. Your agent can think, sign, and send transactions without juggling separate accounts for inference and RPC providers.
One credential, two superpowers
A single API key (or wallet) for both LLM inference and JSON-RPC calls.
11 chains supported
Ethereum, Base, Arbitrum, Optimism, Polygon, Linea, Avalanche, BSC, Blast, zkSync Era, and Starknet (mainnet plus testnets).
Stake VVV for headless funding
Stake VVV on Base to earn daily DIEM, the only fully headless funding path for a minted API key. USD and crypto top-ups are also available through the dashboard.
Keyless auth via x402. Agents can authenticate with a wallet signature and pay in USDC on Base.
Why Venice for on-chain agents?
| Capability | What your agent gets |
|---|---|
| Inference Authentication | 230+ text, image, video, audio, and embedding models through one OpenAI-compatible endpoint |
| Crypto RPC | JSON-RPC 2.0 proxy to 10 EVM chains plus Starknet (mainnet and testnets) |
| Authentication | Standard API key or x402 wallet auth (no Venice account required) |
| Funding | Autonomous: VVV staking for daily DIEM. Browser: USD or crypto top-ups via the dashboard |
| Batching | Up to 100 JSON-RPC calls per request, multi-chain in parallel |
| Idempotency | Safe retries with Idempotency-Key header |
Authentication
Pick the auth method that matches how your agent runs.
| Method | Best for | How it works |
|---|---|---|
| API key | Server-side agents, fixed deployments | Authorization: Bearer <key> header. Get a key at venice.ai/settings/api. |
| x402 wallet | Autonomous, crypto-native, or short-lived agents | Wallet signs a SIWE message, pays per request in USDC on Base. No Venice account needed. See the x402 guide. |
^(Both methods share the same rate limits and billing in Venice credits.)
>Truly autonomous agents can mint their own API key by staking VVV on Base.
See Autonomous Agent API Key Creation.
Crypto RPC quickstart
Send any JSON-RPC 2.0 method to POST /crypto/rpc/{network}.
curl https://api.venice.ai/api/v1/crypto/rpc/ethereum-mainnet
-H "Authorization: Bearer $VENICE_API_KEY"
-H "Content-Type: application/json"
-d '{ "jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 1 }'
Response:
{ "jsonrpc": "2.0", "id": 1, "result": "0x1" }
Response headers include X-Venice-RPC-Credits (credits charged), X-Venice-RPC-Cost-USD (dollar cost), and X-Request-ID (correlation ID).
Supported networks
| Family | Mainnet | Testnets |
|---|---|---|
| Ethereum | ethereum-mainnet |
ethereum-sepolia, ethereum-holesky |
| Base | base-mainnet |
base-sepolia |
| Arbitrum | arbitrum-mainnet |
arbitrum-sepolia |
| Optimism | optimism-mainnet |
optimism-sepolia |
| Polygon | polygon-mainnet |
polygon-amoy |
| Linea | linea-mainnet |
linea-sepolia |
| Avalanche C-Chain | avalanche-mainnet |
avalanche-fuji |
| BNB Smart Chain | bsc-mainnet |
bsc-testnet |
| Blast | blast-mainnet |
blast-sepolia |
| zkSync Era | zksync-mainnet |
zksync-sepolia |
| Starknet | starknet-mainnet |
starknet-sepolia |
Use GET /crypto/rpc/networks for the live, authoritative list.
Method tiers
| Tier | Multiplier | Examples |
|---|---|---|
| Standard | 1x | eth_call, eth_getBalance, eth_blockNumber, eth_sendRawTransaction, eth_getLogs, eth_getTransactionReceipt, eth_estimateGas |
| Advanced | 2x | trace_block, trace_call, trace_transaction, debug_traceCall, debug_traceTransaction |
| Large | 4x | trace_replayBlockTransactions, trace_replayTransaction, txpool_content |
^(Full list and pricing detail in the) ^(Crypto RPC API reference)^(.)
Agent recipes
Common patterns for AI agents that need to read and write on-chain.
Read a wallet’s native balance
curl https://api.venice.ai/api/v1/crypto/rpc/base-mainnet \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0xYourWalletAddress", "latest"],
"id": 1
}'
Read ERC-20 token balance
Call the balanceOf(address) selector with eth_call. The data field is the 4-byte selector (0x70a08231) followed by the wallet address left-padded to 32 bytes. Easiest to let a library encode it:
import { encodeFunctionData, parseAbi } from 'viem'
const data = encodeFunctionData({
abi: parseAbi(['function balanceOf(address) view returns (uint256)']),
args: ['0xWalletAddress'],
})
const response = await fetch('https://api.venice.ai/api/v1/crypto/rpc/base-mainnet', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VENICE_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_call',
params: [{ to: '0xacfE6019Ed1A7Dc6f7B508C02d1b04ec88cC21bf', data }, 'latest'],
id: 1,
}),
})
The contract address above is VVV on Base. Swap it for any ERC-20 contract.
Send a signed transaction (full lifecycle)
Venice never holds your private keys. The agent gathers tx parameters via RPC reads, signs locally with a library like viem or ethers, then relays the raw hex through Venice.
1. Get the next nonce
curl https://api.venice.ai/api/v1/crypto/rpc/base-mainnet \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xAgentWallet","pending"],"id":1}'
Use "pending" so back-to-back sends don’t collide.
2. Get gas price
curl https://api.venice.ai/api/v1/crypto/rpc/base-mainnet \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":1}'
For EIP-1559 chains, prefer eth_feeHistory to compute maxFeePerGas and maxPriorityFeePerGas.
3. Estimate gas
curl https://api.venice.ai/api/v1/crypto/rpc/base-mainnet \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0xAgentWallet","to":"0xRecipient","value":"0x0","data":"0x..."}],"id":1}'
4. Sign locally
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY)
const signed = await account.signTransaction({
chainId: base.id,
nonce, // from step 1
gas, // from step 3
maxFeePerGas, // from step 2 (fee history)
maxPriorityFeePerGas, // from step 2 (fee history)
to: '0xRecipient',
value: 0n,
data: '0x...',
})
5. Submit through Venice
curl https://api.venice.ai/api/v1/crypto/rpc/base-mainnet \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Idempotency-Key: agent-tx-<id>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xSignedHex"],"id":1}'
Always set Idempotency-Key on relays so a network blip can’t double-broadcast.
6. Poll for receipt
curl https://api.venice.ai/api/v1/crypto/rpc/base-mainnet \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xTxHash"],"id":1}'
Poll every few seconds until result is non-null. Check result.status ("0x1" = success).
>Every eth_sendRawTransaction call is logged server-side with the tx hash, network, request ID, and calling user ID. The signed payload itself is not retained. This audit trail exists so compromised keys used for illicit relays can be traced back to the responsible account.
Batch multiple calls (multi-chain portfolio check)
Send up to 100 JSON-RPC objects in one request. Each is validated and billed independently.
curl https://api.venice.ai/api/v1/crypto/rpc/ethereum-mainnet \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-d '[
{ "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1 },
{ "jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0xWallet", "latest"], "id": 2 },
{ "jsonrpc": "2.0", "method": "eth_gasPrice", "params": [], "id": 3 }
]'
For multi-chain reads (one call per chain), issue parallel requests to different {network} endpoints.
Safe retries with idempotency
Set the Idempotency-Key header to any string matching [A-Za-z0-9_-]{1,255}. Venice caches the response for 24 hours keyed on (user, key). Replays return the cached result with Idempotent-Replayed: true and charge nothing.
curl https://api.venice.ai/api/v1/crypto/rpc/base-mainnet \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Idempotency-Key: agent-tx-2026-04-21-001" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xSignedRawTxHex"],
"id": 1
}'
This is critical for transaction relays where a network blip could otherwise cause your agent to broadcast the same tx twice.
Funding the agent’s API key
Once the agent has a Venice API key, it needs spendable balance on the underlying account before paid endpoints will accept the key. There are two ways to put balance there:
| Path | Autonomous? | How it works |
|---|---|---|
| DIEM from VVV staking | Yes | Stake VVV in the Venice Staking Smart Contract on Base. The wallet’s daily DIEM allocation is proportional to its share of the staking pool. The account needs at least 0.1 DIEM accrued before any DIEM is spendable. DIEM refreshes at 00:00 UTC. To grow daily spend, stake more VVV. |
| USD or crypto top-up via the dashboard | No (browser) | Sign into venice.ai with the same wallet (Sign-In-With-Ethereum), then add credits in Settings, API. Both Stripe (card) and Coinbase (crypto) live behind that page and require a browser. Credits never expire. |
For an agent that runs unattended, DIEM via VVV staking is the only fully headless funding path for a minted API key today. If the agent’s daily spend exceeds its DIEM allocation, the realistic options are: stake more VVV, or have an operator sign in and top up in USD or crypto.
Autonomous VVV staking and key generation
A truly autonomous agent can manage its own VVV wallet on Base, stake it, and mint its own Venice API key with no human in the loop. The full flow:
1. Acquire VVV and ETH for gas
Send VVV to the agent’s wallet (or have the agent swap on Aerodrome or Uniswap), plus a small amount of ETH on Base for the two staking transactions.
2. Stake VVV
approve the staking contract on the VVV token, then stake(amount) on 0x321b7ff75154472B18EDb199033fF4D116F340Ff. The wallet’s sVVV balance updates atomically with the stake.
3. Mint an API key
GET /api/v1/api_keys/generate_web3_key returns a JWT that expires 15 minutes after issuance. Sign the raw token with the staking wallet, then POST the address, signature, and token back. Venice returns an API key bound to the user account derived from that wallet.
Minting only requires a non-zero sVVV balance, so 1 staked VVV is enough to receive a key. Spending with the key is a separate question, governed by the funding table above.
See Autonomous Agent API Key Creation for the complete walkthrough with code and the full error reference.
x402 wallet auth in 30 seconds
If your agent already has a Base wallet, skip the API key entirely. The venice-x402-client SDK handles SIWE signing, top-ups, and balance tracking.
npm install venice-x402-client
import { VeniceClient } from 'venice-x402-client'
const venice = new VeniceClient(process.env.WALLET_KEY)
await venice.topUp(10) // skip if the wallet already has balance
const response = await venice.chat({
model: 'kimi-k2-6',
messages: [{ role: 'user', content: 'What is the latest block on Base?' }]
})
The same wallet auth works against /crypto/rpc/{network} for blockchain reads and writes. Full protocol details in the x402 guide.
Pricing
Crypto RPC is billed in Venice credits. Each response includes X-Venice-RPC-Credits (credits charged) and X-Venice-RPC-Cost-USD (dollar cost) so your agent can track spend per request.
Base credits per chain
| Base credits | Chains |
|---|---|
| 20 | Ethereum, Base, Optimism, Arbitrum, Polygon, Linea, Avalanche, BSC, Blast, Starknet |
| 30 | zkSync Era |
Cost examples
Observed pricing for standard, advanced, and large method tiers:
| Call | Credits | USD cost |
|---|---|---|
eth_call on Ethereum (20 × 1x) |
20 | ~$0.0000140 |
trace_transaction on Ethereum (20 × 2x) |
40 | ~$0.0000280 |
trace_replayTransaction on Ethereum (20 × 4x) |
80 | ~$0.0000560 |
eth_call on zkSync (30 × 1x) |
30 | ~$0.0000210 |
Always trust the X-Venice-RPC-Cost-USD response header for the authoritative cost. Errored items in batch requests are billed at a flat 5 credits each.
Rate limits
| Tier | Requests per minute |
|---|---|
| Standard | 100 |
| Staff | 1,000 |
When exceeded, the endpoint returns 429 with standard X-RateLimit-* response headers.
Error handling
Common HTTP responses your agent should handle:
| Status | Meaning | What to do |
|---|---|---|
400 |
Unsupported or unmapped JSON-RPC method, or malformed batch | Verify the method against the allowlist. The error body names the offending method. |
400 |
Replay of an Idempotency-Key with a different body |
Use a fresh key for distinct requests. |
402 |
No auth header at all (response body includes authOptions listing both supported auth paths), or out of credits with a valid auth header |
If no auth: attach Authorization: Bearer ... or the x402 X-Sign-In-With-X header. If out of credits: with a Bearer key, fund the account (DIEM, USD, or dashboard top-up); with x402 auth, call POST /api/v1/x402/top-up directly. |
429 |
Rate limit hit (100 req/min standard, 1,000 req/min staff) | Honor X-RateLimit-Reset and back off. Batch up to 100 calls per request to amortize the limit. |
5xx |
Upstream RPC node hiccup | Retry with the same Idempotency-Key to avoid double-charging. |
Per-item batch errors (e.g. invalid params on one of N calls) come back inside a 200 OK response with a JSON-RPC error field on the offending item. Those items are billed at a flat 5 credits each.
Not supported
These categories of methods are intentionally rejected:
- WebSocket-only (
eth_subscribe,eth_unsubscribe): the proxy is HTTP-only. Poll instead. - Stateful filters (
eth_newFilter,eth_getFilterChanges, etc.): filter state is pinned to a single backend and breaks on a load-balanced proxy. Useeth_getLogsinstead. - Key-holding methods (
eth_sign,eth_accounts,eth_mining): hosted providers don’t hold user keys. Sign client-side and submit viaeth_sendRawTransaction. - Unmapped methods: anything not allowlisted returns
400. Contact support to request additions.
To see all resources such as full method list, pricing, response headers and everything else to do with this guide, see here: https://docs.venice.ai/guides/integrations/crypto-rpc-agents#resources