Posit AI provides access to a curated set of models for Posit subscribers.
Authentication
By default, chat_posit() authenticates with an OAuth device flow against
login.posit.cloud: the first time you use it, you'll be prompted to
visit a URL and enter a code. The resulting tokens are cached on disk
(see httr2::req_oauth_device()) and refreshed automatically, so you
should only need to do this once per machine.
Arguments
- system_prompt
A system prompt to set the behavior of the assistant.
- base_url
The base URL of the Posit AI gateway.
- credentials
A zero-argument function that returns the credentials to use in place of the default OAuth device flow, either as a named list of headers or as a function that modifies the request. You should not usually need to set this.
- model
The model to use for the chat (defaults to "claude-sonnet-4-6"). We regularly update the default, so we strongly recommend explicitly specifying a model for anything other than casual use. Use
models_posit()to see all options.- params
Common model parameters, usually created by
params().- cache
How long to cache inputs? Defaults to "5m" (five minutes). Set to "none" to disable caching or "1h" to cache for one hour. This is only supported for Claude models and is ignored for other models.
- api_args
Named list of arbitrary extra arguments appended to the body of every chat API call. Combined with the body object generated by ellmer with
modifyList().- api_headers
Named character vector of arbitrary extra headers appended to every chat API call.
- echo
One of the following options:
none: don't emit any output (default when running in a function).output: echo text and tool-calling output as it streams in (default when running at the console).all: echo all input and output.
Note this only affects the
chat()method.
Value
A Chat object.
See also
Other chatbots:
chat_anthropic(),
chat_aws_bedrock(),
chat_azure_openai(),
chat_cloudflare(),
chat_databricks(),
chat_deepseek(),
chat_github(),
chat_google_gemini(),
chat_groq(),
chat_huggingface(),
chat_lmstudio(),
chat_mistral(),
chat_ollama(),
chat_openai(),
chat_openai_compatible(),
chat_openrouter(),
chat_perplexity(),
chat_portkey()
