Menu

An R Client That Behaves Like R: Callbacks, Conditions, and a Receipt in result$meta
📰

An R Client That Behaves Like R: Callbacks, Conditions, and a Receipt in result$meta

DEV Community: r·nRouter·11 days ago
#MxF9VxQd
#devtor#devto#dev#nrouter#list
Long article (716 words) — no AI summary yet.
Reading 0:00
15s threshold

Most R packages that talk to an LLM API feel translated. The idioms arrive from somewhere else — promise chains where you'd write a plain loop, foreign exception objects where R would raise a condition. The nRouter R SDK (package name nrouter ) is written the other way round, and three choices give it away.

It installs the R way, from R-universe

The package isn't on CRAN. It installs from nRouter's R-universe, with CRAN kept alongside for dependencies:

install . packages ( "nrouter" , repos = c ( nrouterai = "https://nrouterai.r-universe.dev" , CRAN = "https://cloud.r-project.org" ) )

Enter fullscreen mode

Exit fullscreen mode

Prefer source? remotes::install_github("nRouterGateway/nrouter-sdk", subdir = "sdks/r") gets the same package from the SDK repo.

The client takes the key the way R scripts already expect it, out of .Renviron :

library ( nrouter ) client <- nrouter_client ( api_key = Sys .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.