ProviderProfile

@Serializable
data class ProviderProfile(val id: String, val name: String, val kind: ProviderKind, val baseUrl: String = "", val model: String = "", val useTools: Boolean = true, val systemPrompt: String = DEFAULT_SYSTEM_PROMPT, val builtIn: Boolean = false, val oauth: OAuthProvider? = null)(source)

One configured agent provider. The API key is not part of the profile — it lives encrypted in SecretStore, keyed by id.

Constructors

Link copied to clipboard
constructor(id: String, name: String, kind: ProviderKind, baseUrl: String = "", model: String = "", useTools: Boolean = true, systemPrompt: String = DEFAULT_SYSTEM_PROMPT, builtIn: Boolean = false, oauth: OAuthProvider? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Signed in with OAuth instead of an API key (see OAuthProvider).

Link copied to clipboard
Link copied to clipboard

Signed in with tokens (OpenRouter's sign-in yields a plain API key instead).

Link copied to clipboard

expose on-device tools to client-side agent loops (servers that run the agent themselves bring their own tools).

Functions

Link copied to clipboard
fun createBackend(apiKey: String, tools: List<AgentTool> = BuiltinTools, approver: ToolApprover = ToolApprover.AlwaysApprove, headers: Map<String, String> = emptyMap(), instructions: String = "", agUiEventLog: AgUiEventLog? = null): ChatBackend

The backend for this profile.

Link copied to clipboard
fun createOAuthBackend(tokens: TokenSource, tools: List<AgentTool> = BuiltinTools, approver: ToolApprover = ToolApprover.AlwaysApprove, instructions: String = ""): ChatBackend

The backend for a signed-in profile: every turn takes a fresh access token from tokens (refreshing as needed) and adds the provider's account headers.

Link copied to clipboard
suspend fun listModels(apiKey: String, client: OkHttpClient = DefaultHttpClient): List<String>

Ask the provider which models it serves (for the model picker).