Rewrite the assistant's system prompt with AI
POST/api/ai/prompt-improve
Sends the given system prompt to the workspace's chat model and returns
a clearer, better-structured version. Nothing is saved — the caller
decides whether to store the result through updateAiSettings.
Admin only (manage-ai-settings) and needs the ai feature (404 without it).
It is a real model call: tokens are recorded in ai_usage under the
credential that answered (and billed to the wallet on platform keys).
The fallback chain is honoured; fallback_used says whether the
secondary credential answered.
Request
Responses
- 200
- 401
- 403
- 409
- 422
- 502
The rewritten prompt and the usage of the call.
Not authenticated. code: account_disabled means the member's seat was deactivated in this workspace: the session is over even though the token was not revoked (clients sign out and clean up).
Authenticated but not allowed.
AI is off for the workspace, or no chat credential is configured.
The error code is one of ai_disabled, no_chat_credential.
The request failed validation.
The chat provider (and the fallback, when there is one) failed.
error_kind is the last classified failure.