修改令牌
https://api.apizt.com/api/token/修改当前账号下指定令牌的配置,或通过 status_only 仅切换启用状态。
普通修改提交完整配置:先读取原有值,再修改目标字段后提交,避免把未提交字段当作保持不变。
请求参数
Query 参数
status_onlyqueryboolean可选为 true 时仅更新状态;请求体只需 id 和 status。
Header 参数
Authorizationheaderstring必需Bearer 后填写个人设置中的系统访问令牌,不使用模型 API Key。
new-api-userheaderstring必需当前用户 ID,须与系统访问令牌所属账号一致。
Content-Typeheaderstring必需请求体使用 JSON。
Body 参数 application/json
allow_ipsbodystring必需白名单IP列表: 按\n号分割
expired_timebodyinteger必需到期时间戳 单位秒 没有到期限制设置为-1
groupbodystring必需支持分组 按,号分割
model_limitsbodystring必需可用模型列表: 模型名字按,号分割
model_limits_enabledbodyboolean必需可用模型限制设置
namebodystring必需令牌名字
remain_quotabodyinteger必需50w为1刀
unlimited_quotabodyboolean必需无限额度设置
返回响应
application/json
data object
accessed_time integer最近访问时间(Unix 时间戳)
allow_ips stringIP 白名单,换行分隔
created_time integer创建时间(Unix 时间戳)
expired_time integer过期时间戳(秒);`-1` 表示永不过期
group string用户组 / 分组
id integer资源或任务 ID
key string令牌密钥(列表场景可能脱敏)
mj_custom_proxy stringMidjourney 自定义代理
mj_image_mode stringMidjourney 图片模式
model_limits string可用模型列表,逗号分隔
model_limits_enabled boolean是否启用模型限额
name string令牌名称(最长约 30)
remain_quota integer剩余额度
routing_priority string`""` | `auto` | `price` | `speed` | `success_rate`
status integer状态
total integer总数
unlimited_quota boolean是否不限额度
used_quota integer已用额度
user_id integer用户 ID
message string提示信息
success boolean是否成功
application/json
error* object
message* string错误说明(末尾常附带 request id)
type* string错误类型;网关本地错误一般为 new_api_error
application/json
error* object
message* string错误说明(末尾常附带 request id)
type* string错误类型;网关本地错误一般为 new_api_error
调用时需携带系统访问令牌和当前账号 ID,填写方式见 Header 参数。
响应为结构示例,实际错误文本以返回的 message 或 error.message 为准。
仅禁用令牌时,请求 PUT /api/token/?status_only=true,Body 为 {"id":123,"status":2}。启用时将 status 改为 1。