% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/provider-posit.R
\name{chat_posit}
\alias{chat_posit}
\alias{models_posit}
\title{Chat with a model hosted by Posit AI}
\usage{
chat_posit(
  system_prompt = NULL,
  base_url = "https://gateway.posit.ai",
  credentials = NULL,
  model = NULL,
  params = NULL,
  cache = c("5m", "1h", "none"),
  api_args = list(),
  api_headers = character(),
  echo = NULL
)

models_posit(base_url = "https://gateway.posit.ai", credentials = NULL)
}
\arguments{
\item{system_prompt}{A system prompt to set the behavior of the assistant.}

\item{base_url}{The base URL of the Posit AI gateway.}

\item{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.}

\item{model}{The model to use for the chat (defaults to "claude-sonnet-5").
We regularly update the default, so we strongly recommend explicitly specifying a model for anything other than casual use.
Use \code{models_posit()} to see all options.}

\item{params}{Common model parameters, usually created by \code{\link[=params]{params()}}.}

\item{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.}

\item{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 \code{\link[=modifyList]{modifyList()}}.}

\item{api_headers}{Named character vector of arbitrary extra headers appended
to every chat API call.}

\item{echo}{One of the following options:
\itemize{
\item \code{none}: don't emit any output (default when running in a function).
\item \code{output}: echo text and tool-calling output as it streams in (default
when running at the console).
\item \code{all}: echo all input and output.
}

Note this only affects the \code{chat()} method.}
}
\value{
A \link{Chat} object.
}
\description{
\ifelse{html}{\figure{support-official.svg}{options: alt='[Official supported provider]'}}{\strong{[Official supported provider]}}

\href{https://posit.ai}{Posit AI} provides access to a curated set of models
for Posit subscribers.
\subsection{Authentication}{

By default, \code{chat_posit()} authenticates with an OAuth device flow against
\code{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 \code{\link[httr2:req_oauth_device]{httr2::req_oauth_device()}}) and refreshed automatically, so you
should only need to do this once per machine.
}
}
\examples{
\dontrun{
chat <- chat_posit()
chat$chat("Tell me three jokes about statisticians")
}
}
\seealso{
Other chatbots:
\code{\link[=chat_anthropic]{chat_anthropic()}},
\code{\link[=chat_aws_bedrock]{chat_aws_bedrock()}},
\code{\link[=chat_azure_openai]{chat_azure_openai()}},
\code{\link[=chat_cloudflare]{chat_cloudflare()}},
\code{\link[=chat_databricks]{chat_databricks()}},
\code{\link[=chat_deepseek]{chat_deepseek()}},
\code{\link[=chat_github]{chat_github()}},
\code{\link[=chat_google_gemini]{chat_google_gemini()}},
\code{\link[=chat_groq]{chat_groq()}},
\code{\link[=chat_huggingface]{chat_huggingface()}},
\code{\link[=chat_lmstudio]{chat_lmstudio()}},
\code{\link[=chat_mistral]{chat_mistral()}},
\code{\link[=chat_ollama]{chat_ollama()}},
\code{\link[=chat_openai]{chat_openai()}},
\code{\link[=chat_openai_compatible]{chat_openai_compatible()}},
\code{\link[=chat_openrouter]{chat_openrouter()}},
\code{\link[=chat_perplexity]{chat_perplexity()}},
\code{\link[=chat_portkey]{chat_portkey()}}
}
\concept{chatbots}
