chatgpt / Exports / AChatGPTAPI
-
AChatGPTAPI
• new AChatGPTAPI()
▸ Abstract
closeSession(): Promise
<void
>
Closes the active session.
Throws
An error if it fails.
Promise
<void
>
src/abstract-chatgpt-api.ts:69
▸ Abstract
getIsAuthenticated(): Promise
<boolean
>
Promise
<boolean
>
true
if the client is authenticated with a valid session or false
otherwise.
src/abstract-chatgpt-api.ts:39
▸ 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.
Promise
<void
>
src/abstract-chatgpt-api.ts:10
▸ 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.
Promise
<any
>
Access credentials for the new session.
src/abstract-chatgpt-api.ts:49
▸ 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.
Promise
<any
>
Access credentials for the new session.
src/abstract-chatgpt-api.ts:59
▸ 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
.
Name | Type | Description |
---|---|---|
message |
string |
The prompt message to send |
opts? |
SendMessageOptions |
- |
Promise
<ChatResponse
>
The response from ChatGPT, including conversationId
, messageId
, and
the response
text.