Documentation Index
Fetch the complete documentation index at: https://docs.zkterm.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
x402 is zkTerm’s internal payment system that handles crypto payments for resource-consuming features like zkStorage (IPFS costs) and zkAI assistant (AI token usage).
Status: In Development
Note: All pricing shown below are examples only and subject to change before launch.
Supported Services
| Service | What You Pay For | Cost Driver |
|---|
| zkStorage | IPFS file storage and pinning | Pinata API costs |
| zkAI | AI assistant responses | OpenAI token usage |
Payment Methods
x402 accepts cryptocurrency payments:
| Token | Network | Status |
|---|
| ZKTR | Solana | Primary |
| SOL | Solana | Supported |
| USDC | Solana | Supported |
ZKTR is zkTerm’s native token used for platform payments and governance.
How It Works
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ User │ │ zkTerm │ │ External │
│ Wallet │ │ x402 │ │ Services │
├─────────────┤ ├─────────────┤ ├─────────────┤
│ 1. Pay ZKTR │ ───> │ 2. Credit │ ───> │ 3. Pinata │
│ or SOL │ │ account │ │ OpenAI │
│ │ <─── │ 4. Deduct │ <─── │ 5. Response │
│ │ │ balance │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
zkStorage Payments
When you upload files to zkStorage, x402 handles the payment:
- File encrypted client-side
- x402 checks your credit balance
- Upload processed via Pinata
- Credits deducted based on file size
Pricing (example only, subject to change):
| File Size | Cost |
|---|
| Up to 10 MB | Free |
| 10 MB - 100 MB | 0.1 ZKTR |
| 100 MB - 1 GB | 1 ZKTR |
| 1 GB+ | 10 ZKTR |
zkAI Payments
AI assistant usage is metered by token consumption:
- You send a message to zkAI
- x402 checks your credit balance
- Request sent to AI provider
- Credits deducted based on tokens used
Pricing (example only, subject to change):
| Usage | Cost |
|---|
| Simple query | 0.01 ZKTR |
| Code generation | 0.05 ZKTR |
| Long conversation | 0.1 ZKTR |
Terminal Commands
Check Balance
Output:
x402 CREDITS
ZKTR Balance: 125.50 ZKTR
SOL Balance: 2.5 SOL
Estimated Usage:
- ~1,255 zkStorage uploads (10MB)
- ~12,550 zkAI queries
Add Credits
zk credits add <amount> --token ZKTR
Example:
> zk credits add 100 --token ZKTR
ADDING CREDITS
Amount: 100 ZKTR
From: Your connected wallet
Confirm? (y/n): y
Transaction: 5abc...def
New Balance: 225.50 ZKTR
View Usage History
Output:
USAGE HISTORY
Date Service Amount Balance
─────────────────────────────────────────
Dec 02 zkStorage -0.1 225.40
Dec 02 zkAI -0.05 225.35
Dec 01 zkStorage -1.0 225.40
Dec 01 Add Credits +100 226.40
API Reference
Get Balance
Response:
{
"zktr": "125.50",
"sol": "2.5",
"usdc": "0"
}
Add Credits
POST /api/x402/deposit
Content-Type: application/json
{
"amount": "100",
"token": "ZKTR",
"txSignature": "5abc...def"
}
Get Usage History
GET /api/x402/history?limit=10
Response:
{
"transactions": [
{
"date": "2024-12-02T10:30:00Z",
"service": "zkStorage",
"amount": "-0.1",
"balance": "225.40",
"details": "upload: document.pdf (15MB)"
}
]
}
Credit System
How Credits Work
- Deposit - Send ZKTR/SOL/USDC to your zkTerm account
- Internal Balance - Credits tracked in zkTerm database
- Usage Deduction - Automatic deduction when using paid services
- Withdraw - Withdraw unused credits back to wallet
Free Tier
New users get free credits to try zkTerm:
| Service | Free Allowance |
|---|
| zkStorage | 10 MB total |
| zkAI | 100 queries |
ZKTR Benefits
Paying with ZKTR provides:
- 10% Discount - Lower rates vs SOL/USDC
- Priority Processing - Faster uploads and AI responses
- Governance Rights - Vote on zkTerm features
Security
- Non-Custodial - You control your wallet, we only track credits
- Transparent Pricing - All costs shown before confirmation
- Audit Trail - Full transaction history available
- Refunds - Unused credits can be withdrawn anytime
Future Features
- Subscription Plans - Monthly unlimited tiers
- Team Accounts - Shared credit pools
- Staking Rewards - Earn credits by staking ZKTR
- Referral Program - Earn credits for inviting users