AI assistant
Model connection settings and connection test, the model rating table, availability and quota, conversation history, and the assistant look.
aiAI assistantAuthentication: User19 endpointsList my AI conversations
GET
/api/v2/ai/conversationsAuthentication: User
Get my AI conversation
GET
/api/v2/ai/conversations/{id}Authentication: User
Delete my AI conversation
DELETE
/api/v2/ai/conversations/{id}Authentication: User
Get my assistant look
GET
/api/v2/ai/lookAuthentication: User
Save my assistant look
PUT
/api/v2/ai/lookAuthentication: User
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Assistant name; empty means the default name. |
| pet | AiPet | Required | Assistant figure: orb, cat, dog, bot, or ai (drawn from the custom parameters in spec). |
| spec | AiLookSpec | — | Parameters of the AI custom figure (whitelisted values only; the panel draws it from fixed SVG parts). Absent from AiLook when never customised. Required when saving with pet ai or theme custom (code required); omitted means the stored one is kept. The server re-checks and normalises it (lowercase colours, primary darkened until white text is readable). |
| theme | AiTheme | Required | Assistant accent colour: blue, teal, sunset, morandi, ink, or custom (the three colours in the custom parameters, spec). Applies to the assistant panel only. |
Get my uploaded assistant avatar
GET
/api/v2/ai/look/avatarAuthentication: User
Upload my assistant avatar
PUT
/api/v2/ai/look/avatarAuthentication: User
Remove my uploaded assistant avatar
DELETE
/api/v2/ai/look/avatarAuthentication: User
Generate a custom assistant figure from a description
POST
/api/v2/ai/look/generateAuthentication: User
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Required | The look you want, at most 60 characters after control characters and angle brackets are removed. |
Send a message to the AI assistant
POST
/api/v2/ai/messagesAuthentication: User
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
| context | AiContext | — | Current page context: only the page name and the ID of the open item; the server fetches the data. Pages with detailed data: home, attack_logs (ref = record ID), sites (ref = site ID); other pages pass only the name. |
| conversation_id | integer | — | Conversation to continue; omit to start a new one (titled from this message). |
| text | string | Required | The look you want, at most 60 characters after control characters and angle brackets are removed. |
List AI model ratings
GET
/api/v2/ai/modelsAuthentication: Admin only
Cancel an AI assistant plan
POST
/api/v2/ai/plans/cancelAuthentication: User
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
| plan_id | AiPlanKey | Required | Plan id (random, 32 hex digits). |
Execute an AI assistant plan
POST
/api/v2/ai/plans/executeAuthentication: User
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
| password | string | — | Current login password. |
| plan_id | AiPlanKey | Required | Plan id (random, 32 hex digits). |
| totp_code | string | — | Current 6-digit TOTP code; the account must have TOTP enabled. |
Revise the parameters of an AI assistant plan
POST
/api/v2/ai/plans/reviseAuthentication: User
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
| domain | string | Required | Site domain. |
| origin | string | Required | Origin address (IP or hostname). |
| plan_id | AiPlanKey | Required | Plan id (random, 32 hex digits). |
| port | integer | Required | Origin port. |
| upid | integer | Required | Purchased package to use (must belong to the plan's owning tenant). |
Get an AI assistant plan
GET
/api/v2/ai/plans/{plan_id}Authentication: User
Get AI assistant settings
GET
/api/v2/ai/settingsAuthentication: Admin only
Save AI assistant settings
PUT
/api/v2/ai/settingsAuthentication: Admin only
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
| api_key | string | — | API key; omit to keep the stored one, or send an empty string to clear it (which disables the assistant). Stored sealed and never returned. |
| api_type | AiApiType | Required | API type: openai is OpenAI-compatible (/chat/completions, also used by most providers in mainland China); claude is the native Anthropic API (/messages); moonshot is Kimi (OpenAI-compatible with a different default address). |
| base_url | string | — | Service address (public HTTPS); empty if never saved. |
| model | string | Required | Model name. |
Test AI assistant connection
POST
/api/v2/ai/settings/probeAuthentication: Admin only
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
| api_key | string | — | API key; omit to keep the stored one, or send an empty string to clear it (which disables the assistant). Stored sealed and never returned. |
| api_type | AiApiType | Required | API type: openai is OpenAI-compatible (/chat/completions, also used by most providers in mainland China); claude is the native Anthropic API (/messages); moonshot is Kimi (OpenAI-compatible with a different default address). |
| base_url | string | — | Service address (public HTTPS); empty if never saved. |
| model | string | Required | Model name. |
Get AI assistant availability
GET
/api/v2/ai/statusAuthentication: User
AI assistant object
| Field | Type | Required | Description |
|---|---|---|---|
| api_key | string | — | API key; omit to keep the stored one, or send an empty string to clear it (which disables the assistant). Stored sealed and never returned. |
| api_type | AiApiType | — | API type: openai is OpenAI-compatible (/chat/completions, also used by most providers in mainland China); claude is the native Anthropic API (/messages); moonshot is Kimi (OpenAI-compatible with a different default address). |
| available | boolean | — | Whether the assistant is shown and usable; true but read-only for a delegated session (reason=delegated). |
| avatar_ver | integer | — | Avatar version; 0 means no uploaded avatar (the chosen figure is shown), above 0 fetch it with GET /ai/look/avatar; grows on every change. |
| base_url | string | — | Service address (public HTTPS); empty if never saved. |
| cert_id | integer | — | The requested certificate. |
| cname | string | — | CNAME target from the create response; while waiting for DNS the user points the domain to it. |
| code | string | — | Failure detail: blocked (address rejected, such as private), auth (key rejected), rate_limited (upstream rate limit), timeout, refused (model refused), protocol (malformed response), http (other status code), connect (unreachable). |
| connect_ms | integer | — | Connect time in milliseconds (latest request). |
| context | AiContext | — | Current page context: only the page name and the ID of the open item; the server fetches the data. Pages with detailed data: home, attack_logs (ref = record ID), sites (ref = site ID); other pages pass only the name. |
| conversation_id | integer | — | Conversation to continue; omit to start a new one (titled from this message). |
| created_at | string | — | Created at. |
| detail | string | — | Explanation for the admin (includes an upstream error excerpt, never the key). |
| domain | string | Required | Site domain. |
| error | string | — | Why the plan failed. |
| expires_at | string | — | The plan cannot be executed after this time. |
| fetched_on | string | — | Date the data was fetched. |
| first_token_ms | integer | — | Slowest first-token time in milliseconds over the rounds run. |
| high_risk | boolean | — | Re-authentication is required before executing. |
| id | integer | — | Conversation ID. |
| items | AiConversation[] | — | Conversations (without messages). |
| key_set | boolean | — | Whether an API key is set (the key itself is never returned). |
| kind | AiPlanKind | — | create_site: add a site (HTTP first; the certificate is requested after DNS is set up); delete_site: delete a site (high risk, re-authentication required). |
| messages | AiMessage[] | — | All messages (only when getting a single conversation). |
| model | string | — | Model name. |
| name | string | — | Assistant name; empty means the default name. |
| ok | boolean | — | Whether the probe passed. |
| origin | string | Required | Origin address (IP or hostname). |
| outdated | boolean | — | Data is more than 90 days old; the panel shows that ratings may be outdated. |
| params | AiPlanParams | — | Frozen plan parameters. Adding a site: domain, origin, port, upid, package (plus tenant_id when an admin creates for a tenant); deleting a site: site_id, with site_name and domains for review. |
| password | string | — | Current login password. |
| pet | AiPet | — | Assistant figure: orb, cat, dog, bot, or ai (drawn from the custom parameters in spec). |
| plan_id | AiPlanKey | Required | Plan id (random, 32 hex digits). |
| port | integer | Required | Origin port. |
| probe_first_token_ms | integer | — | Slowest first-token time in milliseconds over the 3 probe rounds; 0 if not passed. |
| probe_ok | boolean | — | Whether the save-time probe passed; reset when the model or key changes. |
| probe_round_ms | integer | — | Slowest round time in milliseconds over the 3 probe rounds; 0 if not passed. |
| probed_at | string | — | When the probe passed; null if not passed. |
| ready | boolean | — | Whether the settings are usable (key set, model set and probe passed); the license is checked separately, see /ai/status. |
| reason | string | — | Why unavailable: unlicensed (not enabled), expired (license expired), not_configured (the admin has not connected a model), delegated (a delegated session; only with available=true, read-only, cannot send), demo (demo mode). |
| reauth_methods | AiReauthMethod[] | — | Re-authentication methods available for a high-risk plan; empty otherwise. |
| revoking_until | string | — | When the provider has revoked the license, usable until this time. |
| round_ms | integer | — | Slowest round time in milliseconds over the rounds run. |
| rounds | integer | — | Rounds completed (3 when passed). |
| site_id | integer | — | The created site. |
| spec | AiLookSpec | — | Parameters of the AI custom figure (whitelisted values only; the panel draws it from fixed SVG parts). Absent from AiLook when never customised. Required when saving with pet ai or theme custom (code required); omitted means the stored one is kept. The server re-checks and normalises it (lowercase colours, primary darkened until white text is readable). |
| state | AiPlanState | — | proposed: waiting to run; running: in progress; wait_dns: site created, waiting for the DNS record (executing again requests the certificate); done; failed (see error); cancelled; superseded: replaced by a revised plan. |
| step | string | — | Where a failed probe stopped: connect (unreachable or upstream error), tool (did not call the tool with the numbers), echo (wrong echo), first_token (first token too slow), round (round too slow). |
| text | string | Required | The look you want, at most 60 characters after control characters and angle brackets are removed. |
| theme | AiTheme | — | Assistant accent colour: blue, teal, sunset, morandi, ink, or custom (the three colours in the custom parameters, spec). Applies to the assistant panel only. |
| title | string | — | Title (start of the first question). |
| totp_code | string | — | Current 6-digit TOTP code; the account must have TOTP enabled. |
| updated_at | string | — | Time of the last message (retention counts from it). |
| upid | integer | Required | Purchased package to use (must belong to the plan's owning tenant). |
| usage | object | — | Your usage and quota after this generation (already counted). |
| version | string | — | Rating methodology version. |