npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@harchos/sdk

v0.2.2

Published

The official TypeScript/JavaScript SDK for HarchOS — Carbon-Aware GPU Orchestration Platform

Readme

@harchos/sdk

npm version PyPI version License: MIT

The Official TypeScript/JavaScript SDK for HarchOS — Carbon-Aware GPU Orchestration Platform

HarchOS is the Operating System for Sovereign AI Infrastructure. This SDK provides typed access to the HarchOS API with sovereign defaults: region="morocco", sovereignty="strict", carbon_aware=true.

Install

npm install @harchos/sdk
# or
yarn add @harchos/sdk
# or
pnpm add @harchos/sdk

Quick Start

import { HarchOSClient } from "@harchos/sdk";

const client = new HarchOSClient({ apiKey: "hsk_..." });

// Carbon-aware scheduling — HarchOS's key differentiator
const carbon = await client.carbon.getIntensity("MA");
console.log(`Morocco: ${carbon.carbon_intensity_gco2_kwh} gCO2/kWh`);
console.log(`Renewable: ${carbon.renewable_percentage}%`);

// Find the greenest hub for your workload
const optimal = await client.carbon.optimalHub({
  region: "morocco",
  gpu_count: 4,
  gpu_type: "a100",
});
console.log(`Best hub: ${optimal.recommended_hub_name}`);
console.log(`Action: ${optimal.action}`);

// Optimize workload scheduling
const result = await client.carbon.optimize({
  workload_name: "training-job",
  gpu_count: 4,
  gpu_type: "a100",
  carbon_aware: true,
  carbon_max_gco2: 100,
});
console.log(`Action: ${result.action}, CO2 saved: ${result.carbon_saved_kg} kg`);

// List all hubs
const hubs = await client.hubs.list();
console.log(`${hubs.total} hubs, ${hubs.items.length} visible`);

// Create a carbon-aware workload
const workload = await client.workloads.create({
  name: "llama-training",
  workload_type: "training",
  compute: { gpu_count: 8, gpu_type: "a100" },
  carbon_aware: true,
});

Configuration

Environment Variables

export HARCHOS_API_KEY="hsk_..."
export HARCHOS_BASE_URL="https://harchos-api-production.up.railway.app/v1"
export HARCHOS_REGION="morocco"
export HARCHOS_SOVEREIGNTY="strict"
export HARCHOS_TIMEOUT="30"
export HARCHOS_MAX_RETRIES="3"

Then create a client with no arguments:

const client = HarchOSClient.fromEnv();

Programmatic Configuration

const client = new HarchOSClient({
  apiKey: "hsk_test_development_key_12345",
  baseURL: "https://harchos-api-production.up.railway.app/v1",
  region: "morocco",
  sovereignty: "strict",
  carbonAware: true,
  timeout: 30,
  maxRetries: 3,
});

API Reference

client.carbon — Carbon-Aware Scheduling

HarchOS is the only GPU orchestration platform with a native Carbon API.

| Method | Description | |--------|-------------| | carbon.getIntensity(zone) | Get real-time carbon intensity for a zone | | carbon.listIntensities() | Get carbon intensity for all zones | | carbon.optimalHub(params) | Find the greenest hub for a workload | | carbon.optimize(params) | Optimize workload scheduling by carbon intensity | | carbon.getForecast(zone, hours?) | Get carbon intensity forecast | | carbon.getMetrics(periodDays?) | Get aggregate carbon metrics | | carbon.getDashboard() | Get full carbon dashboard data |

client.hubs — Sovereign Compute Hubs

| Method | Description | |--------|-------------| | hubs.list(params?) | List hubs with optional filtering | | hubs.get(hubId) | Retrieve a hub by ID | | hubs.create(spec) | Create a new hub | | hubs.update(hubId, spec) | Update a hub | | hubs.capacity(hubId) | Get hub capacity | | hubs.scale(hubId, targetGpuCount) | Scale a hub | | hubs.drain(hubId) | Drain a hub | | hubs.delete(hubId) | Delete a hub |

client.workloads — Workload Management

| Method | Description | |--------|-------------| | workloads.list(params?) | List workloads with filtering | | workloads.get(workloadId) | Retrieve a workload | | workloads.create(spec) | Create a new workload | | workloads.update(workloadId, spec) | Update a workload | | workloads.cancel(workloadId) | Cancel a running workload | | workloads.pause(workloadId) | Pause a workload | | workloads.resume(workloadId) | Resume a paused workload | | workloads.delete(workloadId) | Delete a workload |

Other Resources

  • client.energy — Energy consumption and reporting
  • client.models — Available AI models
  • client.pricing — Pricing plans and cost estimation
  • client.regions — Region information
  • client.monitoring — Platform monitoring and health
  • client.health() — API health check

Error Handling

import { HarchOSError, RateLimitError, NotFoundError } from "@harchos/sdk";

try {
  const hub = await client.hubs.get("non-existent-id");
} catch (error) {
  if (error instanceof NotFoundError) {
    console.log("Hub not found");
  } else if (error instanceof RateLimitError) {
    console.log(`Rate limited. Retry after: ${error.retryAfter}s`);
  } else if (error instanceof HarchOSError) {
    console.log(`HarchOS error: ${error.message} (code: ${error.code})`);
  }
}

Competitor Comparison

| Feature | HarchOS | Modal | Replicate | Together | |---------|---------|-------|-----------|----------| | Carbon API | ✅ | ❌ | ❌ | ❌ | | Sovereignty Controls | ✅ | ❌ | ❌ | ❌ | | Data Residency | ✅ | ❌ | ❌ | ❌ | | Carbon-Aware Scheduling | ✅ | ❌ | ❌ | ❌ | | Python SDK | ✅ | ✅ | ✅ | ✅ | | TypeScript/JS SDK | ✅ | ✅ | ❌ | ❌ | | CLI | ✅ | ❌ | ❌ | ❌ | | African Hubs | ✅ | ❌ | ❌ | ❌ |

Python SDK

Also available on PyPI:

pip install harchos

License

MIT © HarchCorp