Working with the Anthropic API client
The API client provides the connection to the Anthropic API. Before you can work with it, please first see about Adding an Anthropic API key.
If you stored your API in a file, instantiate the client like this:
client := GtLAnthropicClient withApiKeyFromFile
This is the default mechanism.
If you have the API in the clipboard, you can instead do this:
client := GtLAnthropicClient withApiKeyFromClipboard
This client is your entry point for interacting with Anthropic. 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.
messages := GtLMessagesGroup
withAll: {GtLAnthropicUserMessage new markdown: 'Hello Anthropic! How are you today?'}.
client
generateResponseWithModel: 'claude-haiku-4-5-20251001'
messages: messages
maxTokens: 4096
instructions: nil
tools: nil
andFormat: nil