Request a list of available model names from Google. See endpoint reference for response details.
Submit a single text prompt to Google Gemini, and return only the message generated. Convenience method for single request prompts.
Text prompt to submit
Optionalmodel: stringDefault: "models/gemini-pro". If you wish to target other models available to your API key, you can override this value.
OptionalcredentialOptional 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 Google AI credentials. If you have the need to store multiple API Keys, you can set an alternate identifier for use with the Credential system. Default: Google AI
API Version to target. Defaults to v1, but v1beta also supported and provides access to beta features and models. See Google's reference for details.
Default: v1
OptionallastIf a function fails, this property will contain the last error as a string message, otherwise it will be undefined.
If a function succeeds, this property will contain the last response returned.
Time in seconds to wait for a request to receive a response from the server. Default: 120 seconds.
Execute a request against the Google Gemini API. For successful requests, the HTTPResponse object will contain an object or array or objects decoded from the JSON returned by Google Gemini as appropriate to the request made. Refer to Google Gemini API documentation for details about the expected parameters and responses.
Optionaldata?: { [x: string]: string }An object containing data to be encoded into the HTTP body of the request. Drafts will take care of the JSON conversion.
Optionalheaders?: { [x: string]: string }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.
Optionalmodel?: stringThe name of a model available to your API key. Defaults: models/gemini-pro
Optionalparameters?: { [x: string]: string }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 Google Gemini API.
StaticcreateCreates a new GoogleAI object.
OptionalapiKey: stringA valid Google Gemini API Key. This value is optional, and if not provided, the default Google AI 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.
Script integration with Google's Gemini AI API. This object offers convenience over direct HTTP requests by:
Example
Translation