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

@copyeval/sdk

v0.2.1

Published

Open SDK for logging LLM feature input/output to a copyeval record store.

Downloads

449

Readme

@copyeval/sdk

Open SDK for logging LLM feature input/output to a copyeval record store. One call persists an interaction — the prompt, the completion, and optional model, usage, cost, and free-form metadata — scoped to your project by an API key.

  • Zero dependencies. Uses the platform fetch; runs on Node 18+, browsers, and edge runtimes.
  • Two entry points. log() is the honest primitive; trace() wraps a call and captures its latency and outcome for you.
  • Never breaks your app. trace() swallows logging failures (routed to onError) so telemetry can't take down the call it's observing.

Install

npm install @copyeval/sdk

Quick start

import { CopyevalClient } from "@copyeval/sdk";

const copyeval = new CopyevalClient({
  apiKey: process.env.COPYEVAL_API_KEY, // cev_… — a project-scoped key
});

await copyeval.log({
  input: { prompt: "Summarize this ticket…" },
  output: "The customer can't reset their password.",
  model: "claude-opus-4-8",
  inputTokens: 812,
  outputTokens: 24,
  costUsd: 0.0043,
  metadata: { feature: "ticket-summary", userId: "u_123" },
});

apiKey falls back to COPYEVAL_API_KEY when omitted, so in most apps new CopyevalClient() is enough. Requests go to the copyeval production API by default — you never configure the base URL.

trace() — log a call automatically

Wrap the LLM call and the SDK records its input, output, latency, and terminal status (ok / error) for you. Your result passes through unchanged; if the call throws, the error is logged and re-thrown as-is.

const summary = await copyeval.trace(
  { input: messages, model: "claude-opus-4-8" },
  () => callTheModel(messages),
);

Pull usage and cost off the provider response with onResult:

const message = await copyeval.trace(
  {
    input: messages,
    model: "claude-opus-4-8",
    onResult: (res) => ({
      output: res.content,
      inputTokens: res.usage.input_tokens,
      outputTokens: res.usage.output_tokens,
    }),
  },
  () => anthropic.messages.create({ model: "claude-opus-4-8", messages, max_tokens: 1024 }),
);

API

new CopyevalClient(options)

| Option | Type | Default | Notes | | ----------- | --------------------------- | ------------------------------ | ------------------------------------------------------------ | | apiKey | string | COPYEVAL_API_KEY | Project-scoped key (cev_…). Required. | | baseUrl | string | https://api.copyeval.com | Rarely set — falls back to COPYEVAL_BASE_URL, else the production API. | | fetch | FetchLike | global fetch | Supply one where there's no global fetch. | | timeoutMs | number | 10000 | Per-request timeout. | | onError | (error: unknown) => void | warns on console | Where trace() sends a logging failure. |

client.log(entry): Promise<LoggedRecord>

Persists one record and returns it. input and output are required and may be any JSON value; every other field is optional. Throws CopyevalError on failure.

client.trace(options, fn): Promise<T>

Runs fn, logs the outcome (awaited, so the record is durable even in a short-lived process), and returns fn's result. A logging failure goes to onError and never surfaces to your caller.

CopyevalError

Thrown by log(). Carries status (HTTP status) and code (the server's machine code, e.g. unauthorized, invalid_input) when available.

How it maps to the record store

The SDK is a thin, typed wrapper over one endpoint — POST {baseUrl}/records with Authorization: Bearer cev_…. The key is project-scoped, so the record is attached to that key's project; you never send a project id. Reads (GET /records) are a separate, session-authenticated console path — this SDK only writes. See @copyeval/api for the full record contract and how to mint a key.

License

MIT