v2026.11.2
All Bundles
Bundle

Anthropic Messages API client (Claude). Plain and multi-turn chat with a system prompt, tool use, streaming over server-sent events, structured (JSON) output through a forced tool, and extended-thinking blocks. Responses and errors follow the other AI client libraries: a failed call returns Nil and EndPoint->GetLastError() says why. The key comes from SetApiKey, the ANTHROPIC_API_KEY environment variable, or anthropic_api_key.dat in the working directory. Requests go over HTTPS. Compile with -lib anthropic.

Tool

A tool the model may call: a name, a description and a JSON schema for its input

Operations

GetName #

Get the tool name

method : public : GetName() ~ String

Return

TypeDescription
Stringtool name

New # constructor

Constructor

New(name:String, description:String, schema:JsonElement)

Parameters

NameTypeDescription
nameStringtool name
descriptionStringwhat the tool does, for the model
schemaJsonElementJSON schema of the input, an object: {"type":"object","properties":{...},"required":[...]}

New # constructor

Constructor from a function definition, the form the other AI client libraries use

New(func:FunctionType)

Parameters

NameTypeDescription
funcFunctionTypefunction definition

ToJson #

Converts the tool to JSON for the request

method : public : ToJson() ~ JsonElement

Return

TypeDescription
JsonElementJSON element