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 🙏

© 2024 – Pkg Stats / Ryan Hefner

stressgpt

v0.1.0

Published

Small tool to stress test your ChatGPT API endpoint.

Downloads

2

Readme

StressGPT

npm version License

StressGPT is a Node.js program for stress testing the OpenAI API (or compatiable ones built locally) using the specified model. It allows you to send multiple concurrent requests to the API and measure the performance.

Installation

npm install stressgpt

Usage

Command Line: stressgpt

The stressgpt command line program is included with the library. You can use it to easily run stress tests from the terminal.

stressgpt [options]

Options:

  • -b, --api-base <api-base>: API base URL (default: https://api.openai.com/v1)
  • -k, --api-key <api-key>: API key (default: $OPENAI_API_KEY)
  • -m, --model <model>: Model ID (default: "text-davinci-003")
  • -t, --concurrent <concurrency>: Number of concurrent requests (default: 1)
  • -c, --count <count>: Number of requests (default: same as concurrency)
  • -p, --prompt-file <prompt-file>: Prompt file (.txt) (default: built-in prompt)
  • -x, --context-length <context-length>: Prefill each conversation with this many tokens (default: 0)
  • --early-stop: Stop when the remaining requests is 0

Library Usage

import StressGPT from 'stressgpt';

// Configure the stress test options
const options = {
  apiBase: 'https://api.openai.com/v1', // The base URL of the OpenAI API
  apiKey: 'YOUR_API_KEY', // Your OpenAI API key
  model: 'text-davinci-003', // The model ID to use (default: "text-davinci-003")
  concurrent: 5, // Number of concurrent requests (default: 1)
  count: 10, // Number of requests (default: same as concurrency)
  promptFile: 'prompt.txt', // Path to the prompt file (default: built-in prompt)
  contextLength: 0, // Prefill each conversation with this many tokens (default: 0)
  earlyStop: true // Stop when the remaining requests is 0 (default: false)
};

// Create an instance of StressGPT
const stressTest = new StressGPT(options);

// Run the stress test
stressTest.run();

// Stop the stress test gracefully on SIGINT (Ctrl+C)
process.on('SIGINT', async () => {
  await stressTest.stop();
  process.exit(0);
});

Options

  • apiBase: (string) The base URL of the OpenAI API. Default is https://api.openai.com/v1.
  • apiKey: (string) Your OpenAI API key.
  • model: (string) The model ID to use. Default is "text-davinci-003".
  • concurrent: (number) Number of concurrent requests. Default is 1.
  • count: (number) Number of requests. Default is the same as concurrent.
  • promptFile: (string) Path to the prompt file. Default is a built-in prompt.
  • contextLength: (number) Prefill each conversation with this many tokens. Default is 0.
  • earlyStop: (boolean) Stop when the remaining requests is 0. Default is false.

License

This project is licensed under the MIT License.