Skip to contents

Searches the merged model catalog: the shipped snapshot (models.dev, MIT, with gptr's reviewed corrections, aliases and defaults), a refreshed copy in tools::R_user_dir("gptr", "cache"), models declared by registered providers, user configuration and provider inventories. A refresh keeps gptr's reviewed data. Offline by default: only refresh = TRUE touches the network.

Usage

gptr_models(query = NULL, provider = NULL, refresh = FALSE)

Arguments

query

NULL or a regular expression or alias (for example "sonnet"), matched against the reference, the name and the aliases; the model an alias resolves to is listed first.

provider

NULL or a provider id (for example "anthropic").

refresh

TRUE with provider = NULL downloads the models.dev catalog with ETag revalidation into the user cache. With a provider it asks that provider's model-list API (or registered discover() callback), using its configured credentials after the normal egress and replay checks. API discovery is bounded to four pages, four seconds total and one second per request. A failed listing keeps prior models and reports the failed refresh in the footer. A provider with neither (Bedrock Converse, an offline provider) is not contacted. For claude-cli and codex it asks the CLI, as above, within 15 seconds. For Ollama it uses native /api/version, /api/tags and /api/show endpoints with a one second limit per request. Ollama discovery requires a loopback address under the default local-only policy; only an explicit human setting at user or session scope can relax it (see gptr_config()). The only network use of this function; it never starts or installs a server and never downloads a model.

Value

A gptr_models data frame with columns ref, provider, name, context, max_output, input_price, output_price (USD per million tokens, selected for today's date from the available catalog; 0 for verified local inference, NA when unknown), reasoning (NA when unknown), aliases, status, availability (unknown, advertised, unlisted, or the latter two with (stale)) and checked_at (UTC time of the last successful provider listing, NA when none). Unlisted models remain in the catalog. Catalog prices can be stale and are not an account quote.

Details

An alias such as sonnet, gpt or gemini names the newest active model of its models.dev family; on a release-date tie the shortest id wins. Any provider/id of a known provider is accepted: an id the catalog lacks is sent as written, with one notice, and gets only what a name can tell: tool calls on a remote chat or command-line route (none on a local server), text input, no thinking level, unknown limits and price. Declare its real capabilities in the provider's models setting (gptr_config()) or with gptr_provider(). A name without a provider that is neither a catalog id nor an alias is refused with the closest catalog references as suggestions; gptr never runs a similar model in its place.

A catalog entry describes a route, not current account access. availability records what the last provider listing advertised, with its checked_at time; it does not verify inference or billing access. Failed or expired listings are marked stale and keep the previous models. Providers other than Ollama with a native model-list API are inventoried before use after consent, at most once per five minutes in this R process; refresh = TRUE bypasses that cache. Their listings also give thinking levels, temperature support and retirement where the provider reports them. A discover() callback runs with refresh = TRUE.

The claude-cli and codex routes ask your installed CLI which models it offers and which one it starts with: Claude Code through its stream-json initialize and get_settings control requests, Codex through codex app-server (model/list, config/read), else codex debug models. No prompt is sent and no tokens are spent. Claude Code's probe starts with your settings, which name the model it starts with, so their SessionStart hooks run; tools and slash commands stay off. gptr asks once per R session and CLI version, when a run starts or at /model, and again with refresh = TRUE, so a CLI update changes the list without a gptr release. The default row runs the model your CLI starts with and names it (default (claude-opus-5-5)); when the CLI cannot say, gptr passes no model flag and the CLI chooses.

Copy a ref into the model argument of peter() to choose that route. Ollama routes require current installed model evidence before inference; discovery does not pull models. See vignette("language-models", package = "gptr") for setup and gptr_providers() for credentials and reachability.

Examples

gptr_models("sonnet")
#> # Columns 1/2
#>    name                            ref
#>  1 Claude Sonnet 5.5               anthropic/claude-sonnet-5-5
#>  2 Claude Sonnet 4.6               anthropic/claude-sonnet-4-6
#>  3 Claude Sonnet 5                 anthropic/claude-sonnet-5
#>  4 Claude Sonnet 4.6               azure/claude-sonnet-4-6
#>  5 Claude Sonnet 5                 azure/claude-sonnet-5
#>  6 Claude Sonnet 5.5               azure/claude-sonnet-5-5
#>  7 Claude Sonnet 4.6               bedrock/anthropic.claude-sonnet-4-6
#>  8 Claude Sonnet 5                 bedrock/anthropic.claude-sonnet-5
#>  9 Claude Sonnet 5.5               bedrock/anthropic.claude-sonnet-5-5
#> 10 AU Anthropic Claude Sonnet 4.6  bedrock/au.anthropic.claude-sonnet-4-6
#> 11 Claude Sonnet 5 (AU)            bedrock/au.anthropic.claude-sonnet-5
#> 12 Claude Sonnet 5.5 (AU)          bedrock/au.anthropic.claude-sonnet-5-5
#> 13 Claude Sonnet 5.5 (Canada)      bedrock/ca.anthropic.claude-sonnet-5-5
#> 14 Claude Sonnet 4.6 (EU)          bedrock/eu.anthropic.claude-sonnet-4-6
#> 15 Claude Sonnet 5 (EU)            bedrock/eu.anthropic.claude-sonnet-5
#> 16 Claude Sonnet 5.5 (EU)          bedrock/eu.anthropic.claude-sonnet-5-5
#> 17 Claude Sonnet 4.6 (Global)      bedrock/global.anthropic.claude-sonnet-4-6
#> 18 Claude Sonnet 5 (Global)        bedrock/global.anthropic.claude-sonnet-5
#> 19 Claude Sonnet 5.5 (Global)      bedrock/global.anthropic.claude-sonnet-5-5
#> 20 Claude Sonnet 5 (India)         bedrock/in.anthropic.claude-sonnet-5
#> # Columns 2/2
#>    status  provider   availability  checked_at  context  max_output  input_price
#>  1 active  anthropic  unknown       NA          1000000  128000      2.0
#>  2 active  anthropic  unknown       NA          1000000  128000      3.0
#>  3 active  anthropic  unknown       NA          1000000  128000      2.0
#>  4 active  azure      unknown       NA          1000000  128000      3.0
#>  5 active  azure      unknown       NA          1000000  128000      2.0
#>  6 active  azure      unknown       NA          1000000  128000      2.0
#>  7 active  bedrock    unknown       NA          1000000  128000      3.3
#>  8 active  bedrock    unknown       NA          1000000  128000      2.2
#>  9 active  bedrock    unknown       NA          1000000  128000      2.2
#> 10 active  bedrock    unknown       NA          1000000  128000      3.3
#> 11 active  bedrock    unknown       NA          1000000  128000      2.2
#> 12 active  bedrock    unknown       NA          1000000  128000      2.2
#> 13 active  bedrock    unknown       NA          1000000  128000      2.2
#> 14 active  bedrock    unknown       NA          1000000  128000      3.3
#> 15 active  bedrock    unknown       NA          1000000  128000      2.2
#> 16 active  bedrock    unknown       NA          1000000  128000      2.2
#> 17 active  bedrock    unknown       NA          1000000  128000      3.0
#> 18 active  bedrock    unknown       NA          1000000  128000      2.0
#> 19 active  bedrock    unknown       NA          1000000  128000      2.0
#> 20 active  bedrock    unknown       NA          1000000  128000      2.2
#> # Other columns: output_price, reasoning, aliases
#> 
#> # 20 of 29 rows shown; as.data.frame() lists all
#> catalog 2026-11-26 (models.dev (MIT)), 709 models; refresh = TRUE updates it;
#> advertised does not verify access
gptr_models(provider = "anthropic")
#> # Columns 1/2
#>    name                       ref                                  status
#>  1 Claude Fable 5             anthropic/claude-fable-5             active
#>  2 Claude Fable 5.1           anthropic/claude-fable-5-1           active
#>  3 Claude Fable 5.2           anthropic/claude-fable-5-2           active
#>  4 Claude Haiku 4.5 (latest)  anthropic/claude-haiku-4-5           active
#>  5 Claude Haiku 4.5           anthropic/claude-haiku-4-5-20251001  active
#>  6 Claude Haiku 5.5           anthropic/claude-haiku-5-5           active
#>  7 Claude Mythos 5.2          anthropic/claude-mythos-5-2          preview
#>  8 Claude Opus 4.6            anthropic/claude-opus-4-6            active
#>  9 Claude Opus 4.7            anthropic/claude-opus-4-7            active
#> 10 Claude Opus 4.8            anthropic/claude-opus-4-8            active
#> 11 Claude Opus 5              anthropic/claude-opus-5              active
#> 12 Claude Opus 5.5            anthropic/claude-opus-5-5            active
#> 13 Claude Sonnet 4.6          anthropic/claude-sonnet-4-6          active
#> 14 Claude Sonnet 5            anthropic/claude-sonnet-5            active
#> 15 Claude Sonnet 5.5          anthropic/claude-sonnet-5-5          active
#> # Columns 2/2
#>    provider   availability  checked_at  context  max_output  input_price
#>  1 anthropic  unknown       NA          1000000  128000      10.0
#>  2 anthropic  unknown       NA          1000000  128000      10.0
#>  3 anthropic  unknown       NA          1000000  128000      8.0
#>  4 anthropic  unknown       NA          200000   64000       1.0
#>  5 anthropic  unknown       NA          200000   64000       1.0
#>  6 anthropic  unknown       NA          1000000  128000      0.1
#>  7 anthropic  unknown       NA          1000000  128000      8.0
#>  8 anthropic  unknown       NA          1000000  128000      5.0
#>  9 anthropic  unknown       NA          1000000  128000      5.0
#> 10 anthropic  unknown       NA          1000000  128000      5.0
#> 11 anthropic  unknown       NA          1000000  128000      5.0
#> 12 anthropic  unknown       NA          1000000  128000      4.0
#> 13 anthropic  unknown       NA          1000000  128000      3.0
#> 14 anthropic  unknown       NA          1000000  128000      2.0
#> 15 anthropic  unknown       NA          1000000  128000      2.0
#> # Other columns: output_price, reasoning, aliases
#> 
#> # 15 rows
#> catalog 2026-11-26 (models.dev (MIT)), 709 models; refresh = TRUE updates it;
#> advertised does not verify access