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

@toolhouseai/sdk

v1.1.7

Published

Toolhouse typescript sdk

Readme

Banner

Toolhouse TypeScript SDK

Welcome to the Toolhouse TypeScript SDK documentation. This guide will help you get started with integrating and using the SDK in your project.

Read The Docs GitHub Release Date GitHub last commit NPM Downloads

Tool Use

You can find example code for the following, natively-supported providers below:

Table of Contents

About the API

The Toolhouse API provides access to various AI-powered tools and services, that you can find on Toolhouse.

Setup & Configuration

Supported Language Versions

This SDK is compatible with TypeScript >= 4.8.4.

Installation

To get started with the SDK, we recommend installing it using npm or yarn:

npm install @toolhouseai/sdk

or

yarn add @toolhouseai/sdk

Authentication

The Toolhouse API uses an Access Token for authentication. This token must be provided to authenticate your requests to the API.

To obtain an API Key, register at Toolhouse.

Setting the Access Token

When initializing the SDK, set the access token as follows:

const toolhouse = new Toolhouse({
  apiKey: process.env['TOOLHOUSE_API_KEY']
});

The apiKey is the only mandatory parameter and represents the API key required to authenticate with the tool provider.

You can find working examples in the examples folder for JavaScript and examples folder for Typescript.

Configuration Options

In addition to the apiKey, you can configure the following options:

  • provider: Specifies the provider, such as 'openai', 'anthropic', or 'vercel'. Defaults to 'openai'.
  • baseUrl: Optionally specify the base URL for API requests.
  • timeoutMs: The timeout for API requests, in milliseconds.
  • metadata: Additional metadata to include with requests.

Example:

const toolhouse = new Toolhouse({
  apiKey: process.env['TOOLHOUSE_API_KEY'],
  provider: 'anthropic',
  timeoutMs: 10000,
  metadata: { customField: 'value' }
});

Usage

Here's a basic example demonstrating how to authenticate and retrieve available tools:

import { Toolhouse } from '@toolhouseai/sdk';
import * as dotenv from 'dotenv';

dotenv.config();

async function main() {
  const toolhouse = new Toolhouse({
    apiKey: process.env['TOOLHOUSE_API_KEY']
  });

  const tools = await toolhouse.tools();
  console.log(tools);
}

main();

Services

Methods

tools()

Retrieves a list of public tools available from Toolhouse.

const tools = await toolhouse.tools();
console.log(tools);

getTools()

Fetches tools from a specific provider (OpenAI, Anthropic, or Vercel).

const tools = await toolhouse.getTools('default');
console.log(tools);

runTools()

Executes tools based on the provider and provided content.

const tools = await toolhouse.getTools();
const chatCompletion = await client.chat.completions.create({
  messages,
  model: 'gpt-3.5-turbo',
  tools
});

const openAiMessage = await toolhouse.runTools(chatCompletion);
console.log(openAiMessage);

Accessor Methods

metadata

Retrieve or set the metadata used in tool requests.

console.log(toolhouse.metadata);
toolhouse.metadata = { newKey: 'newValue' };

provider

Retrieve or set the provider for tool requests.

console.log(toolhouse.provider);
toolhouse.provider = 'anthropic';

Error Handling

Wrap API calls in try-catch blocks to handle potential errors:

try {
  const tools = await toolhouse.tools();
} catch (error) {
  console.error(error);
}

License

This SDK is licensed under the Apache-2.0 License. See the LICENSE file for more details.