Skip to content

Latest commit

 

History

History
167 lines (90 loc) · 3.41 KB

AChatGPTAPI.md

File metadata and controls

167 lines (90 loc) · 3.41 KB

chatgpt / Exports / AChatGPTAPI

Class: AChatGPTAPI

Hierarchy

Table of contents

Constructors

Methods

Constructors

constructor

new AChatGPTAPI()

Methods

closeSession

Abstract closeSession(): Promise<void>

Closes the active session.

Throws

An error if it fails.

Returns

Promise<void>

Defined in

src/abstract-chatgpt-api.ts:69


getIsAuthenticated

Abstract getIsAuthenticated(): Promise<boolean>

Returns

Promise<boolean>

true if the client is authenticated with a valid session or false otherwise.

Defined in

src/abstract-chatgpt-api.ts:39


initSession

Abstract initSession(): Promise<void>

Performs any async initialization work required to ensure that this API is properly authenticated.

Throws

An error if the session failed to initialize properly.

Returns

Promise<void>

Defined in

src/abstract-chatgpt-api.ts:10


refreshSession

Abstract refreshSession(): Promise<any>

Refreshes the current ChatGPT session.

Useful for bypassing 403 errors when Cloudflare clearance tokens expire.

Throws

An error if it fails.

Returns

Promise<any>

Access credentials for the new session.

Defined in

src/abstract-chatgpt-api.ts:49


resetSession

resetSession(): Promise<any>

Closes the current ChatGPT session and starts a new one.

Useful for bypassing 401 errors when sessions expire.

Throws

An error if it fails.

Returns

Promise<any>

Access credentials for the new session.

Defined in

src/abstract-chatgpt-api.ts:59


sendMessage

Abstract sendMessage(message, opts?): Promise<ChatResponse>

Sends a message to ChatGPT, waits for the response to resolve, and returns the response.

If you want to receive a stream of partial responses, use opts.onProgress.

Parameters

Name Type Description
message string The prompt message to send
opts? SendMessageOptions -

Returns

Promise<ChatResponse>

The response from ChatGPT, including conversationId, messageId, and the response text.

Defined in

src/abstract-chatgpt-api.ts:30