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

@sdkwork/ai-sdk

v1.0.8

Published

sdkwork-ai-sdk

Readme

sdkwork-ai-sdk

Professional TypeScript SDK for SDKWork API.

Installation

npm install @sdkwork/ai-sdk
# or
yarn add @sdkwork/ai-sdk
# or
pnpm add @sdkwork/ai-sdk

Quick Start

import { SdkworkAiClient } from '@sdkwork/ai-sdk';

const client = new SdkworkAiClient({
  baseUrl: 'http://localhost:8080',
  timeout: 30000,
});

// Mode A: API Key (recommended for server-to-server calls)
client.setApiKey('your-api-key');

// Use the SDK
const result = await client.model.listModels();

Authentication Modes (Mutually Exclusive)

Choose exactly one mode for the same client instance.

Mode A: API Key

const client = new SdkworkAiClient({ baseUrl: 'http://localhost:8080' });
client.setApiKey('your-api-key');
// Sends: Authorization: Bearer <apiKey>

Mode B: Dual Token

const client = new SdkworkAiClient({ baseUrl: 'http://localhost:8080' });
client.setAuthToken('your-auth-token');
client.setAccessToken('your-access-token');
// Sends:
// Authorization: Bearer <authToken>
// Access-Token: <accessToken>

Do not call setApiKey(...) together with setAuthToken(...) + setAccessToken(...) on the same client.

Configuration (Non-Auth)

import { SdkworkAiClient } from '@sdkwork/ai-sdk';

const client = new SdkworkAiClient({
  baseUrl: 'http://localhost:8080',
  timeout: 30000, // Request timeout in ms
  headers: {      // Custom headers
    'X-Custom-Header': 'value',
  },
});

API Modules

  • client.open - open API
  • client.chat - chat API
  • client.video - video API
  • client.thread - thread API
  • client.response - response API
  • client.rerank - rerank API
  • client.music - music API
  • client.moderation - moderation API
  • client.message - message API
  • client.knowledgeBase - knowledge_base API
  • client.image - image API
  • client.file - file API
  • client.embedding - embedding API
  • client.context - context API
  • client.batch - batch API
  • client.audio - audio API
  • client.assistant - assistant API
  • client.model - model API

Usage Examples

open

// GET /v1/open/i18n/options
const params = {} as Record<string, any>;
const result = await client.open.getOptions(params);

chat

// List chat completions
const params = {} as Record<string, any>;
const result = await client.chat.listCompletions(params);

video

// List videos
const params = {} as Record<string, any>;
const result = await client.video.listVideos(params);

thread

// Create thread
const body = {} as any;
const result = await client.thread.createThread(body);

response

// Create response
const body = {} as any;
const result = await client.response.createResponse(body);

rerank

// Rerank documents
const body = {} as any;
const result = await client.rerank.rerank(body);

music

// List music
const params = {} as Record<string, any>;
const result = await client.music.listMusic(params);

moderation

// Create moderation
const body = {} as any;
const result = await client.moderation.createModeration(body);

message

// Count Claude tokens
const body = {} as any;
const result = await client.message.countClaudeTokens(body);

knowledge_base

// List knowledge bases
const params = {} as Record<string, any>;
const result = await client.knowledgeBase.listKnowledgeBases(params);

image

// Create image
const body = {} as any;
const result = await client.image.createImage(body);

file

// List files
const params = {} as Record<string, any>;
const result = await client.file.listFiles(params);

embedding

// Create embeddings
const body = {} as any;
const result = await client.embedding.createEmbedding(body);

context

// Create context
const body = {} as any;
const result = await client.context.createContext(body);

batch

// List batches
const params = {} as Record<string, any>;
const result = await client.batch.listBatches(params);

audio

// Create speech
const body = {} as any;
const result = await client.audio.createSpeech(body);

assistant

// List assistants
const params = {} as Record<string, any>;
const result = await client.assistant.listAssistants(params);

model

// List models
const result = await client.model.listModels();

Error Handling

import { SdkworkAiClient, NetworkError, TimeoutError, AuthenticationError } from '@sdkwork/ai-sdk';

try {
  const result = await client.model.listModels();
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Authentication failed:', error.message);
  } else if (error instanceof TimeoutError) {
    console.error('Request timed out:', error.message);
  } else if (error instanceof NetworkError) {
    console.error('Network error:', error.message);
  } else {
    throw error;
  }
}

Publishing

This SDK includes cross-platform publish scripts in bin/:

  • bin/publish-core.mjs
  • bin/publish.sh
  • bin/publish.ps1

Check

./bin/publish.sh --action check

Publish

./bin/publish.sh --action publish --channel release
.\bin\publish.ps1 --action publish --channel test --dry-run

Set NPM_TOKEN (and optional NPM_REGISTRY_URL) before release publish.

License

MIT