1. 令牌
梧柏API使用文档
WHBAI · 账号与令牌
  • WHBAI · Google Gemini 原生 (v1alpha)
  • WHBAI · Google Gemini 原生
  • WHBAI · Ideogram
  • WHBAI · Ideogram V3
  • WHBAI · Midjourney
  • WHBAI · Jimeng
  • WHBAI · Kling
  • WHBAI · Luma
  • WHBAI · Luma V1
  • WHBAI · Omni 视频
  • WHBAI · Pixverse
  • WHBAI · Runway
  • WHBAI · Sora2
  • WHBAI · 统一视频 VEO
  • WHBAI · Vidu
  • WHBAI · 豆包 Volc
  • WHBAI · Suno
  • WHBAI · Playground
  • WHBAI · 账号与令牌
  • WHBAI · 阿里 Pix
  • WHBAI · 阿里百炼
  • WHBAI · 私域人像
  • WHBAI · Fal.ai
  • WHBAI · Replicate
  • WHBAI · 腾讯云 VOD
  • WHBAI · MiniMax
  • WHBAI · 支持模型列表
  • WHBAI · Grok Imagine
  • WHBAI · Seedance 2.0
  • WHBAI · TypeSafe
  • WHBAI · OpenAI 兼容
  • 系统管理
    • 令牌
      • 获取令牌列表
        GET
      • 新增令牌
        POST
      • 修改令牌
        PUT
      • 搜索令牌
        GET
      • 批量修改令牌
        PUT
      • 删除令牌
        DELETE
      • 获取令牌使用情况
        GET
    • 账号
      • 获取账号信息
    • 图床
      • 上传图片
  • 数据模型
    • ApiEnvelope
    • Token
    • TokenCreate
    • TokenUpdate
    • TokenBatchUpdate
    • TokenUsage
    • UserSelf
    • ApiSuccessPageTokens
    • ApiSuccessToken
    • ApiSuccessTokenList
    • ApiSuccessString
    • ApiSuccessInt
    • ApiSuccessEmpty
    • ApiSuccessTokenUsage
    • ApiSuccessUser
    • NewApiError
  1. 令牌

新增令牌

POST
/api/token/
创建新的 API 令牌。成功时 data 为完整密钥字符串(形如 sk-...),请立即保存。

网站中的模型与调用示例#

新增令牌#

请求参数#

{
  "contentType": "application/json",
  "properties": {
    "allow_ips": {
      "description": "白名单IP列表:  按\\n号分割",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "IP whitelist: entries separated by newlines"
        }
      }
    },
    "expired_time": {
      "description": "到期时间戳  单位秒 没有到期限制设置为-1",
      "type": "integer",
      "x-i18n": {
        "en-US": {
          "description": "Expiration unix timestamp in seconds. Set to -1 for no expiration."
        }
      }
    },
    "group": {
      "description": "支持分组  按,号分割",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Supported groups: separated by commas"
        }
      }
    },
    "model_limits": {
      "description": "可用模型列表:  模型名字按,号分割",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Available models list: model names separated by commas"
        }
      }
    },
    "model_limits_enabled": {
      "description": "可用模型限制设置",
      "type": "boolean",
      "x-i18n": {
        "en-US": {
          "description": "Available models restriction setting"
        }
      }
    },
    "name": {
      "description": "令牌名字",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Token name"
        }
      }
    },
    "remain_quota": {
      "description": "50w为1刀",
      "type": "integer",
      "x-i18n": {
        "en-US": {
          "description": "500,000 quota units = $1"
        }
      }
    },
    "unlimited_quota": {
      "description": "无限额度设置",
      "type": "boolean",
      "x-i18n": {
        "en-US": {
          "description": "Unlimited quota setting"
        }
      }
    }
  },
  "required": [
    "name",
    "remain_quota",
    "expired_time",
    "unlimited_quota",
    "model_limits_enabled",
    "model_limits",
    "allow_ips",
    "group"
  ]
}

请求示例 · 示例 1#

{
  "allow_ips": "",
  "expired_time": -1,
  "group": "",
  "mj_custom_proxy": "",
  "mj_image_mode": "default",
  "model_limits": "",
  "model_limits_enabled": false,
  "name": "令牌名字",
  "remain_quota": 250000000000,
  "selected_groups": [],
  "unlimited_quota": false
}

请求参数

Authorization
Bearer Token
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
or
Header 参数

Body 参数application/json必填

示例
{
    "allow_ips": "",
    "expired_time": -1,
    "group": "",
    "mj_custom_proxy": "",
    "mj_image_mode": "default",
    "model_limits": "",
    "model_limits_enabled": false,
    "name": "令牌名字",
    "remain_quota": 250000000000,
    "selected_groups": [],
    "unlimited_quota": false
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location '/api/token/' \
--header 'New-Api-User: 1' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "allow_ips": "",
    "expired_time": -1,
    "group": "",
    "mj_custom_proxy": "",
    "mj_image_mode": "default",
    "model_limits": "",
    "model_limits_enabled": false,
    "name": "令牌名字",
    "remain_quota": 250000000000,
    "selected_groups": [],
    "unlimited_quota": false
}'

返回响应

🟢200成功
application/json
成功;data 为 sk- 密钥
Bodyapplication/json

示例
{
    "success": true,
    "message": "string",
    "data": "string"
}
🟠400请求有误
🟠401没有权限
修改于 2026-10-24 18:33:21
上一页
获取令牌列表
下一页
修改令牌
Built with