Get the x402 credit balance for a wallet address. Requires Sign-in-with-x authentication (via SIWE) for the same wallet.
Wallet-based authentication using the x402 protocol (Sign-In-With-X / EIP-4361 SIWE).
Header format: Base64-encoded JSON object with the following fields:
address — Ethereum wallet address (checksummed)message — EIP-4361 SIWE message string (created with SiweMessage.prepareMessage())signature — Hex-encoded signature of the message, signed by the wallet's private keytimestamp — Unix timestamp in millisecondschainId — Chain ID (use 8453 for Base)SIWE message fields:
domain: outerface.venice.aiuri: https://outerface.venice.aiversion: "1"chainId: 8453nonce: Random 16-character hex stringissuedAt / expirationTime: ISO timestamps (recommended TTL: 10 minutes)statement: "Sign in to Venice API"Example (TypeScript):
import { Wallet } from 'ethers'
import { SiweMessage } from 'siwe'
const wallet = new Wallet(PRIVATE_KEY)
const msg = new SiweMessage({ domain: 'outerface.venice.ai', address: wallet.address, statement: 'Sign in to Venice API', uri: 'https://outerface.venice.ai', version: '1', chainId: 8453, nonce: crypto.randomUUID().replace(/-/g, '').slice(0, 16), issuedAt: new Date().toISOString(), expirationTime: new Date(Date.now() + 600000).toISOString() })
const signature = await wallet.signMessage(msg.prepareMessage())
const header = btoa(JSON.stringify({ address: wallet.address, message: msg.prepareMessage(), signature, timestamp: Date.now(), chainId: 8453 }))
// Set header: X-Sign-In-With-X: <header>SDK: npm install @venice-ai/x402-client provides VeniceClient and createAuthFetch which handle this automatically.
Billing: x402 users pay from a prepaid USDC credit balance. Top up via POST /x402/top-up. When balance is insufficient, endpoints return 402 with structured top-up instructions.
base64-encoded JSON SIWE payload message proving wallet ownership
"siwx_example_token"
Ethereum wallet address.
^0x[a-fA-F0-9]{40}$"0xYOUR_WALLET_ADDRESS"