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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@llm-dev-ops/llm-governance-sdk

v1.0.1

Published

TypeScript/JavaScript SDK for LLM Governance Dashboard API

Downloads

183

Readme

@llm-dev-ops/llm-governance-sdk

TypeScript/JavaScript SDK for the LLM Governance Dashboard API.

Installation

npm install @llm-dev-ops/llm-governance-sdk

Usage

Basic Setup

import { LLMGovernanceSDK } from '@llm-dev-ops/llm-governance-sdk';

const sdk = new LLMGovernanceSDK({
  baseUrl: 'https://api.example.com/v1',
  token: 'your-access-token'
});

Authentication

// Login
const authResponse = await sdk.auth.login({
  email: '[email protected]',
  password: 'password123'
});

// Get current user
const user = await sdk.auth.getCurrentUser();

// Register new user
const newUser = await sdk.auth.register({
  email: '[email protected]',
  password: 'password123',
  full_name: 'John Doe'
});

// Logout
await sdk.auth.logout();

// MFA Setup
const mfaSetup = await sdk.auth.setupMFA();
const verification = await sdk.auth.verifyMFASetup('123456');

Organizations

// List organizations
const orgs = await sdk.organizations.listOrganizations();

// Get organization
const org = await sdk.organizations.getOrganization('org-id');

// Create organization
const newOrg = await sdk.organizations.createOrganization({
  name: 'My Organization',
  description: 'Organization description'
});

// Update organization
const updatedOrg = await sdk.organizations.updateOrganization('org-id', {
  name: 'Updated Name'
});

// Delete organization
await sdk.organizations.deleteOrganization('org-id');

Organization Members

// List members
const members = await sdk.organizations.listOrganizationMembers('org-id');

// Add member
const member = await sdk.organizations.addOrganizationMember(
  'org-id',
  'user-id',
  'admin'
);

// Update member role
const updatedMember = await sdk.organizations.updateOrganizationMember(
  'org-id',
  'member-id',
  'viewer'
);

// Remove member
await sdk.organizations.removeOrganizationMember('org-id', 'member-id');

Teams

// List teams
const teams = await sdk.organizations.listTeams('org-id');

// Get team
const team = await sdk.organizations.getTeam('team-id');

// Create team
const newTeam = await sdk.organizations.createTeam('org-id', {
  name: 'Engineering Team',
  description: 'Development team'
});

// Update team
const updatedTeam = await sdk.organizations.updateTeam('team-id', {
  name: 'Updated Team Name'
});

// Delete team
await sdk.organizations.deleteTeam('team-id');

// Manage team members
const teamMembers = await sdk.organizations.listTeamMembers('team-id');
await sdk.organizations.addTeamMember('team-id', 'user-id', 'member');
await sdk.organizations.removeTeamMember('team-id', 'member-id');

LLM Providers and Models

// List providers
const providers = await sdk.organizations.listProviders('org-id');

// Get provider
const provider = await sdk.organizations.getProvider('provider-id');

// Create provider
const newProvider = await sdk.organizations.createProvider('org-id', {
  name: 'OpenAI',
  provider_type: 'openai',
  api_key: 'sk-...'
});

// Update provider
const updatedProvider = await sdk.organizations.updateProvider('provider-id', {
  api_key: 'new-key'
});

// Delete provider
await sdk.organizations.deleteProvider('provider-id');

// Manage models
const models = await sdk.organizations.listModels('provider-id');
const model = await sdk.organizations.getModel('model-id');
const newModel = await sdk.organizations.createModel('provider-id', {
  name: 'gpt-4',
  description: 'GPT-4 model'
});
await sdk.organizations.updateModel('model-id', { is_enabled: false });
await sdk.organizations.deleteModel('model-id');

Token Management

// Set token dynamically
sdk.setToken('new-access-token');

// Get current token
const token = sdk.getToken();

// Set base URL
sdk.setBaseUrl('https://new-api.example.com/v1');

// Get current base URL
const baseUrl = sdk.getBaseUrl();

Token Change Callback

// Listen for token changes (useful for storing tokens)
const sdk = new LLMGovernanceSDK({
  baseUrl: 'https://api.example.com/v1',
  onTokenChange: (token) => {
    if (token) {
      localStorage.setItem('auth_token', token);
    } else {
      localStorage.removeItem('auth_token');
    }
  }
});

Error Handling

import type { ApiError } from '@llm-dev-ops/llm-governance-sdk';

try {
  const user = await sdk.auth.getCurrentUser();
} catch (error) {
  const apiError = error as ApiError;
  console.error(`Error ${apiError.status_code}: ${apiError.detail}`);
  if (apiError.error_code) {
    console.error(`Error code: ${apiError.error_code}`);
  }
}

API Reference

LLMGovernanceSDK

Main SDK class that provides access to all API endpoints.

Constructor

constructor(config?: ApiClientConfig)

Parameters:

  • config.baseUrl - Base URL of the API (default: http://localhost:8000/api/v1)
  • config.token - Initial authentication token
  • config.onTokenChange - Callback function called when token changes

Properties

  • client: ApiClient - Low-level HTTP client
  • auth: AuthApi - Authentication API
  • organizations: OrganizationsApi - Organizations API

Methods

  • setToken(token: string | null): void - Set authentication token
  • getToken(): string | null - Get current token
  • setBaseUrl(baseUrl: string): void - Set API base URL
  • getBaseUrl(): string - Get current base URL

TypeScript Support

This package includes TypeScript type definitions. Import types from @llm-dev-ops/llm-governance-types:

import type {
  User,
  Organization,
  Team,
  LLMProvider,
  LLMModel
} from '@llm-dev-ops/llm-governance-types';

License

Apache-2.0