Skip to content

Enable or disable AI, or change the model or draft language, without touching credentials

PATCH
/v1/settings/ai
curl --request PATCH \
--url https://beta-api.plune.ai/v1/settings/ai \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "enabled": false }'

Owner only. Disabling keeps the credentials for a later re-enable (AC-20); a draft already awaiting_decision is unaffected either way (AC-20) — new requests are what gets refused while AI is off (AC-07). Re-enabling with no prior connect (no row yet) answers 409: PUT connects first. model and language change independently of credentials, per SCR-03’s “choose model” being its own action, separate from “replace credentials”.

Media type application/json

No credentials here — replacing them is PUT, removing them is DELETE .../credentials.

object
>= 1 properties
enabled
boolean
model

Same rules as AiSettingsConnect.model.

string
>= 1 characters <= 200 characters /^[A-Za-z0-9@][A-Za-z0-9._:/@+-]*$/
language
string
Examples
{
"enabled": false
}

Updated — the owner view

Media type application/json

What an owner reads — AiSettingsStatus plus AC-05/AC-09/AC-15. Never includes the credentials themselves (AC-12).

object
configured
required

Whether a provider has ever been connected (an ai_settings row exists).

boolean
enabled
required
boolean
provider

Present exactly when configured is true.

string
Allowed values: anthropic openrouter custom
model

Present exactly when configured is true.

string
customAddress

Present when provider is custom.

string
language

Draft language, default en (AC-05) — a project setting, not the reader’s interface language.

string
credentialsSavedAt

Present exactly when configured is true (AC-05, AC-12 — “коли й ким”, never the value).

string format: date-time
credentialsSavedBy

userId of the owner who last connected or replaced credentials.

string
lastIssueKind

AC-09 — the most recent provider issue, if any; null otherwise. Never aborted-shaped: a timeout is not a provider failure.

string
Allowed values: key_rejected provider_rate_limited provider_unavailable invalid_response address_rejected
lastIssueAt
string format: date-time
nullable
usage

Present exactly when configured is true.

object
month
required

Calendar month, UTC.

string
/^\d{4}-\d{2}$/
calls
required
object
succeeded
required
integer
failed
required
integer
aborted
required
integer
cost
required
object
knownUsd
required

Sum of costUsd over calls whose model had a known price at call time.

number
unknownPriceCalls
required

Count of calls whose tokens the provider reported but whose model has no price — “ціна невідома” — never folded into knownUsd as zero (SAD §8 rule 6). A call that reported no tokens (a timeout, a rejected key) has nothing to price and is counted in calls, not here.

integer
recommendedModels

GET, owner only (#896): the model the platform recommends for each provider it lists — none for custom, whose owner names the model. The connect form offers it first; always a model with a known price (AC-15).

object
anthropic
string
openrouter
string
models

GET, owner only (#898): the models the connect form lets the owner choose from for each provider the platform lists — the ones it has a price for, the recommended first, each with that price. None for custom. A model that is not listed is still allowed (model is free text): the list is a help, not a gate.

object
anthropic
Array<object>

One model the connect form lists (#898): the id as a provider writes it and what the platform’s own price table charges for it, per million tokens (AC-15).

object
id
required
string
inputUsdPerMillion
required

USD for a million input tokens.

number
outputUsdPerMillion
required

USD for a million output tokens.

number
openrouter
Array<object>

One model the connect form lists (#898): the id as a provider writes it and what the platform’s own price table charges for it, per million tokens (AC-15).

object
id
required
string
inputUsdPerMillion
required

USD for a million input tokens.

number
outputUsdPerMillion
required

USD for a million output tokens.

number
Example
{
"provider": "anthropic",
"lastIssueKind": "key_rejected",
"models": {
"anthropic": [
{
"id": "claude-sonnet-4-5",
"inputUsdPerMillion": 3,
"outputUsdPerMillion": 15
}
],
"openrouter": [
{
"id": "claude-sonnet-4-5",
"inputUsdPerMillion": 3,
"outputUsdPerMillion": 15
}
]
}
}

Empty body, or an unknown field

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}

No / invalid token or session

A member or a reader asked

Media type application/json
object
error
required
string
Example
{
"error": "project owner only"
}

No provider connected yet — PUT first

Media type application/json
object
error
required
string
Example
{
"error": "AI is not connected yet — connect a provider first"
}

Rate-limited: either the per-route throttle or a tenant quota. Retry-After carries the seconds until the window rolls over.

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}
Retry-After
integer

Seconds until the window rolls over