Working with the Gemini API client
The API client provides the connection to the Gemini API. Before you can work with it, please first see about Adding a Gemini API key.
If you stored your API in a file, instantiate the client like this:
client := GtGeminiClient withApiKeyFromFile
This is the default mechanism.
If you have the API in the clipboard, you can instead do this:
client := GtGeminiClient withApiKeyFromClipboard
This client is your entry point for interacting with Gemini. You can for instance use it to query the list of models.
client listModels
You can even use it to interact with the chat feature directly. Note that it doesn’t return a message object directly, but a metaobject containing one or more messages.
messages := { GtLlmUserMessage new content: 'Hello Gemini! How are you today?' }. client generateContents: messages withModel: 'gemini-2.0-flash'