Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openai-api

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openai-api

A tiny client module for the openAI API

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
increased by34.11%
Maintainers
1
Weekly downloads
 
Created
Source

openai-api

Overview

This package is a tiny wrapper for the openAI API, if you find any issue please feel free to message me or open a PR :).

A few words from GPT-3

If you have any ideas on how to improve the library feel free to let me know as well!

You can also visit the Issue tracker for more information or open a new issue.

This project is not affiliated with OpenAI and was written purely out of interest.

Installation

npm i openai-api

Usage

const OpenAI = require('openai-api');
const OPEN_AI_API_KEY = ####################
const openai = new OpenAI(OPEN_AI_API_KEY);

(async () => {
  await const gptResponse = openai.complete({
    engine: 'davinci',
    prompt: 'this is a test',
    maxTokens: 5,
    temperature: 0.9,
    topP: 1,
    n: 1,
    stream: false,
    stop: '\n'
  });
  
  console.log(gptResponse.data);
})();

(async () => {
  await const gptResponse = openai.search({
    engine: 'davinci',
    documents: ["White House", "hospital", "school"],
    query: "the president"
  });
  
  console.log(gptResponse.data);
})();

Keywords

FAQs

Package last updated on 25 Jul 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc