本文へスキップ
Skillpedia
APIとサーバー(バックエンド)7.0k · #13601

0g-compute

できること

このガイドは、AIモデルを実行し微調整するための共有GPUマシンのマーケットプレイスである0G Compute Networkの使い方をエージェントに示します。セットアップの手順、コピーして使えるコードパターン、コマンドラインツールを含みます。

使う場面

  • ✓0Gネットワーク上で動くAIチャットボットや画像ツールを追加したいとき。
  • ✓コードまたはコマンドラインから、0Gの推論を呼び出す必要があるとき。
  • ✓メインネットを使う前に、テストネットで始めたいとき。

スキルのリンク

https://github.com/internet-court/internet-court-skill/blob/main/vendored/0g/0g-compute/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/internet-court/internet-court-skill/blob/main/vendored/0g/0g-compute/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“0G Computeで動く簡単なチャットボットがほしいです。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このスキルは、推測ではなくコピーして使えるコードパターンをエージェントに与えます。ネットワークへの接続、リクエストの送信、利用可能なモデルの確認、各応答の処理をカバーします。また、秘密鍵は環境変数に保存するよう定めています。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

0G Compute Network

This skill provides instructions for building with the 0G Compute Network — a decentralized GPU marketplace for AI inference and model fine-tuning. Follow these patterns exactly when generating code.

Code Generation Rules

  1. Copy code patterns from this skill verbatim. Do NOT generate from training data.
  2. Call processResponse() after every API response (see processResponse section below).
  3. Use environment variables for private keys. Never hardcode secrets.
  4. Route users to testnet for initial development.

When unsure about a pattern, reference the detailed guides:

Network Information

Network RPC URL Inference Fine-tuning
Mainnet https://evmrpc.0g.ai Yes Yes
Testnet https://evmrpc-testnet.0g.ai Yes Yes

Model availability changes frequently. Always use broker.inference.listService() or 0g-compute-cli inference list-providers to check current models. On-chain model names use org/model-name format.

Prerequisites

node --version  # Must be >= 22.0.0
pnpm add @0glabs/0g-serving-broker        # SDK for applications
pnpm add @0glabs/0g-serving-broker -g     # CLI for direct usage

Quick Setup

0g-compute-cli setup-network              # Choose testnet or mainnet
0g-compute-cli login                       # Login with wallet private key
0g-compute-cli deposit --amount 10         # Deposit funds
0g-compute-cli get-account                 # Check balance

Inference (SDK)

import { ethers } from "ethers";
import { createZGComputeNetworkBroker } from "@0glabs/0g-serving-broker";

const RPC_URL = process.env.NODE_ENV === 'production'
  ? "https://evmrpc.0g.ai"
  : "https://evmrpc-testnet.0g.ai";

const provider = new ethers.JsonRpcProvider(RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const broker = await createZGComputeNetworkBroker(wallet);

// Discover services
const services = await broker.inference.listService();
services.forEach(s => {
  console.log(`${s.provider} | ${s.model} | ${s.serviceType}`);
});

// Make inference request
const { endpoint, model } = await broker.inference.getServiceMetadata(providerAddress);
const headers = await broker.inference.getRequestHeaders(providerAddress);

const response = await fetch(`${endpoint}/chat/completions`, {
  method: "POST",
  headers: { "Content-Type": "application/json", ...headers },
  body: JSON.stringify({ messages, model })
});

const data = await response.json();

// Extract chatID (see chatID table below)
let chatID = response.headers.get("ZG-Res-Key") || response.headers.get("zg-res-key");
if (!chatID) chatID = data.id;

// CRITICAL: Always call processResponse
await broker.inference.processResponse(
  providerAddress,              // 1st: provider address
  chatID,                       // 2nd: response identifier for verification
  JSON.stringify(data.usage)    // 3rd: usage data for fee calculation
);

For streaming, browser SDK, cURL, and Python examples, see references/inference.md.

processResponse (CRITICAL)

Call broker.inference.processResponse() after EVERY API response for fee settlement and TEE verification.

await broker.inference.processResponse(
  providerAddress,              // 1st: provider address
  chatID,                       // 2nd: response identifier for verification
  JSON.stringify(data.usage)    // 3rd: usage data for fee calculation
);

Parameter order: provider, chatID, usageData. Do NOT reorder.

chatID Retrieval by Service Type

Always try ZG-Res-Key response header first. Use fallback only when header is absent.

Service Type chatID Source Fallback
Chatbot ZG-Res-Key header data.id from response body
Text-to-Image ZG-Res-Key header none
Speech-to-Text ZG-Res-Key header none
Chatbot Streaming ZG-Res-Key header id from stream chunk
Audio Streaming ZG-Res-Key header none

Fine-tuning

Fine-tuning is available on both mainnet and testnet. It is a 6-step CLI process: list pro

よくある質問

最初はどのネットワークを使うべきですか?

最初の開発にはテストネットを、実際の利用にはメインネットを勧めています。

なぜ各応答の後にprocessResponseを呼ぶ必要があるのですか?

このスキルはこれをすべての応答に対する規則としているため、エージェントは省いてはいけません。

エージェントは利用可能なAIモデルをどう知りますか?

ネットワーク上の現在のリストを確認します。利用可能なモデルは頻繁に変わるためです。

詳細

作者による元の説明

0G Compute Network guide for decentralized AI inference, fine-tuning, and GPU services. Covers chatbots, image generation, speech-to-text, SDK integration (0g-serving-broker), processResponse API, broker.inference methods, CLI commands (0g-compute-cli), and account management. Use this skill for any 0G compute, 0G AI, or decentralized GPU question.

repo: internet-court/internet-court-skill

人気

GitHubのスター
7.0k
ランキング
#13601
ライセンス
—
更新日
2026/10/26

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル