Skip to contents

Use this whenever the shipped registry is stale or you are pointing the client at a compatible non-OpenAI endpoint. Registered entries take precedence over everything built in.

Usage

gr_register_model(
  id,
  context_window,
  max_output,
  input_usd = NA_real_,
  output_usd = NA_real_,
  reasoning = FALSE,
  supports_temperature = TRUE,
  kind = c("chat", "embedding"),
  dimensions = NA_integer_
)

Arguments

id

Model id string, exactly as the API expects it.

context_window

Total context window in tokens.

max_output

Maximum tokens the model will emit in one response.

input_usd, output_usd

Price per 1M tokens; used for cost estimates.

reasoning

Whether this is a reasoning model (affects prompt shape).

supports_temperature

Whether the API accepts temperature.

kind

"chat" or "embedding".

dimensions

Embedding dimensionality, for kind = "embedding".

Value

Invisibly, id.

Examples

gr_register_model("my-local-llama", context_window = 32768, max_output = 4096)
gr_model_info("my-local-llama")[c("context_window", "source", "certain")]
#> $context_window
#> [1] 32768
#> 
#> $source
#> [1] "registered"
#> 
#> $certain
#> [1] TRUE
#> 

# Without prices, the cost cap cannot be checked; readgpt says so rather
# than assuming the run is free.
is.na(gr_estimate_cost("my-local-llama", 1000, 500))
#> [1] TRUE