AiModel
AiModel
Section titled “AiModel”Defines an AI model endpoint for LLM-based features.
This object can be configured from the WebUI under Settings › AI
Fields
Section titled “Fields”Type:
String· requiredShort name for the AI Model
allowInvalidCerts
Section titled “allowInvalidCerts”Type:
Boolean· default:falseWhether Stalwart should connect to an endpoint that has an invalid TLS certificate
temperature
Section titled “temperature”Type:
Float· default:0.7· max: 1 · min: 0The temperature of the AI model, which controls the randomness of the output. A higher temperature will produce more random output.
Type:
String· requiredThe name of the AI model to use.
timeout
Section titled “timeout”Type:
Duration· default:"2m"Maximum amount of time that Stalwart will wait for a response from this endpoint
modelType
Section titled “modelType”Type:
AiModelType· default:"Chat"API type
Type:
Uri· requiredURL of the OpenAI compatible endpoint
httpAuth
Section titled “httpAuth”Type:
HttpAuth· requiredThe type of HTTP authentication to use
httpHeaders
Section titled “httpHeaders”Type:
Map<String, String>Additional headers to include in HTTP requests
JMAP API
Section titled “JMAP API”The AiModel object is available via the urn:stalwart:jmap capability.
x:AiModel/get
Section titled “x:AiModel/get”This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
This method requires the sysAiModelGet permission.
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" ] }'x:AiModel/set
Section titled “x:AiModel/set”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.
Create
Section titled “Create”This operation requires the sysAiModelCreate permission.
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" ] }'Update
Section titled “Update”This operation requires the sysAiModelUpdate permission.
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" ] }'Destroy
Section titled “Destroy”This operation requires the sysAiModelDestroy permission.
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" ] }'x:AiModel/query
Section titled “x:AiModel/query”This is a standard Foo/query method as defined in RFC 8620, Section 5.5.
This method requires the sysAiModelQuery permission.
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.
stalwart-cli get AiModel id1Create
Section titled “Create”stalwart-cli create AiModel \ --field name=Example \ --field model=Example \ --field url=https://example.com \ --field 'httpAuth={"@type":"Unauthenticated"}' \ --field 'httpHeaders={}'stalwart-cli query AiModelUpdate
Section titled “Update”stalwart-cli update AiModel id1 --field name='updated value'Delete
Section titled “Delete”stalwart-cli delete AiModel --ids id1Nested types
Section titled “Nested types”HttpAuth
Section titled “HttpAuth”Defines the HTTP authentication method to use for HTTP requests.
Unauthenticated: Anonymous. No additional fields.Basic: Basic Authentication. Carries the fields ofHttpAuthBasic.Bearer: Bearer Token. Carries the fields ofHttpAuthBearer.
HttpAuthBasic
Section titled “HttpAuthBasic”HTTP Basic authentication credentials.
username
Section titled “username”Type:
String· requiredUsername for HTTP Basic Authentication
secret
Section titled “secret”Type:
SecretKey· requiredPassword for HTTP Basic Authentication
SecretKey
Section titled “SecretKey”A secret value provided directly, from an environment variable, or from a file.
Value: Secret value. Carries the fields ofSecretKeyValue.EnvironmentVariable: Secret read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Secret read from file. Carries the fields ofSecretKeyFile.
SecretKeyValue
Section titled “SecretKeyValue”A secret value provided directly.
secret
Section titled “secret”Type:
String· required · secretPassword or secret value
SecretKeyEnvironmentVariable
Section titled “SecretKeyEnvironmentVariable”A secret value read from an environment variable.
variableName
Section titled “variableName”Type:
String· requiredEnvironment variable name to read the secret from
SecretKeyFile
Section titled “SecretKeyFile”A secret value read from a file.
filePath
Section titled “filePath”Type:
String· requiredFile path to read the secret from
HttpAuthBearer
Section titled “HttpAuthBearer”HTTP Bearer token authentication.
bearerToken
Section titled “bearerToken”Type:
SecretKey· requiredBearer token for HTTP Bearer Authentication
AiModelType
Section titled “AiModelType”| Value | Label |
|---|---|
Chat | Chat Completion |
Text | Text Generation |