UTC time

Skill File Reference

CheapTokens publishes a public agent skill pack for discounted Venice.ai credits. Use the full repo for the CheapTokens router plus synced Venice skills, or the raw single-file skill when your runtime wants one SKILL.md URL.

Canonical skill locations

Agent decision flow

  1. GET /api/pricing → check time-based discountPercent and supply.remaining
  2. GET /api/supply → confirm soldOut is false
  3. GET /api/checkout/options → discover x402/card routes and Prepaid availability
  4. POST /api/buy with { usdPaid, purchaseMode } via x402-fetch → save veniceApiKey
  5. Use key at https://api.venice.ai/api/v1 (OpenAI-compatible)
  6. GET /api/status/{veniceKeyLast6} → monitor usage
  7. Use /status for email, key, or wallet account lookup

Core endpoints

  • GET /api/pricing — current time-based discount, credits per dollar, supply status
  • GET /api/supply — daily capacity and remaining credits
  • GET /api/checkout/options — available payment routes and Prepaid API Key availability
  • POST /api/buy — x402 payment flow, returns Venice API key
  • GET /api/status/:keyPrefix — key status, usage, expiry
  • POST /api/stripe/recover — email-link recovery for card buyers
  • POST /api/stripe/recover/claim — claim one-time card recovery/account token
  • GET /api/payments/health — check if payment system is available

x402 payment flow

  1. POST /api/buy with desired purchase amount.
  2. Receive HTTP 402 with payment requirements in header.
  3. Agent signs EIP-712 USDC authorization with wallet private key.
  4. Retry with signed X-PAYMENT header.
  5. Server verifies on-chain, settles USDC, returns Venice API key.

The x402-fetch npm package automates steps 2-4 automatically.

Account and recovery

CheapTokens Account supports email, API key, and wallet lookup. Card buyers enter the Stripe receipt or Stripe Link checkout email on /status?tab=email; CheapTokens sends a private one-time link and does not reveal purchase existence from the public form. Wallet buyers sign an EIP-191 message to manage wallet-owned purchases:

  • POST /api/wallet/purchases — list all purchases for your wallet
  • POST /api/wallet/reveal — reveal the full API key for a purchase
  • POST /api/wallet/reissue — get a fresh key for active credits (e.g. if key was lost)

All wallet endpoints require: { walletAddress, signature, nonce, issuedAt }. Card recovery uses { email } for requests and { token } for one-time claims.

Use cases for agents

  • Burst workloads — buy credits for a specific task, use them, done
  • Budget-capped runs — buy exactly the amount you need, no ongoing commitment
  • Experiments — try models cheaply before committing to a provider
  • Short-lived inference — disposable API keys that auto-expire at midnight
  • Multi-model routing — all Venice models behind one key, switch freely

Headless buy — complete example (Node.js)

Requirements: npm install viem x402-fetch openai. You need a private key with USDC on Base.

buy-and-use.mjs
import { createWalletClient, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { base } from "viem/chains"; import { wrapFetchWithPayment } from "x402-fetch"; import OpenAI from "openai"; const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY); const wallet = createWalletClient({ account, chain: base, transport: http() }); const payFetch = wrapFetchWithPayment(fetch, wallet, BigInt(1_000_000)); // max $1.00 USDC // 1. Check pricing const pricing = await fetch("https://cheaptokens.ai/api/pricing") .then(r => r.json()); console.log(`Discount: ${pricing.discountPercent}%`); // 2. Buy $1.00 in credits const res = await payFetch("https://cheaptokens.ai/api/buy", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ usdPaid: 1.00, purchaseMode: "spot" }), }); const { veniceApiKey } = await res.json(); // 3. Pick a live Venice text model const traits = await fetch("https://api.venice.ai/api/v1/models/traits?type=text", { headers: { Authorization: "Bearer " + veniceApiKey }, }).then(r => r.json()); const model = traits.data?.default || traits.data?.fastest; // 4. Use the key const client = new OpenAI({ baseURL: "https://api.venice.ai/api/v1", apiKey: veniceApiKey, }); const response = await client.chat.completions.create({ model, messages: [{ role: "user", content: "Hello" }], }); console.log(response.choices[0].message.content);

The public source of truth is github.com/0xatd/cheaptokens-skills. The site-served /SKILL.md remains a convenience mirror for runtimes that want a single URL.