0G Storage API
Fast append-only interaction with the 0G decentralized data network.
1. Overview
The Storage API seamlessly blobs JSON or text off-chain onto the 0G data availability layer without requiring you to hold 0g tokens or manage wallets.
2. Use Cases
- Archiving agent decision logs for transparency.
- Storing large intermediate embeddings during distributed processing.
3. Pricing
- Free Tier: 500 MB included / month.
- Storage: $0.08 / GB-month.
- Egress: $0.05 / GB.
- API calls are free. Zero locks required if remaining inside free tier.
4. API
POST /v1/storage/upload
Headers: Authorization: Bearer sk_...
Request Body: Form-Data or JSON.
{ "content": "{"task":"done"}", "type": "json" }
Response Schema:
{
"ok": true,
"cid": "baegbe...",
"size": 1500
}
5. Examples
TypeScript SDK:
const receipt = await opacus.ogStorage.store({ data: myData });
console.log('Saved to 0G at CID:', receipt.cid);
6. Errors
413 PAYLOAD_TOO_LARGE - Max 5MB per direct request.
7. Best Practices
Compress data aggressively before upload. Retain the CID to fetch egress context.