Skip to contents

With no arguments, returns the effective settings with the layer each value came from: package defaults < user settings.json < project .gptr/settings.json (an untrusted project only tightens mode, context, record, permission rules and local-only inference; a trusted one also sets mode, while context and record still only tighten) < the user-level project file < options(gptr.*) < this R session. With named arguments, sets those keys in one scope.

Usage

gptr_config(..., .scope = NULL)

Arguments

...

Named settings, e.g. mode = manual, model = sonnet, budget = list(cost = 2).

.scope

NULL (the project when a .gptr/ workspace exists, else this session), or "session", "project" or "user".

Value

Without arguments, a gptr_config list. Otherwise the previous values in that scope, invisibly (a named list; NULL where the key was unset).

Details

model, small_model, system1, mode and preset take bare names (mode = plan); NULL removes a key from the scope. Unset, model and system1 come from the catalog's reviewed defaults of the first ready route: Anthropic, OpenAI, Google, then a detected command-line tool (System 1: TypeSafe, else an installed local classifier); small_model is that route's small default, else model. model = openai, a provider with a reviewed default named alone, means that default; any provider/id is accepted (gptr_models()).

egress (the providers you allow automatic context to go to) is accepted only at user scope. mode = yolo and turning off local-only Ollama inference (providers = list(ollama = list(local_only = FALSE))) are accepted only at user or session scope; a project can only keep local-only inference on. A change called from model code during a run needs an allowing permission decision (a person's, in every mode but yolo; see gptr_security); otherwise it signals gptr_error_permission.

The "session" scope means this R process, not one conversation. User settings live at tools::R_user_dir("gptr", "config")/settings.json; project settings live in .gptr/. A no-argument call always reads effective values, even when .scope is supplied. Inspect attr(gptr_config(), "sources") to see their origins. Named lists merge with lower layers; protected objects such as providers must be set as a whole named list. A plugins entry starting with ./ or ../, like a relative skills.paths entry, is found from the project root, not from R's working directory.

Choosing controls

Use settings for defaults such as model, mode, context, budget, record, replay, the undo limits (gptr_rewind()), compact_calls (TRUE: one console row per tool call, the /calls command of peter() showing calls in full) and registered extension selections. Use gptr_options for transport timeouts, output caps, file checkpoint retention and concurrency. Arguments to peter() choose values for one call, within inherited safety restrictions. vignette("configuration", package = "gptr") groups all core settings and options and explains trust and scope.

Examples

old = gptr_config(mode = plan, .scope = "session")
gptr_config()$mode
#> [1] "plan"
gptr_config(mode = old$mode, .scope = "session")