Skip to main content

Account

Both Direct Inference and Fine-tuning use the same per-provider account system: you deposit to a main account, transfer funds to each provider's sub-account, and the provider deducts from there as you use the service. This page is the shared reference for all operations — Web UI, CLI, and SDK.

Using the Router instead?

The Router has its own unified billing and does not use per-provider sub-accounts. Router deposits, balance, API keys, and usage live elsewhere — see Router → Deposits & Billing and Router → Authentication.

Overview​

The account system provides a secure and flexible way to manage funds across different AI service providers.

Account Structure​

  • Main Account: Your primary wallet where funds are deposited. All deposits go here first, and you can withdraw funds from here back to your wallet.
  • Sub-Accounts: Provider-specific accounts created automatically when you transfer funds to a provider. Each provider has a separate sub-account where funds are locked for their specific services.

Fund Flow​

Account Fund Flow Diagram
  1. Deposit: Transfer funds from your wallet to your Main Account
  2. Transfer: Move funds from Main Account to Provider Sub-Accounts
  3. Usage: Provider deducts from Sub-Account for services rendered
  4. Refund Request: Initiate refund from Sub-Account (enters 24-hour lock period)
  5. Complete Refund: After lock period expires, call retrieve-fund again to complete transfer back to Main Account
  6. Withdraw: Transfer funds from Main Account back to your wallet

Security Features​

  • 24-hour lock period for refunds to protect providers from abuse
  • Single-use authentication for each request to prevent replay attacks
  • On-chain verification for all transactions ensuring transparency
  • Provider acknowledgment required before first use of services

Prerequisites​

  • Node.js >= 20.0.0
  • A wallet with 0G tokens (for testnet or mainnet)
  • EVM compatible wallet (for Web UI)

Choose Your Interface​

FeatureWeb UICLISDK
Setup time~1 min~2 min~5 min
Visual dashboard✅❌❌
Automation❌✅✅
App integration❌❌✅

Best for: Quick account management with visual dashboard

Installation​

pnpm add @0gfoundation/0g-compute-ts-sdk -g

Launch Web UI​

0g-compute-cli ui start-web

Access the Web UI at http://localhost:3090/wallet where you can:

  • View your account balance in real-time
  • Deposit funds directly from your connected wallet
  • Transfer funds to provider sub-accounts
  • Monitor spending and usage
  • Request refunds with a visual interface

Best Practices​

For Inference Services​

  1. Deposit enough funds for expected usage
  2. Transfer funds to providers you plan to use frequently
  3. Keep some balance in sub-accounts for better response times
  4. Monitor usage regularly

For Fine-tuning Services​

  1. Calculate dataset size before transferring funds
  2. Transfer enough to cover the entire training job
  3. Request refunds for unused funds after job completion

Troubleshooting​

Insufficient Balance Error

Check which account needs funds:

  • Main account: Use deposit
  • Sub-account: Use transfer-fund
# Check all balances
0g-compute-cli get-account

# Deposit to main account if needed
0g-compute-cli deposit --amount 10

# Transfer to provider if needed
0g-compute-cli transfer-fund --provider <ADDRESS> --amount 5
Refund Not Available

Refunds have a 24-hour lock period. After the lock period expires, you need to call the retrieve-fund function again to complete the refund. Check the status:

0g-compute-cli get-sub-account --provider <PROVIDER_ADDRESS>

Look for "Remaining Locked Time" in the output.

Transaction Failed

Common causes:

  1. Network issues - Check your RPC endpoint
  2. Gas price too low - Increase gas price
  3. Insufficient gas - Ensure wallet has enough for gas fees
# Specify custom gas price
0g-compute-cli deposit --amount 10 --gas-price 20000000000