Module core/openai/HttpOpenAiClient

Overview

A zero dep TypeScript client library for interacting with the OpenAI API.

This client provides methods for calling the OpenAI API's endpoints for text completion, language generation, and other tasks.

To create an OpenAiClient, use the create method.

The OpenAiClient's methods return Promises that resolve to the JSON response returned by the OpenAI API. If the OpenAI API returns an error, the Promise will be rejected with an instance of an HttpError that includes the error message and HTTP status code.

const openai = OpenAiClient.create();

openai.getCompletion(...)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

See

https://beta.openai.com/docs/quickstart

Index

Classes

Variables

Generated using TypeDoc