Skip to main content
POST
/
v2
/
uploads
/
cost
Upload Cost
curl --request POST \
  --url https://api.tusky.io/v2/uploads/cost \
  --header 'Content-Type: application/json' \
  --data '
{
  "files": [
    {
      "size": 123,
      "name": "<string>"
    }
  ],
  "epochs": 123,
  "publisherId": "<string>"
}
'
{
  "files": [
    {
      "name": "<string>",
      "size": 123,
      "encodedSize": 123,
      "walCost": "<string>",
      "gasCost": "<string>"
    }
  ],
  "totals": {
    "fileCount": 123,
    "totalSize": 123,
    "totalEncodedSize": 123,
    "totalWal": "<string>",
    "totalGas": "<string>",
    "totalSui": "<string>"
  },
  "epochs": 123,
  "balance": {
    "walBalance": "<string>",
    "suiBalance": "<string>",
    "sufficient": true,
    "walDeficit": "<string>",
    "suiDeficit": "<string>"
  },
  "conversion": {
    "required": true,
    "walNeeded": "<string>",
    "estimatedSuiCost": "<string>",
    "rate": "<string>",
    "source": "<string>"
  },
  "subscription": {
    "plan": "<string>",
    "coveredGas": true,
    "monthlyUploadsRemaining": 123,
    "monthlyBandwidthRemaining": 123
  }
}
Calculate the storage cost for one or more files before uploading. Accepts a list of file sizes and returns a per-file breakdown, totals, conversion requirements, and subscription coverage. Use this to preview costs, build budgeting tools, or validate that your balance is sufficient before starting an upload batch.

Request Body

files
array
required
List of file size objects to estimate. Each entry represents one file.
epochs
number
default:"Publisher default"
Number of Walrus storage epochs. Overrides the publisher default. Range: 1–100.
publisherId
string
Optional publisher ID. When provided, the cost uses the publisher’s epochs, quilt, and autoConvert settings. When omitted, the account default publisher is used.

Response

files
array
Per-file cost breakdown.
totals
object
Aggregate totals across all files.
epochs
number
The epoch count used for this calculation.
balance
object
Current wallet balances and whether they cover the cost.
conversion
object
SUI → WAL conversion details. Present when the publisher has autoConvert: true and the WAL balance is insufficient.
subscription
object
Subscription coverage details. Present when the account has an active subscription.

Example

curl -X POST https://api.tusky.io/v2/uploads/cost \
  -H "Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      { "size": 10485760, "name": "video.mp4" },
      { "size": 2097152, "name": "document.pdf" },
      { "size": 524288, "name": "image.png" }
    ],
    "epochs": 5
  }'

Response

{
  "files": [
    {
      "name": "video.mp4",
      "size": 10485760,
      "encodedSize": 52428800,
      "walCost": "0.045",
      "gasCost": "0.002"
    },
    {
      "name": "document.pdf",
      "size": 2097152,
      "encodedSize": 10485760,
      "walCost": "0.012",
      "gasCost": "0.002"
    },
    {
      "name": "image.png",
      "size": 524288,
      "encodedSize": 2621440,
      "walCost": "0.008",
      "gasCost": "0.001"
    }
  ],
  "totals": {
    "fileCount": 3,
    "totalSize": 13107200,
    "totalEncodedSize": 65536000,
    "totalWal": "0.065",
    "totalGas": "0.005",
    "totalSui": "0.005"
  },
  "epochs": 5,
  "balance": {
    "walBalance": "120.0",
    "suiBalance": "45.2",
    "sufficient": true,
    "walDeficit": "0",
    "suiDeficit": "0"
  },
  "conversion": {
    "required": false,
    "walNeeded": "0",
    "estimatedSuiCost": "0",
    "rate": "0.38",
    "source": "aggregated"
  },
  "subscription": {
    "plan": "growth",
    "coveredGas": true,
    "monthlyUploadsRemaining": 8750,
    "monthlyBandwidthRemaining": 96636764160
  }
}

Response when conversion is needed

When autoConvert is enabled and WAL balance is insufficient, the conversion object shows the swap details:
{
  "totals": {
    "fileCount": 3,
    "totalWal": "0.065",
    "totalGas": "0.005",
    "totalSui": "0.019"
  },
  "balance": {
    "walBalance": "0.02",
    "suiBalance": "45.2",
    "sufficient": true,
    "walDeficit": "0",
    "suiDeficit": "0"
  },
  "conversion": {
    "required": true,
    "walNeeded": "0.045",
    "estimatedSuiCost": "0.014",
    "rate": "0.38",
    "source": "cetus"
  }
}
When conversion.required is true, the totals.totalSui includes the estimated swap cost. The balance.sufficient field accounts for the conversion — if your SUI balance covers both gas and the swap, it reports true even if WAL balance alone is too low.
Cost estimates are based on current Walrus network rates and DEX liquidity. Actual costs are determined at transaction time. The encodedSize includes Walrus erasure coding overhead (~5x the original size).