0G · Compute (verified)
Packages (both renamed 2025 → 2026)
@0gfoundation/0g-compute-ts-sdk(was@0glabs/0g-serving-broker, now deprecated).@0gfoundation/0g-storage-ts-sdk(was@0glabs/0g-ts-sdk).- Node 22+. Requires
ethers.
Two paths, we chose Direct
| Path | Auth | Gives us provider address & TEE signature? |
|---|---|---|
Router (pc.0g.ai) | API key sk-... | No — hidden |
| Direct broker (Ognef) | wallet-signed | Yes |
Direct is the only path that lets us cite the on-chain provider identity and TEE-attested response.
What we actually verify
There is no single `modelHash` field in 0G. The verifiable primitives are:
providerAddress+service.modelfrombroker.inference.listService()— the on-chain "which model, whose service" record.composeVerificationfrombroker.inference.verifyService(provider, './reports')— cryptographic hash of the TEE-deployed Docker image.processResponse(providerAddress, chatID)— verifies the TEE signature on the returned response.
Ognef combines them into a derived model reference:
model_hash = keccak256(providerAddress + service.model + composeHash)
artifact_hash = sha256(json({providerAddress, model, messages, answer, chatID}))Both are stored on every sessions row.
Env vars
OG_PRIVATE_KEY— Ognef's ledger wallet.OG_RPC_URL— 0G RPC.- Optional
OG_PROVIDER_ADDRESS— pin a preferred provider.
Fallback
Without OG creds, the same route marks simulated: true. Deterministic hashes are still computed so the receipt shape is preserved end-to-end. The demo never lies about which path ran.