Claudio.Models (Claudio v0.6.0)

View Source

Anthropic Models API client.

Discover available Claude models and their capabilities at runtime. GA — no beta header required.

Example

client = Claudio.Client.new(%{token: "sk-ant-...", version: "2023-06-01"})

{:ok, %{"data" => models}} = Claudio.Models.list(client, limit: 20)
{:ok, model} = Claudio.Models.get(client, "claude-opus-4-8")

Summary

Functions

Retrieves a single model by id or alias.

Lists available models (most recently released first), paginated.

Functions

get(client, model_id)

@spec get(Req.Request.t(), String.t()) ::
  {:ok, map()} | {:error, Claudio.APIError.t() | term()}

Retrieves a single model by id or alias.

Parameters

Returns

  • {:ok, %{"id" => _, "type" => "model", "display_name" => _, "created_at" => _}} on success (may also include max_input_tokens / max_tokens / capabilities).
  • {:error, %Claudio.APIError{}} on a non-200 response.
  • {:error, term()} on a transport/Req error.

list(client, opts \\ [])

@spec list(
  Req.Request.t(),
  keyword()
) :: {:ok, map()} | {:error, Claudio.APIError.t() | term()}

Lists available models (most recently released first), paginated.

Parameters

  • client — A Req.Request from Claudio.Client.new/2.
  • opts — Optional keyword list:
    • :limit — Number of models to return (default server-side: 20).
    • :before_id — Cursor for the previous page (model id).
    • :after_id — Cursor for the next page (model id).

Returns

  • {:ok, %{"data" => [...], "first_id" => _, "last_id" => _, "has_more" => _}} on success.
  • {:error, %Claudio.APIError{}} on a non-200 response.
  • {:error, term()} on a transport/Req error.