1. APIkey
OpenAI-Hub接口文档
  • 对接说明
  • APIkey
    • 获取 API Key 列表
      GET
    • 搜索 API Key
      GET
    • 获取 API Key 详情
      GET
    • 获取 API Key 明文
      POST
    • 新建 API Key
      POST
    • 修改 API Key
      PUT
    • 删除 API Key
      DELETE
    • 批量删除 API Key
      POST
    • 批量获取 API Key 明文
      POST
  • 消费日志
    • 获取消费日志
    • 获取消费统计
AI模型接口图片异步提交后台管理接口
AI模型接口图片异步提交后台管理接口
  1. APIkey

修改 API Key

PUT
/api/token/
修改本人名下某条 API Key。

两种调用模式#

仅修改状态(快捷启用/禁用):URL 加上 ?status_only=1,body 只传 id + status 即可
全量修改:不传 status_only,body 需传完整字段(未传字段会被默认零值覆盖)

状态转移限制#

将 status 改回 1(启用)时:
若原状态 = 3 且 expired_time 已超期且 ≠ -1,拒绝
若原状态 = 4 且 remain_quota ≤ 0 且非无限额度,拒绝

请求参数

Query 参数

Header 参数

Body 参数application/json

示例

返回响应

🟢200成功
application/json
Bodyapplication/json

请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request PUT 'https://api.openai-hub.com/api/token/' \
--header 'Authorization: Bearer sk-0ABIEXVjh9****Qckjy' \
--header 'New-Api-User: 1' \
--header 'Content-Type: application/json' \
--data '{
    "id": 123,
    "status": 1,
    "name": "string",
    "expired_time": 0,
    "remain_quota": 0,
    "unlimited_quota": true,
    "model_limits_enabled": true,
    "model_limits": "string",
    "allow_ips": "string",
    "group": "string",
    "cross_group_retry": true
}'
响应示例响应示例
{
    "success": true,
    "message": "string",
    "data": {
        "id": 0,
        "name": "string",
        "key": "string",
        "status": 0,
        "group": "string",
        "remain_quota": 0,
        "unlimited_quota": true,
        "expired_time": 0
    }
}
上一页
新建 API Key
下一页
删除 API Key
Built with