| Title: | Parse AI Model Names into Vendor, Family and Version |
|---|---|
| Description: | Splits the identifiers and display names that AI labs give their models, such as 'claude-opus-4-1-20250805', 'gpt-4.1-mini' or 'Gemini 3.1 Pro Preview', into vendor, family, version, parameter size, release date and tags. Old and new naming schemes from 'Anthropic', 'OpenAI', 'Google' and 'OpenRouter' land in the same family, so models can be compared and the newest one in a family picked from a list. A port of the 'Go' module 'modelname' <https://pkg.go.dev/github.com/BoNour/modelname>. |
| Authors: | Nour Ayman [aut, cre, cph] |
| Maintainer: | Nour Ayman <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-10-16 17:52:02 UTC |
| Source: | https://github.com/cran/modelname |
Parses AI model identifiers and display names into parts you can compare. It is a port of the ‘Go’ module ‘modelname’, with the same rules and the same test cases.
parse_model does the parsing.
same_family, compare_models and
latest_model build on it.
https://whizi.io/models/ lists the real model names most of the test cases come from.
parse_model("Qwen3.6 35B A3B")parse_model("Qwen3.6 35B A3B")
Orders two models from the same family, oldest first. The version wins,
then the full date, then the short date code. Version parts are compared
as numbers, so "3.10" is newer than "3.9" and
"k3" is newer than "k2.7".
compare_models(a, b)compare_models(a, b)
a, b
|
Character vectors of model identifiers or display names. The shorter one is recycled. |
Comparing across families works but does not mean much:
"gpt-5" against "claude-sonnet-4-5" just compares 5 with
4.5. Check same_family first if that matters.
An integer vector: -1 where a is older, 1 where
a is newer and 0 where the two cannot be told apart.
NA where either input is NA.
compare_models("gemini-3.9-flash", "gemini-3.10-flash") compare_models("claude-opus-4-1-20250901", "claude-opus-4-1-20250805") compare_models("gpt-5", "GPT-5")compare_models("gemini-3.9-flash", "gemini-3.10-flash") compare_models("claude-opus-4-1-20250901", "claude-opus-4-1-20250805") compare_models("gpt-5", "GPT-5")
Returns the newest identifier in ids whose family matches. Handy
for picking a default out of a provider's model list.
latest_model(ids, family)latest_model(ids, family)
ids |
A character vector of model identifiers or display names. |
family |
A single string, the family to look for, as returned in
the |
A single string, the element of ids that is newest according to
compare_models, or NA if no element is in
family. Ties go to the first one in ids.
ids <- c("claude-sonnet-4-5", "claude-3-7-sonnet-20250219", "claude-sonnet-4-6", "gpt-5") latest_model(ids, "claude-sonnet") latest_model(ids, "llama")ids <- c("claude-sonnet-4-5", "claude-3-7-sonnet-20250219", "claude-sonnet-4-6", "gpt-5") latest_model(ids, "claude-sonnet") latest_model(ids, "llama")
Splits AI model identifiers and display names into vendor, family,
version, parameter size, date, date code and tags. API identifiers such
as "gpt-4.1-mini", ‘OpenRouter’ style paths such as
"meta-llama/llama-3.3-70b-instruct:free" and display names such as
"Gemini 3.1 Pro Preview" are all read the same way.
parse_model(x)parse_model(x)
x |
A character vector of model identifiers or display names. Factors are converted to character. |
Parsing is heuristic, not a registry lookup. It never fails: anything
it does not recognise ends up in family, and fields that are not
in the name are left empty. Old and new naming schemes land in the same
family, so "claude-3-5-sonnet-20241022" and
"Claude Sonnet 4.5" both have family "claude-sonnet".
The vendor comes from the prefix before the last / if there is
one, otherwise from the first word of the family. Unknown first words
give an empty vendor.
A data frame with one row per element of x and these columns:
The input, unchanged.
Who makes the model, such as "anthropic" or
"openai", or "" if unknown.
Name words joined with -, such as
"gemini-flash-lite".
Version string, such as "4.5", "4o" or
"k2.7".
Parameter count if given, such as "70b" or
"35b-a3b".
A Date, only set for full dates like
20241022, otherwise NA.
Short date codes like "0731" or "2512".
A list column of character vectors, such as
"preview", "latest", "thinking" or the
":free" suffix.
Missing character fields are "". An NA input gives a row
of NA values.
compare_models, same_family,
latest_model
parse_model("claude-opus-4-1-20250805") m <- parse_model(c("gpt-4.1-mini", "meta-llama/llama-3.3-70b-instruct:free", "Gemini 3.1 Pro Preview")) m[, c("vendor", "family", "version", "size")] m$tagsparse_model("claude-opus-4-1-20250805") m <- parse_model(c("gpt-4.1-mini", "meta-llama/llama-3.3-70b-instruct:free", "Gemini 3.1 Pro Preview")) m[, c("vendor", "family", "version", "size")] m$tags
Parses both arguments with parse_model and compares their
family columns.
same_family(a, b)same_family(a, b)
a, b
|
Character vectors of model identifiers or display names. The shorter one is recycled. |
A logical vector, TRUE where the two names parse to the same
family. NA where either input is NA.
same_family("claude-3-5-sonnet-20241022", "Claude Sonnet 4.5") same_family("gpt-4.1-mini", c("GPT-5.4 Mini", "gpt-4.1"))same_family("claude-3-5-sonnet-20241022", "Claude Sonnet 4.5") same_family("gpt-4.1-mini", c("GPT-5.4 Mini", "gpt-4.1"))