chatgpt / Exports
- AvailableModerationModels
- ContentType
- ConversationJSONBody
- ConversationResponseEvent
- Message
- MessageActionType
- MessageContent
- MessageFeedbackJSONBody
- MessageFeedbackRating
- MessageFeedbackResult
- MessageFeedbackTags
- MessageMetadata
- Model
- ModelsResult
- ModerationsJSONBody
- ModerationsJSONResult
- OpenAIAuth
- Prompt
- PromptContent
- Role
- SendConversationMessageOptions
- SendMessageOptions
- SessionResult
- User
Ƭ AvailableModerationModels: "text-moderation-playground"
Ƭ ContentType: "text"
Ƭ ConversationJSONBody: Object
https://chat.openapi.com/backend-api/conversation
Name | Type | Description |
---|---|---|
action |
string |
The action to take |
conversation_id? |
string |
The ID of the conversation |
messages |
Prompt [] |
Prompts to provide |
model |
string |
The model to use |
parent_message_id |
string |
The parent message ID |
Ƭ ConversationResponseEvent: Object
Name | Type |
---|---|
conversation_id? |
string |
error? |
string | null |
message? |
Message |
Ƭ Message: Object
Name | Type |
---|---|
content |
MessageContent |
create_time |
string | null |
end_turn |
null |
id |
string |
metadata |
MessageMetadata |
recipient |
string |
role |
string |
update_time |
string | null |
user |
string | null |
weight |
number |
Ƭ MessageActionType: "next"
| "variant"
Ƭ MessageContent: Object
Name | Type |
---|---|
content_type |
string |
parts |
string [] |
Ƭ MessageFeedbackJSONBody: Object
https://chat.openapi.com/backend-api/conversation/message_feedback
Name | Type | Description |
---|---|---|
conversation_id |
string |
The ID of the conversation |
message_id |
string |
The message ID |
rating |
MessageFeedbackRating |
The rating |
tags? |
MessageFeedbackTags [] |
Tags to give the rating |
text? |
string |
The text to include |
Ƭ MessageFeedbackRating: "thumbsUp"
| "thumbsDown"
Ƭ MessageFeedbackResult: Object
Name | Type | Description |
---|---|---|
conversation_id |
string |
The ID of the conversation |
message_id |
string |
The message ID |
rating |
MessageFeedbackRating |
The rating |
text? |
string |
The text the server received, including tags |
user_id |
string |
The ID of the user |
Ƭ MessageFeedbackTags: "harmful"
| "false"
| "not-helpful"
Ƭ MessageMetadata: any
Ƭ Model: Object
Name | Type | Description |
---|---|---|
is_special |
boolean |
Whether or not the model is special |
max_tokens |
number |
Max tokens of the model |
slug |
string |
Name of the model |
Ƭ ModelsResult: Object
https://chat.openapi.com/backend-api/models
Name | Type | Description |
---|---|---|
models |
Model [] |
Array of models |
Ƭ ModerationsJSONBody: Object
https://chat.openapi.com/backend-api/moderations
Name | Type | Description |
---|---|---|
input |
string |
Input for the moderation decision |
model |
AvailableModerationModels |
The model to use in the decision |
Ƭ ModerationsJSONResult: Object
https://chat.openapi.com/backend-api/moderations
Name | Type | Description |
---|---|---|
blocked |
boolean |
Whether or not the input is blocked |
flagged |
boolean |
Whether or not the input is flagged |
moderation_id |
string |
The ID of the decision |
Ƭ OpenAIAuth: Object
Represents everything that's required to pass into ChatGPTAPI
in order
to authenticate with the unofficial ChatGPT API.
Name | Type |
---|---|
clearanceToken |
string |
cookies? |
Record <string , Protocol.Network.Cookie > |
sessionToken |
string |
userAgent |
string |
Ƭ Prompt: Object
Name | Type | Description |
---|---|---|
content |
PromptContent |
The content of the prompt |
id |
string |
The ID of the prompt |
role |
Role |
The role played in the prompt |
Ƭ PromptContent: Object
Name | Type | Description |
---|---|---|
content_type |
ContentType |
The content type of the prompt |
parts |
string [] |
The parts to the prompt |
Ƭ Role: "user"
| "assistant"
Ƭ SendConversationMessageOptions: Omit
<SendMessageOptions
, "conversationId"
| "parentMessageId"
>
Ƭ SendMessageOptions: Object
Name | Type |
---|---|
abortSignal? |
AbortSignal |
action? |
MessageActionType |
conversationId? |
string |
messageId? |
string |
onConversationResponse? |
(response : ConversationResponseEvent ) => void |
onProgress? |
(partialResponse : string ) => void |
parentMessageId? |
string |
timeoutMs? |
number |
Ƭ SessionResult: Object
https://chat.openapi.com/api/auth/session
Name | Type | Description |
---|---|---|
accessToken |
string |
The access token |
error? |
string | null |
If there was an error associated with this request |
expires |
string |
ISO date of the expiration date of the access token |
user |
User |
Authenticated user |
Ƭ User: Object
Name | Type | Description |
---|---|---|
email? |
string |
Email of the user |
features |
string [] |
Features the user is in |
groups |
string [] |
Groups the user is in |
id |
string |
ID of the user |
image |
string |
Image of the user |
name |
string |
Name of the user |
picture |
string |
Picture of the user |
▸ getBrowser(launchOptions?
): Promise
<Browser
>
Launches a non-puppeteer instance of Chrome. Note that in my testing, I wasn't
able to use the built-in puppeteer
version of Chromium because Cloudflare
recognizes it and blocks access.
Name | Type |
---|---|
launchOptions? |
PuppeteerLaunchOptions |
Promise
<Browser
>
▸ getOpenAIAuth(__namedParameters
): Promise
<OpenAIAuth
>
Bypasses OpenAI's use of Cloudflare to get the cookies required to use ChatGPT. Uses Puppeteer with a stealth plugin under the hood.
If you pass email
and password
, then it will log into the account and
include a sessionToken
in the response.
If you don't pass email
and password
, then it will just return a valid
clearanceToken
.
This can be useful because clearanceToken
expires after ~2 hours, whereas
sessionToken
generally lasts much longer. We recommend renewing your
clearanceToken
every hour or so and creating a new instance of ChatGPTAPI
with your updated credentials.
Name | Type |
---|---|
__namedParameters |
Object |
__namedParameters.browser? |
Browser |
__namedParameters.email? |
string |
__namedParameters.password? |
string |
__namedParameters.timeoutMs? |
number |
Promise
<OpenAIAuth
>
▸ markdownToText(markdown?
): string
Name | Type |
---|---|
markdown? |
string |
string