@nunabot/nunabot
v0.1.0
Published
TypeScript SDK and CLI for Nunabot — decentralized GPU compute on Solana
Maintainers
Readme
nunabot
TypeScript SDK and CLI for Nunabot — decentralized GPU compute on Solana.
Installation
npm install nunabotOr install globally to use the CLI:
npm install -g nunabotAuthentication
Set your API key as an environment variable:
export NUNABOT_API_KEY=your_api_key_hereOptionally override the base URL (defaults to https://api.nunabot.dev/v1):
export NUNABOT_BASE_URL=https://api.nunabot.dev/v1SDK Usage
import { NunabotClient } from "nunabot";
const client = new NunabotClient({
apiKey: process.env.NUNABOT_API_KEY!,
});
// Get a price quote
const quote = await client.quote("stable-diffusion-xl", 4);
console.log(`Estimated cost: ${quote.estimatedCost} ${quote.currency}`);
// Submit a job
const job = await client.submit("stable-diffusion-xl", 4);
console.log(`Job ID: ${job.jobId} — Status: ${job.status}`);
// Check job status
const status = await client.jobStatus(job.jobId);
console.log(status);
// List providers
const providers = await client.providers();
providers.forEach((p) => {
console.log(`${p.name} (${p.region}) — ${p.pricePerUnit} ${p.currency}/unit`);
});
// Market data
const market = await client.market();
console.log(`Avg price: ${market.averagePrice} ${market.currency}`);Agent Sessions
// Create a session
const session = await client.createSession({ metadata: { project: "my-app" } });
console.log(`Session: ${session.sessionId}`);
// List sessions
const sessions = await client.listSessions();
// Get a specific session
const s = await client.getSession(session.sessionId);
// Close a session
await client.closeSession(session.sessionId);Error Handling
import { NunabotClient, NunabotError } from "nunabot";
try {
const quote = await client.quote("my-task", 8);
} catch (err) {
if (err instanceof NunabotError) {
console.error(`[${err.statusCode}] ${err.message}`);
}
}CLI Usage
Usage: nunabot [command] [options]
Commands:
quote <task> [units] Get a price quote for a compute task
submit <task> [units] Submit a compute task for execution
job-status <jobId> Get the status of a submitted job
providers List available compute providers
market Show current market data and pricing
sessions create Create a new agent session
sessions list List all agent sessions
sessions get <sessionId> Get details of a session
sessions close <sessionId> Close an agent sessionExamples
# Quote for a task (default 1 unit)
nunabot quote stable-diffusion-xl
# Quote for 8 units, output as JSON
nunabot quote stable-diffusion-xl 8 --json
# Submit a job
nunabot submit stable-diffusion-xl 4
# Check job status
nunabot job-status job_abc123
# List providers
nunabot providers
# Market overview
nunabot market
# Session management
nunabot sessions create
nunabot sessions list
nunabot sessions get sess_abc123
nunabot sessions close sess_abc123All commands support --json to output raw JSON, useful for piping to jq:
nunabot providers --json | jq '.[] | select(.region == "us-east-1")'Build from Source
git clone https://github.com/Nunabotdev/Nunabot.git
cd Nunabot
npm install
npm run buildLicense
MIT
