ReqAnthropic.Models (ReqAnthropic v0.2.1)

Copy Markdown View Source

The Models API: list available Claude models, retrieve a specific model, and look up per-model capabilities.

Results are cached in an ETS table owned by the application supervisor. Pass cache: false to bypass the cache. Configure the TTL with config :req_anthropic, models_cache_ttl: :timer.hours(2).

Summary

Functions

Return the static capabilities table for a model id (or %Model{} struct).

Drop everything from the cache.

Retrieve a single model by id.

Same as get/2 but raises on error.

List all models available to your API key. Paginates the API transparently and returns a list of %ReqAnthropic.Model{}.

Same as list/1 but raises on error.

Functions

capabilities(id)

Return the static capabilities table for a model id (or %Model{} struct).

clear_cache()

@spec clear_cache() :: :ok

Drop everything from the cache.

get(id, opts \\ [])

@spec get(
  String.t(),
  keyword()
) ::
  {:ok, ReqAnthropic.Model.t()}
  | {:error, ReqAnthropic.Error.t() | Exception.t()}

Retrieve a single model by id.

get!(id, opts \\ [])

@spec get!(
  String.t(),
  keyword()
) :: ReqAnthropic.Model.t()

Same as get/2 but raises on error.

list(opts \\ [])

@spec list(keyword()) ::
  {:ok, [ReqAnthropic.Model.t()]}
  | {:error, ReqAnthropic.Error.t() | Exception.t()}

List all models available to your API key. Paginates the API transparently and returns a list of %ReqAnthropic.Model{}.

list!(opts \\ [])

@spec list!(keyword()) :: [ReqAnthropic.Model.t()]

Same as list/1 but raises on error.