この日本語訳は機械翻訳で、レビュー待ちです。 Machine translation, under review.

ドキュメント

API ガイド

コンピュート API

推論とコンピュートで、1つのベース URL と1つのキーを使います: https://api.siliconnetwork.io。ワークロードのオファーを一覧し、テンプレートと支出上限を指定してオファーからインスタンスを開始し、ログを読み、停止できます。

まだ接続されていません

コンピュートプロバイダーが接続されていないため、現在オファー、インスタンス、ログは 404 Not Found を返します。ワークロードテンプレートは応答します。例は、プロバイダーが接続されたときの呼び出しを示しています。それまでは、SDK は ComputeUnavailable を発生させ、CLI はその旨を表示します。

実行の流れ

  1. GET /v1/compute/offers?workload=&priority= は、cheapest、fastest、balanced の順でランク付けしたオファーを一覧します。各オファーには、プロバイダー、リージョン、価格、確認した時刻が含まれます。容量、レイテンシ、スループットは、プロバイダーが報告した場合のみ表示されます。
  2. GET /v1/compute/templates は、テンプレートとそのパラメーターを一覧します。シークレットを受け取るテンプレートはありません。キーが必要なワークロードは、プロバイダー自身のシークレットストアから取得します。
  3. POST /v1/compute/instances は、オファーからインスタンスを開始します。idempotency_key を送ってください。同じキーをもう一度送ると、同じインスタンスが返ります。max_runtime_seconds と max_spend_usd を設定してください。どちらかに達するとインスタンスは停止します。fallback: true を指定すると、最初のオファーを開始できないときに、次の互換性のあるオファーを試します。
  4. GET /v1/compute/instances/{id}/logs?after= は出力を読み、POST /v1/compute/instances/{id}/terminate は停止します。表示される支出は、プロバイダーが報告した分だけで、推定値ではありません。

キーとスコープ

  • API キーのページで、必要なスコープだけを付けてキーを作成します。インスタンスとログの一覧と参照には compute:read、開始と停止には compute:launch、チャットには inference です。
  • インスタンスを開始するキーには、コンピュートの利用上限を設定してください。上限を超えると、そのキーはインスタンスを開始できなくなり、開始済みのインスタンスは停止されます。
  • オファーとテンプレートにはキーは不要です。IP 許可リストを設定したキーは、まだコンピュートのルートを使えません。
  • コンソールのリンクはダッシュボードからのみ開けます。API キーでは 403 で拒否されます。

ツール

  • Python: siliconnetwork パッケージの client.compute。silicon コマンドも一緒にインストールされます。
  • TypeScript: @siliconnetwork/sdk の client.compute。
  • Terraform: integrations/terraform-provider-silicon にある silicon_compute_instance リソースと、オファーおよびテンプレートのデータソース。
  • MCP: AI アシスタント向けのサーバーで、オファーの一覧、確認済みの上限での起動、ログの参照、インスタンスの停止、チャットができます。integrations/mcp にあります。
  • Bruno: 推論とコンピュートのリクエストコレクション。sdks/collections/bruno にあります。

これらはいずれも、まだパッケージレジストリには公開されていません。リポジトリからインストールしてください。いずれも SILICON_API_KEY を読み取ります。

ワークロード別の例

プロバイダーとオファーの ID は、オファー一覧にあるものに置き換えてください。パラメーターの値は例であり、実際に動作する値ではありません。

AI 推論

推論ではコンピュートインスタンスを開始しません。同じキーとベース URL でチャット補完を呼び出してください。 チャット補完

curl -s https://api.siliconnetwork.io/v1/chat/completions \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{"model": "silicon/auto", "messages": [{"role": "user", "content": "Hello"}]}'

AI 学習

fine-tune テンプレートによるファインチューニングのジョブです。

# 1. Offers for ai-training, balanced firstcurl -s "https://api.siliconnetwork.io/v1/compute/offers?workload=ai-training&priority=balanced" \  -H "Authorization: Bearer $SILICON_API_KEY" # 2. Start the fine-tune template on one of them (stops at the caps)curl -s https://api.siliconnetwork.io/v1/compute/instances \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "provider_id": "<provider_id from the offer>",    "offer_id": "<offer_id from the offer>",    "workload": "ai-training",    "idempotency_key": "ai-training-run-0001",    "template_id": "fine-tune",    "params": {      "base_model": "org/model-name",      "dataset_url": "https://example.com/data.jsonl",      "method": "lora",      "epochs": 3    },    "max_runtime_seconds": 14400,    "max_spend_usd": "40"  }' # 3. Follow its logs, then stop itcurl -s "https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/logs?after=0" \  -H "Authorization: Bearer $SILICON_API_KEY"curl -s -X POST https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/terminate \  -H "Authorization: Bearer $SILICON_API_KEY"

レンダリング

render-job テンプレートによる Blender シーンのフレーム範囲です。

# 1. Offers for rendering, fastest firstcurl -s "https://api.siliconnetwork.io/v1/compute/offers?workload=rendering&priority=fastest" \  -H "Authorization: Bearer $SILICON_API_KEY" # 2. Start the render-job template on one of them (stops at the caps)curl -s https://api.siliconnetwork.io/v1/compute/instances \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "provider_id": "<provider_id from the offer>",    "offer_id": "<offer_id from the offer>",    "workload": "rendering",    "idempotency_key": "rendering-run-0001",    "template_id": "render-job",    "params": {      "scene_url": "https://example.com/scene.blend",      "frame_start": 1,      "frame_end": 240,      "output_format": "png"    },    "max_runtime_seconds": 7200,    "max_spend_usd": "20"  }' # 3. Follow its logs, then stop itcurl -s "https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/logs?after=0" \  -H "Authorization: Bearer $SILICON_API_KEY"curl -s -X POST https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/terminate \  -H "Authorization: Bearer $SILICON_API_KEY"

マイニング

miner テンプレートによる、お使いのプールとウォレットに接続するマイナーです。

# 1. Offers for mining, cheapest firstcurl -s "https://api.siliconnetwork.io/v1/compute/offers?workload=mining&priority=cheapest" \  -H "Authorization: Bearer $SILICON_API_KEY" # 2. Start the miner template on one of them (stops at the caps)curl -s https://api.siliconnetwork.io/v1/compute/instances \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "provider_id": "<provider_id from the offer>",    "offer_id": "<offer_id from the offer>",    "workload": "mining",    "idempotency_key": "mining-run-0001",    "template_id": "miner",    "params": {      "pool_url": "stratum+ssl://pool.example.com:3333",      "wallet_address": "your wallet address",      "gpu_count": 1    },    "max_runtime_seconds": 86400,    "max_spend_usd": "10"  }' # 3. Follow its logs, then stop itcurl -s "https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/logs?after=0" \  -H "Authorization: Bearer $SILICON_API_KEY"curl -s -X POST https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/terminate \  -H "Authorization: Bearer $SILICON_API_KEY"

トレーディングボット

sniping-bot テンプレートによる、ボットのコンテナイメージです。キーはプロバイダーのシークレットストアに残ります。

# 1. Offers for trading-bots, fastest firstcurl -s "https://api.siliconnetwork.io/v1/compute/offers?workload=trading-bots&priority=fastest" \  -H "Authorization: Bearer $SILICON_API_KEY" # 2. Start the sniping-bot template on one of them (stops at the caps)curl -s https://api.siliconnetwork.io/v1/compute/instances \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "provider_id": "<provider_id from the offer>",    "offer_id": "<offer_id from the offer>",    "workload": "trading-bots",    "idempotency_key": "trading-bots-run-0001",    "template_id": "sniping-bot",    "params": {      "image": "ghcr.io/you/your-bot:1.0",      "restart": "on-failure"    },    "max_runtime_seconds": 86400,    "max_spend_usd": "5"  }' # 3. Follow its logs, then stop itcurl -s "https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/logs?after=0" \  -H "Authorization: Bearer $SILICON_API_KEY"curl -s -X POST https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/terminate \  -H "Authorization: Bearer $SILICON_API_KEY"

サーバー

plain-server テンプレートによる、素のマシンです。

# 1. Offers for servers, balanced firstcurl -s "https://api.siliconnetwork.io/v1/compute/offers?workload=servers&priority=balanced" \  -H "Authorization: Bearer $SILICON_API_KEY" # 2. Start the plain-server template on one of them (stops at the caps)curl -s https://api.siliconnetwork.io/v1/compute/instances \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "provider_id": "<provider_id from the offer>",    "offer_id": "<offer_id from the offer>",    "workload": "servers",    "idempotency_key": "servers-run-0001",    "template_id": "plain-server",    "params": {      "image": "ubuntu:24.04",      "ports": "22,443"    },    "max_runtime_seconds": 604800,    "max_spend_usd": "25"  }' # 3. Follow its logs, then stop itcurl -s "https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/logs?after=0" \  -H "Authorization: Bearer $SILICON_API_KEY"curl -s -X POST https://api.siliconnetwork.io/v1/compute/instances/$INSTANCE_ID/terminate \  -H "Authorization: Bearer $SILICON_API_KEY"

エラー

  • 404 Not Found: コンピュートプロバイダーが接続されていません。
  • 402: クレジット不足、支出上限への到達、またはキーのコンピュート利用上限に達しました (refused (key_compute_limit))。
  • 403: キーにスコープがない、組織のコンピュートアクセスが停止されている、またはキーに IP 許可リストが設定されています。
  • 409: オファーがなくなったか古くなった、または idempotency key が別のオファーに使われました。
  • 422: 不明なワークロード、無効なテンプレートパラメーター(名前のみ示し、値は返しません)、またはプロバイダーが実行できないワークロードです。
  • 503: プロバイダーが応答しませんでした。同じ idempotency key でもう一度お試しください。
Silicon Network›ドキュメント›ガイド›コンピュート API51 項目