Reference
Arcane.ai.saveProviderSettings()
Saves provider settings; validates the selected model when OpenAI is selected and validates a supplied replacement credential before persistence. Ollama-selected settings may retain a dormant OpenAI model for later revalidation.
This focused page is derived from the mechanically checked full member inventory.
Syntax
Arcane.ai.saveProviderSettings(settings)
Parameters
settings: AIProviderSettingsInput
Return value
Promise<AIProviderSettingsResult>
Description
Saves provider settings; validates the selected model when OpenAI is selected and validates a supplied replacement credential before persistence. Ollama-selected settings may retain a dormant OpenAI model for later revalidation.
Overview
Arcane.ai.saveProviderSettings(settings) applies a provider-settings patch.
Use it only from Settings after explicit user intent. Arcane protects OpenAI
credentials and attempts to roll back credential and settings changes together
when a save fails.
Parameters
The patch can contain provider, openAIModel, responseLength, token, and
removeToken; omitted keys preserve current values. provider is "ollama"
or "openai". openAIModel is 1-128 characters matching
[A-Za-z0-9][A-Za-z0-9._:-]{0,127}. responseLength is "low", "medium",
or "high". A replacement token is trimmed, begins with sk-, and is
20-512 characters. Only removeToken: true requests deletion, and a supplied
token becomes the final credential. Arcane performs account-model validation
when OpenAI is selected or a replacement token is supplied.
Return value
It resolves to the credential-free settings shape
{provider, openAIModel, openAIConfigured, responseLength} after persistence.
Availability
This is an exclusive desktop Core mutation requiring ai.settings.manage and
the Settings app identity. OpenAI validation uses the network and protected
credential store. It is not projected to Android.
Errors and recovery
Correct INVALID_AI_PROVIDER_SETTINGS, provider, model, response-length, or
token errors before retrying. OpenAI account/model errors require a valid
credential and accessible model. On CREDENTIAL_STORE_UNAVAILABLE, leave the
prior settings in place. CREDENTIAL_ROLLBACK_FAILED requires diagnostics and
manual Settings review before another mutation. Never log a supplied token.
Streaming, cancellation, and events
The method does not stream or emit operation events. The wrapper waits up to
130 seconds and exposes no signal. Core does not cooperatively cancel this
mutation, so closing the page or timing out can stop observation while the save
continues; read providerSettings() before deciding whether to retry.
Example
This credential-free example selects local inference. Read a new OpenAI token from a protected user input at call time rather than embedding it in source.
document.querySelector('#confirm-provider-settings')?.addEventListener(
'click',
async function handleConfirmedProviderSettings() {
const saved = await globalThis.Arcane.ai.saveProviderSettings({
provider: 'ollama',
responseLength: 'medium'
});
console.info(saved.provider, saved.responseLength);
}
);