0xatd/cheaptokens-skills/venice-x402
Claude Code and agent skill by 0xatd/cheaptokens-skills
- community
Checking that the SKILL.md file is still in the repository.
Manage Venice x402 wallet credits. Covers POST /x402/top-up (payment discovery + signed USDC settlement), GET /x402/balance/{walletAddress}, GET /x402/transactions/{walletAddress}, USDC on Base (chain 8453), minimum $5 top-up, transaction types TOP_UP/CHARGE/REFUND, and the x402 v2 PAYMENT-REQUIRED response shape returned by all inference endpoints.
Install
npx vskill@latest install 0xatd/cheaptokens-skills/venice-x402SKILL.md
The same SKILL.md was published earlier as 0xatd/cheaptokens-skills/venice-x402.
Venice x402 (wallet credits)
x402 is Venice's wallet-based payment flow. Pay per request with USDC on Base, no account required. Three admin endpoints plus the protocol-level 402 response returned by every inference endpoint.
| Endpoint | Auth | Purpose | |
|---|---|---|---|
POST /x402/top-up | None (discovery) / X-402-Payment (settlement) | Discover payment requirements, then settle a signed USDC transfer. | |
GET /x402/balance/{walletAddress} | SIWE (X-Sign-In-With-X) | Current USD balance for a wallet. | |
GET /x402/transactions/{walletAddress} | SIWE | Paginated ledger: TOP_UP, CHARGE, REFUND. |
For the SIWE header format itself, see `venice-auth`.
Pay with a wallet: end-to-end
1. Call an inference endpoint with no balance → 402
Any inference endpoint (e.g. POST /chat/completions) returns a 402 with structured topUpInstructions and siwxChallenge when the wallet balance is too low. The PAYMENT-REQUIRED response header carries the x402 v2 `paymentRequired` object (base64-encoded JSON containing x402Version, error, resource, accepts[], and optional extensions) — it is not the same payload as the 402 body, which is a richer balance/top-up document.
2. Discover payment requirements — POST /x402/top-up (no header)
Response 402:
3. Sign a USDC transfer → POST /x402/top-up with X-402-Payment
The x402 SDK does the EIP-712 USDC transferWithAuthorization signing for you:
200 response:
4. Call inference again — credits are now debited from the wallet
The venice-x402-client SDK wraps steps 1–4: it catches 402, auto-tops-up to a configured amount, and retries.
GET /x402/balance/{walletAddress}
The SIWE signer must match the path wallet — 403 otherwise.
GET /x402/transactions/{walletAddress}
Transaction types
type | Sign of amount | Meaning | |
|---|---|---|---|
TOP_UP | positive | /x402/top-up settlement. | |
CHARGE | negative | Inference debit. requestId / modelId link back to the call. | |
REFUND | positive | Failed request refund or manual adjustment. |
Query parameters
/x402/transactions/{walletAddress}
| Param | Notes | |
|---|---|---|
limit | 1–100. Default 50. | |
offset | Number of entries to skip. Default 0. |
Use offset + limit and pagination.hasMore for paging.
Constants
- Chain — Base mainnet, chain ID
8453(eip155:8453). - Token — USDC (6 decimals). Native USDC on Base; not USDbC.
- Minimum top-up —
$5by default. A small number of allow-listed wallets (e.g. internal test wallets) may have a lower per-wallet override — always use theminimumTopUpUsdreturned intopUpInstructions//x402/balancerather than hardcoding5. - x402 SDK —
npm install x402for raw payment header signing, orvenice-x402-clientfor the managed Venice flow. - Receiver wallet + token contract are returned in
topUpInstructions; don't hardcode them.
Errors
| Code | Meaning | |
|---|---|---|
400 | Below minimum top-up, invalid wallet format, or other validation. | |
401 | X-Sign-In-With-X header is present but invalid (bad signature, expired, nonce reuse, unsupported chain) — returned as X402_SIGN_IN_* error codes. | |
402 | Expected discovery response on /x402/top-up (no payment header), on /x402/balance and /x402/transactions when the SIWE header is absent, and on any inference endpoint when the wallet balance is insufficient. Settlement errors use INVALID_PAYMENT / INVALID_PAYMENT_FORMAT / INSUFFICIENT_FUNDS / EXPIRED_PAYMENT codes. | |
403 | SIWE wallet ≠ path wallet. | |
429 | Too many top-ups/balance checks. | |
500 | Settlement failure; retry with a fresh nonce. |
Gotchas
- Use the x402 SDK (
npm install x402) for signing. Hand-rolling the EIP-712transferWithAuthorizationis risky — nonce reuse ⇒INVALID_PAYMENT. - The SIWE signer wallet must match the
walletAddresspath param onbalance/transactions. Separate wallets can't inspect each other. /x402/top-upis unauthenticated on the discovery call — auth is implicit via the signedX-402-Paymentheader on settlement.balanceUsdon/x402/balanceis the USDC credit balance only.diemBalanceUsd, when present, is a separate linked-account number — sum them yourself if you need a combined figure.PAYMENT-REQUIRED(uppercase, hyphens) is the header with base64-encoded x402paymentRequiredobject; don't confuse it with the body fieldcode: "PAYMENT_REQUIRED"(which only appears on insufficient-balance bodies, not on auth-style 402s).- On
/x402/balanceand/x402/transactions, missing the SIWE header returns402(not 401). Only a present-but-invalid header returns401with aX402_SIGN_IN_*code. - The x402 v2
accepts[].amountis in base units (e.g."5000000"= 5 USDC). Don't multiply by decimals again. DIEM,BUNDLED_CREDITS, and Bearer-accountUSDare independent from wallet credits. For account balance, use `venice-billing`.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/venice-x402/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/0xatd/cheaptokens-skills/venice-x402)