# openpipe-dev

> Metrics and auto-evaluation for LLM calls

Latest version **0.3.6-beta.1** (published 2023-09-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install openpipe-dev
pnpm add openpipe-dev
yarn add openpipe-dev
bun add openpipe-dev
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.6-beta.1 |
| Published | 2023-09-08 |
| First published | 2023-09-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 419.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | davidlcorbitt |

## Links

- npm: https://www.npmjs.com/package/openpipe-dev
- npm.io page: https://npm.io/package/openpipe-dev

## Dependencies (6)

- [encoding](https://npm.io/package/encoding.md) ^0.1.13
- [form-data](https://npm.io/package/form-data.md) ^4.0.0
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.21
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.12
- [openai-beta](https://npm.io/package/openai-beta.md) npm:openai@4.0.0-beta.7
- [openai-legacy](https://npm.io/package/openai-legacy.md) npm:openai@3.3.0

## Recent versions

- 0.3.6-beta.1 (latest) — 2023-09-08
- 0.3.6-beta.2 (beta) — 2023-09-08

## README

# OpenPipe Node API Library

[![NPM version](https://img.shields.io/npm/v/openpipe.svg)](https://npmjs.org/package/openpipe)

This library wraps TypeScript or Javascript OpenAI API calls and logs additional data to the configured `OPENPIPE_BASE_URL` for further processing.

It is fully compatible with OpenAI's sdk and logs both streaming and non-streaming requests and responses.

<!-- To learn more about using OpenPipe, check out our [Documentation](https://docs.openpipe.ai/docs/api). -->

## Installation

```sh
npm install --save openpipe
# or
yarn add openpipe
```

## Usage

1. Create a project at https://app.openpipe.ai
2. Find your project's API key at https://app.openpipe.ai/project/settings
3. Configure the OpenPipe client as shown below.

```js
// import OpenAI from 'openai'
import OpenAI from "openpipe/openai";

// Fully compatible with original OpenAI initialization
const openai = new OpenAI({
  apiKey: "my api key", // defaults to process.env["OPENAI_API_KEY"]
  // openpipe key is optional
  openpipe: {
    apiKey: "my api key", // defaults to process.env["OPENPIPE_API_KEY"]
    baseUrl: "my url", // defaults to process.env["OPENPIPE_BASE_URL"] or https://app.openpipe.ai/api/v1 if not set
  },
});

async function main() {
  // Allows optional openpipe object
  const completion = await openai.chat.completions.create({
    messages: [{ role: "user", content: "Say this is a test" }],
    model: "gpt-3.5-turbo",
    // optional
    openpipe: {
      // Add custom searchable tags
      tags: {
        prompt_id: "getCompletion",
        any_key: "any_value",
      },
    },
  });

  console.log(completion.choices);
}

main();
```

## FAQ

<b><i>How do I report calls to my self-hosted instance?</i></b>

Start an instance by following the instructions on [Running Locally](https://github.com/OpenPipe/OpenPipe#running-locally). Once it's running, point your `OPENPIPE_BASE_URL` to your self-hosted instance.

<b><i>What if my `OPENPIPE_BASE_URL` is misconfigured or my instance goes down? Will my OpenAI calls stop working?</i></b>

Your OpenAI calls will continue to function as expected no matter what. The sdk handles logging errors gracefully without affecting OpenAI inference.

See the [GitHub repo](https://github.com/OpenPipe/OpenPipe) for more details.

---
_Source: https://npm.io/package/openpipe-dev · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
