Skip to content

rignode/rignode-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rignode-sdk

Official TypeScript and JavaScript SDK for the RIGNODE decentralized compute exchange. Submit AI inference jobs, register nodes, and query network stats from your application.

Installation

npm install @rignode/sdk

Quick Start

import { RignodeClient } from "@rignode/sdk";

const client = new RignodeClient();

// Get network stats
const stats = await client.getNetworkStats();
console.log(`${stats.activeNodes} active nodes, $${stats.totalUsdcPaid} USDC paid`);

// Submit an inference job
const job = await client.submitJob({
  model: "llama3-8b-q4",
  prompt: "Explain decentralized compute in one paragraph.",
  clientAddress: "YOUR_SOLANA_WALLET",
});
console.log("Job submitted:", job.id, job.status);

API Reference

Constructor

const client = new RignodeClient({
  baseUrl: "https://rignode.xyz/api", // optional, this is the default
  fetch: customFetch,                  // optional, override the fetch implementation
});

Nodes

// List all registered nodes
const nodes = await client.listNodes();

// Get a specific node
const node = await client.getNode(42);

// Register a new node
const node = await client.registerNode({
  walletAddress: "7xKXtg...",
  gpuModel: "RTX 4090",
  vram: 24,
  region: "us-east",
});

// Update node status or speed
await client.updateNode(42, { status: "online", tokensPerSec: 120 });

// Send a heartbeat to keep node online
await client.heartbeat(42);

// List jobs assigned to a node
const jobs = await client.listNodeJobs(42);

// List earnings for a node
const earnings = await client.listNodeEarnings(42);

Jobs

// List all jobs
const jobs = await client.listJobs();

// Get a specific job
const job = await client.getJob(7);

// Submit a job (with optional USDC payment tx)
const job = await client.submitJob({
  model: "llama3-8b-q4",
  prompt: "Summarize this text: ...",
  clientAddress: "YOUR_SOLANA_WALLET",
  txSignature: "5Hn3...",  // Solana tx signature after paying the quote
});

Payments and Quotes

// Get a price quote before paying
const quote = await client.getQuote("llama3-8b-q4", 500);
// quote.amountUsdc    => amount to send in USDC
// quote.treasuryWallet => destination wallet
// quote.usdcMint      => USDC token mint address
// quote.expiresAt     => quote expires in 10 minutes

Stats and Profitability

// Network-wide stats
const stats = await client.getNetworkStats();

// Estimate earnings for a GPU
const estimate = await client.getProfitability({
  gpuModel: "RTX 4090",
  powerWatts: 350,
  electricityRate: 0.12,
  utilizationPct: 0.6,
});
console.log(`Monthly net: $${estimate.monthlyNetUsdc} USDC`);

Supported Models

Model Price per 1K output tokens
llama3-8b-q4 $0.0004 USDC
llama3-70b-q4 $0.0016 USDC
mistral-7b-q4 $0.0003 USDC
qwen2-7b-q4 $0.0003 USDC
whisper-large-v3 $0.0006 USDC

Supported GPU Models

RTX 3060 through RTX 5090, AMD RX 6000 and 7000 series, NVIDIA data center cards (A10, A100, H100), and Intel Arc. See the full list on the RIGNODE node registry.

Supported Regions

us-east, us-west, eu-west, ap-southeast, sa-east

TypeScript Types

All types are exported from the package root:

import type {
  Node, NodeInput,
  Job, JobInput,
  EarningRecord,
  NetworkStats,
  ProfitabilityEstimate,
  QuoteResponse,
} from "@rignode/sdk";

Links

License

MIT

About

Official TypeScript SDK for the RIGNODE decentralized compute exchange. Submit AI jobs, register nodes, and query network stats programmatically.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors