
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
openai-api-node
Advanced tools
A simple node wrapper for the OpenAI API.
The API itself and this package are meant for development and research use only. Don't use this in production.
If you don't have an API key, you need to request it at (openai.com)[https://beta.openai.com/]
$ npm install openai-api-node
Quick start with a new completion:
const OpenAIAPI = require('../lib/openaiapi'); var openai = new OpenAIAPI("YOUR API KEY HERE") openai.CompletionsCreate("your starting prompt") .then(function(data) { //Do something with the data. }) .catch(function(err) { //The API returned an error }) })
You will get an object similar to the following:
{ id: 'cmpl-yyyyyyyyyyy', object: 'text_completion', created: 1596217113, model: 'davinci:2020-05-03', choices: [ { text: '” problem for me', index: 0, logprobs: null, finish_reason: 'length' } ] }
You will need an API key to initialize the object. You can also pass the following parameters:
$ var openai = new OpenAIAPI("YOUR API KEY HERE", apiBase = "api.openai.com", version = "v1")
CompletionsCreate accepts the following parameters. Only the first parameter is required:
$ CompletionsCreate(prompt, max_tokens=5, engine="davinci", options={})
You can also pass additional options as an object
Make a pull request :)
We are using mocha to run a basic test. To pass the test, you need to put your api key in test/completions.js
FAQs
A NodeJS client for the OpenAI API
The npm package openai-api-node receives a total of 33 weekly downloads. As such, openai-api-node popularity was classified as not popular.
We found that openai-api-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.