package anthropic
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Anthropic.Models
Source
Models API for querying available Claude models.
This module provides functions to retrieve information about available models and their capabilities.
Source
type t = {
id : string;
(*Unique model identifier.
*)created_at : string;
(*ISO 8601 timestamp of model creation.
*)display_name : string;
(*Human-readable model name.
*)type_ : string;
(*Model type (e.g., "chat").
*)
}
t
contains metadata about an available model.
get client ~model_id ()
retrieves information about a specific model.
Example: Gets details about a specific model.
match Models.get client ~model_id:"claude-3-5-sonnet-20241022" () with
| Ok model ->
Printf.printf "Model %s created at %s\n" model.display_name
model.created_at
| Error e -> Printf.eprintf "Error: %s\n" (string_of_error e)
list client ?limit ?after_id ()
retrieves a paginated list of available models.
Example: Lists all available models.
let rec print_models page =
List.iter
(fun m -> Printf.printf "- %s (%s)\n" m.display_name m.id)
page.data;
match page.get_next_page () with
| Some (Ok next) -> print_models next
| Some (Error e) ->
Printf.eprintf "Pagination error: %s\n" (string_of_error e)
| None -> ()
in
match Models.list client () with
| Ok page -> print_models page
| Error e -> Printf.eprintf "Error: %s\n" (string_of_error e)