Submit a single text prompt to ChatGPT conversations endpoint, and return only the message generated. Convenience method for single request prompts.
Text prompt to submit to ChatGPT
Optional
options: objectOptional key-value object specifying other options to include with the request, see Completion docs for supported options. Default model
value is gpt-3.5-turbo
Submit a single text input and instructions to the Edits endpoint, using the code-davinci-edit-001
model to generate code or refactor, and return only the message generated.
Text input to submit, generally used only if you are instruction the model to refactor existing code.
Instructions to model
Optional
options: objectOptional key-value object specifying other options to include with the request, see Edit docs for supported options. Default model
value is text-davinci-edit-001
Submit a single text input and instructions to the Edits endpoint, using the text-davinci-edit-001
model, and return only the message generated. Convenience method for single request input.
Text input to submit
Instructions to model
Optional
options: objectOptional key-value object specifying other options to include with the request, see Edit docs for supported options. Default model
value is text-davinci-edit-001
Optional
credentialOptional identifier for API Key credentials. If an API Key is not provided as a parameter when instantiating the object, the user will be prompted to enter one of the first time they run an action requiring it. By default, these will be stored as OpenAI
credentials. If you have the need to store multiple API Keys, or use the action with alternate compatible host services (like Perplexity.ai), you can set an alternate identifier for use with the Credential system. Default: OpenAI
Name of the model to use. Model can also be passed as a parameter in requests, but settings this to a supported model will make it the default model for requests using this instance. Default: gpt-3.5-turbo
Time in seconds to wait for a request to receive a response from the server. Default: 120 seconds.
Execute a request against the OpenAI API. For successful requests, the HTTPResponse object will contain an object or array or objects decoded from the JSON returned by OpenAI as appropriate to the request made. Refer to OpenAI API documentation for details about the expected parameters and responses.
Optional
data?: { An object containing data to be encoded into the HTTP body of the request. Drafts will take care of the JSON conversion.
Optional
headers?: { An object contain key-values to be added as custom headers in the request. There is no need to provide authorization headers, Drafts will add those.
The HTTP method, like "GET", "POST", etc.
Optional
parameters?: { An object containing key-values to be added to the request as URL parameters. Drafts will take care of encoding these.
The path to the API endpoint in the OpenAI API. This should include the path after the API version. For example /chat/completion
Static
createCreates a new OpenAI object.
Optional
apiKey: stringA valid OpenAI API Key. This value is optional, and if not provided, the default OpenAPI API key stored in Credentials will be used, or the user prompted to provide an API Key to store. Only provide a specific API Key if you desire to override the default.
Optional
host: stringOptionally provide the API endpoint URL for any OpenAI API compatible endpoint, such as a custom Azure AI instance, or Perplexity.ai API. Defaults to https://api.openai.com
Script integration with OpenAI API. This object offers convenience over direct HTTP requests by:
Example
Translation
Direct API Request