更新用户通知设置
PUT /api/user/setting
更新当前用户的额度预警与通知设置,支持邮件、Webhook、Bark、Gotify、短信等多种通知方式。
鉴权说明
用户控制台接口,需登录用户身份(会话 Cookie,或 Authorization: Bearer <access_token>)。此令牌与模型调用使用的 sk- 密钥不同。
请求体参数
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
notify_type | string | 必选 | 通知类型:email、webhook、bark、gotify、sms |
quota_warning_threshold | number | 必选 | 额度预警阈值,必须大于 0 |
notification_email | string | 可选 | 通知邮箱(notify_type=email 时使用,需含 @) |
webhook_url | string | 可选 | Webhook 地址(notify_type=webhook 时必填) |
webhook_secret | string | 可选 | Webhook 密钥 |
bark_url | string | 可选 | Bark 推送地址(notify_type=bark 时必填,须为 http/https) |
gotify_url | string | 可选 | Gotify 地址(notify_type=gotify 时使用) |
gotify_token | string | 可选 | Gotify Token |
gotify_priority | integer | 可选 | Gotify 优先级 |
notification_phone | string | 可选 | 通知手机号(notify_type=sms 时使用) |
accept_unset_model_ratio_model | boolean | 可选 | 是否接受未设置倍率的模型 |
record_ip_log | boolean | 可选 | 是否记录 IP 日志 |
请求示例
{
"notify_type": "email",
"quota_warning_threshold": 500000,
"notification_email": "user@example.com",
"accept_unset_model_ratio_model": false,
"record_ip_log": true
}
响应字段(200)
| 字段名 | 类型 | 说明 |
|---|---|---|
success | boolean | 是否成功 |
message | string | 提示信息 |