View Source Anthropic.Models (anthropic_community v0.5.0)
The Models resource: list and retrieve available Claude models.
Summary
Types
@type list_opts() :: [ before_id: String.t(), after_id: String.t(), limit: pos_integer() ]
Functions
@spec list(Anthropic.Client.t(), list_opts()) :: {:ok, list_result()} | {:error, Anthropic.Error.t()}
Lists available models, most recently released first.
Examples
{:ok, %{data: models}} = Anthropic.Models.list(client)
@spec list_all(Anthropic.Client.t(), list_opts()) :: Enumerable.t()
Like list/2, but returns a lazy Stream of individual model maps that transparently
fetches subsequent pages as it's consumed, instead of one page at a time.
Examples
client
|> Anthropic.Models.list_all()
|> Enum.each(&IO.puts(&1["id"]))
@spec retrieve(Anthropic.Client.t(), model_id :: String.t()) :: {:ok, map()} | {:error, Anthropic.Error.t()}
Retrieves a single model by id.