AIApiSettings

Convenience factory for common AI API configuration fields (base URL, model, API key).

Usage in UniversalAppEntry.userSettings:

override fun userSettings() = AIApiSettings.fields(
defaultBaseUrl = "https://api.openai.com/v1/",
defaultModel = "gpt-4o",
)

Reading values in a UniversalCommand.run:

val baseUrl = AIApiSettings.baseUrl(ctx.settings)
val model = AIApiSettings.model(ctx.settings)
val apiKey = AIApiSettings.apiKey(ctx.settings)

Properties

Link copied to clipboard
const val KEY_API_KEY: String
Link copied to clipboard
const val KEY_BASE_URL: String
Link copied to clipboard
const val KEY_MODEL: String

Functions

Link copied to clipboard
fun apiKey(settings: Map<String, String>): String

Read the API key from a settings map.

Link copied to clipboard
fun baseUrl(settings: Map<String, String>): String

Read the base URL from a settings map.

Link copied to clipboard
fun fields(defaultBaseUrl: String = "", defaultModel: String = "", defaultApiKey: String = ""): List<UserSettingField>

Create the standard three AI-API setting fields.

Link copied to clipboard
fun model(settings: Map<String, String>): String

Read the model name from a settings map.