0g-orbit

中文文档
0.2.3发布于 2026/04/06MITTypeScriptES Module

The developer toolkit for 0G. Store, infer, deploy — one SDK, one CLI, five minutes.

原始使用文档
文档目录14 节
  1. What is this?
  2. Install
  3. Quick Start
  4. SDK
  5. CLI
  6. API
  7. Orbit.connect(config)
  8. Storage
  9. Inference
  10. Fine-Tuning
  11. Direct Client Access
  12. Security
  13. Contributing
  14. License

0G Orbit

The developer toolkit for 0G. Store, infer, fine-tune — one SDK, one CLI, five minutes.

CI npm License: MIT Node.js

What is this?

0G Orbit wraps the 0G storage SDK, serving broker, and chain interactions into a single unified interface. Instead of juggling @0gfoundation/0g-ts-sdk, @0glabs/0g-serving-broker, and raw ethers calls, you get one Orbit class and one orbit CLI.

Storage — Upload and download files to 0G's decentralized storage network Inference — Run AI models on 0G's decentralized compute network Fine-Tuning — Upload datasets, create training tasks, download fine-tuned models

Install

npm install 0g-orbit

Quick Start

SDK

import { Orbit } from '0g-orbit'

const orbit = await Orbit.connect({
  network: 'testnet',
  privateKey: process.env.PRIVATE_KEY,
})

// Upload a file
const { root, txHash } = await orbit.store('./data.json')
console.log(`Stored: ${root}`)

// Download it back
await orbit.retrieve(root, './downloaded.json')

// Run AI inference
const response = await orbit.infer('meta-llama/Llama-3.2-3B-Instruct', {
  message: 'Explain zero-knowledge proofs in one sentence.',
})
console.log(response.content)

// Fine-tune a model
const dataset = await orbit.uploadDataset('./training-data.jsonl')
const task = await orbit.createFineTuneTask({
  model: 'base-model',
  dataset: dataset.root,
  providerAddress: '0x...',
})

CLI

# Set your private key
export PRIVATE_KEY=0x...

# Upload a file
orbit store ./my-file.txt

# Download a file
orbit retrieve <rootHash> ./output.txt

# Run inference
orbit infer meta-llama/Llama-3.2-3B-Instruct -m "Hello, 0G!"

# List available AI services
orbit services

# Fine-tune a model
orbit fine-tune ./dataset.jsonl --model base-model --provider 0x...

# Check account status
orbit status

API

Orbit.connect(config)

Creates a connected Orbit instance.

OptionTypeDescription
network'testnet' | 'mainnet'Network to connect to
privateKeystring?Wallet private key (falls back to PRIVATE_KEY env var)
rpcUrlstring?Custom RPC URL

Storage

MethodDescription
orbit.store(path, options?)Upload a file, returns { root, txHash }
orbit.storeData(text, options?)Upload a text string
orbit.retrieve(rootHash, outputPath, options?)Download a file by root hash

Inference

MethodDescription
orbit.infer(model, options)Run AI inference, returns { content, tokensUsed }
orbit.listServices()List available AI services on the network

Fine-Tuning

MethodDescription
orbit.uploadDataset(path)Upload a training dataset to storage
orbit.createFineTuneTask(options)Create a fine-tuning task
orbit.getFineTuneTask(provider, taskId)Check task status
orbit.downloadModel(provider, taskId, outputDir)Download a fine-tuned model
orbit.listModels()List available base models
orbit.listProviders()List fine-tuning providers

Direct Client Access

For advanced usage, access the underlying clients directly:

orbit.storage    // StorageClient
orbit.inference  // InferenceClient
orbit.fineTuning // FineTuningClient

Security

This package has transitive dependencies with known vulnerabilities (from upstream 0G SDKs). To mitigate, add this to your project's package.json:

{
  "overrides": {
    "axios": "1.14.0"
  }
}

See SECURITY.md for details.

Contributing

See CONTRIBUTING.md.

License

MIT

版本与发布记录

0g-orbit 共发布 5 个版本,首次发布于 2026/04/05;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.2.3latest2026/04/066 个月前
0.2.22026/04/066 个月前
0.2.12026/04/056 个月前
0.2.02026/04/056 个月前
0.1.02026/04/056 个月前

关于 0g-orbit 的常见问题

0g-orbit 是什么?

用于0G的开发人员工具包。存储,推断,部署-一个SDK,一个CLI,五分钟。

如何安装 0g-orbit?

在项目目录运行 npm install 0g-orbit,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 orbit,可以用 npx orbit 直接运行。

0g-orbit 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

0g-orbit 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

0g-orbit 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

0g-orbit 可以商用吗?

0g-orbit 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

0g-orbit 还在维护吗?

最新版本 0.2.3 发布于 2026/04/06(6 个月前);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/04/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。