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_,
  cached_input_usd = NA_real_
)

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. Give both or neither for a chat model: one without the other is an error, since a cost with half its price missing cannot be estimated. An embedding model needs only input_usd.

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".

cached_input_usd

Price per 1M input tokens the provider served from its prompt cache, where that is billed at its own rate. NA (the default) prices them as other input tokens, which never undercounts.

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; harnessr says so rather
# than assuming the run is free.
is.na(gr_estimate_cost("my-local-llama", 1000, 500))
#> [1] TRUE