Skip to content

AiModel

Defines an AI model endpoint for LLM-based features.

This object can be configured from the WebUI under Settings › AI

Type: String · required

Short name for the AI Model

Type: Boolean · default: false

Whether Stalwart should connect to an endpoint that has an invalid TLS certificate

Type: Float · default: 0.7 · max: 1 · min: 0

The temperature of the AI model, which controls the randomness of the output. A higher temperature will produce more random output.

Type: String · required

The name of the AI model to use.

Type: Duration · default: "2m"

Maximum amount of time that Stalwart will wait for a response from this endpoint

Type: AiModelType · default: "Chat"

API type

Type: Uri · required

URL of the OpenAI compatible endpoint

Type: HttpAuth · required

The type of HTTP authentication to use

Type: Map<String, String>

Additional headers to include in HTTP requests

The AiModel object is available via the urn:stalwart:jmap capability.

This is a standard Foo/get method as defined in RFC 8620, Section 5.1.

This method requires the sysAiModelGet permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:AiModel/get",
{
"ids": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This is a standard Foo/set method as defined in RFC 8620, Section 5.3.

Supports create, update, and destroy operations in a single call.

This operation requires the sysAiModelCreate permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:AiModel/set",
{
"create": {
"new1": {
"httpAuth": {
"@type": "Unauthenticated"
},
"httpHeaders": {},
"model": "Example",
"name": "Example",
"url": "https://example.com"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This operation requires the sysAiModelUpdate permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:AiModel/set",
{
"update": {
"id1": {
"name": "updated value"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This operation requires the sysAiModelDestroy permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:AiModel/set",
{
"destroy": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This is a standard Foo/query method as defined in RFC 8620, Section 5.5.

This method requires the sysAiModelQuery permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:AiModel/query",
{
"filter": {}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.

Terminal window
stalwart-cli get AiModel id1
Terminal window
stalwart-cli create AiModel \
--field name=Example \
--field model=Example \
--field url=https://example.com \
--field 'httpAuth={"@type":"Unauthenticated"}' \
--field 'httpHeaders={}'
Terminal window
stalwart-cli query AiModel
Terminal window
stalwart-cli update AiModel id1 --field name='updated value'
Terminal window
stalwart-cli delete AiModel --ids id1

Defines the HTTP authentication method to use for HTTP requests.

  • Unauthenticated: Anonymous. No additional fields.
  • Basic: Basic Authentication. Carries the fields of HttpAuthBasic.
  • Bearer: Bearer Token. Carries the fields of HttpAuthBearer.

HTTP Basic authentication credentials.

Type: String · required

Username for HTTP Basic Authentication

Type: SecretKey · required

Password for HTTP Basic Authentication

A secret value provided directly, from an environment variable, or from a file.

A secret value provided directly.

Type: String · required · secret

Password or secret value

A secret value read from an environment variable.

Type: String · required

Environment variable name to read the secret from

A secret value read from a file.

Type: String · required

File path to read the secret from

HTTP Bearer token authentication.

Type: SecretKey · required

Bearer token for HTTP Bearer Authentication

ValueLabel
ChatChat Completion
TextText Generation