Zum Hauptinhalt springen
GET
/api/v1/x402/balance/{walletAddress}

Autorisierungen

SIGN-IN-WITH-X
string
header
erforderlich

Wallet-based authentication using the x402 protocol (Sign-In-With-X). Supports EVM SIWE signatures on Base and Ed25519 signatures on Solana mainnet.

Header format: Base64-encoded JSON object with the following fields:

  • address — EVM or Solana wallet address
  • message — Signed SIWX message. EVM wallets use EIP-4361 SIWE; Solana wallets use the Solana SIWX message format.
  • signature — Signature of the message, signed by the wallet's private key. EVM signatures are hex; Solana signatures may be base58 or base64.
  • timestamp — Unix timestamp in milliseconds
  • chainId — Chain identity. Use 8453, "8453", or "eip155:8453" for Base; use "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" for Solana.
  • type — Optional signature type. Use "ed25519" for Solana. Omitted means EVM/EIP-191 for backward compatibility.

EVM SIWE message fields:

  • domain: api.venice.ai
  • uri: https://api.venice.ai
  • version: "1"
  • chainId: 8453
  • nonce: Random 16-character hex string
  • issuedAt / expirationTime: ISO timestamps (recommended TTL: 10 minutes)
  • statement: "Sign in to Venice API"

Example (TypeScript):

Solana message fields: The signed message starts with <domain> wants you to sign in with your Solana account:, followed by the wallet address and the standard URI, Version, Chain ID, Nonce, Issued At, and optional Expiration Time fields. Use type: "ed25519" and chainId: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" in the encoded JSON payload.

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.

Header

SIGN-IN-WITH-X
string
erforderlich

base64-encoded JSON SIWX payload proving EVM or Solana wallet ownership. The legacy X-Sign-In-With-X header is also accepted during migration.

Beispiel:

"siwx_example_token"

Pfadparameter

walletAddress
string
erforderlich

EVM or Solana wallet address.

Pattern: ^(0x[a-fA-F0-9]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$
Beispiel:

"0xYOUR_WALLET_ADDRESS"

Antwort

Current x402 balance for the wallet.

success
enum<boolean>
erforderlich
Verfügbare Optionen:
true
data
object
erforderlich