ai.Client

interface in the ai package.

Reference version

Signature

interface ai.Client

Source:<builtin>/ai/turn.bamlbytes 3048–4378

Required instance methods

function

requested_model

(self) -> string throws never

The model this client asks for, as configured ("claude-sonnet-4-5"). A wrapper reports a member's.

function

provider

(self) -> string throws never

The provider this client's calls bill ("anthropic"), as its ModelKeys name it. A wrapper reports a member's.

function

render

(self, input: ai.ModelTurnInput) -> baml.http.Request throws ai.errors.InvokeError

Render the provider request shape without performing I/O. Reliability wrappers use this as a stable request-shape preview: they do not sleep, rotate, or try fallback members while rendering.

Default instance methods

function

default_cache_args

(self) -> baml.json.json throws never

The args this client uses for a ${cache()} written with none (or with null): the object its wire's cache marker carries. Null when the client has no cache marker on its wire, or when the model it is configured for would reject one; a ${cache()} then sends nothing.

A client that sends cache markers passes this to ai.wire.prompt_parts(message, default_cache_args).