# 序言

若您觉得手动一一创建令牌过于繁琐,建议您考虑使用我们的控制台API接口进行自动化处理。前提是,您需要具备一定的编程基础。

操作步骤如下:

获取账户令牌 (opens new window): 首先,访问控制台-个人中心 (opens new window)页面,获取您的账户令牌 (opens new window)(Token)。

请求设置: 在发起请求时,在HTTP请求的头部(headers)中加入身份验证信息。这一步骤与OpenAI的身份验证方式相同,确保您的请求被正确授权。

接口文档参考: 以下仅提供了创建令牌 (opens new window)的接口文档。如需了解更多接口信息,请在浏览器自行抓包查看接口

通过对接控制台API接口,您可以更高效、自动化地管理令牌 (opens new window)创建过程,节省宝贵的时间和精力。请确保您在操作前已熟悉相关的编程操作和安全措施。

如图

# POST 创建单个令牌 (opens new window)

POST /api/token/

Body Parameters

{
  "name": "默认令牌",
  "remain_quota": 5000000,
  "unlimited_quota": true,
  "expired_time": 1702974333,
  "billing_type": 4,
  "ip_whitelist": "",
  "models": "",
  "ad_position": -1,
  "advertisement": ""
}

# Params

Name Location Type Required Description
Authorization header string yes 获取方式是在个人中心页面生成账户访问令牌
body body object yes none
name body string yes 令牌名称
remain_quota body integer yes 令牌额度 1额度是500000 10额度是5000000
unlimited_quota body boolean yes 是否无限制额度 false/true
expired_time body integer yes 到期时间(时间戳) 设置-1为永不过期
billing_type body integer yes 扣费方式 1、按量付费2、按次收费3、混合收费4、按量优先5、按次优先 默认按量优先
models body string yes 模型限制,不填默认支持所有模型,逗号隔开的形式
ip_whitelist body string¦null yes IP白名单限制,不配置默认为不限制ip,配置后仅允许配置的ip调用接口
ad_position body integer no none
advertisement body string no none

Response Examples

200 Response

{}

# Responses

HTTP Status Code Meaning Description Data schema
200 OK (opens new window) 成功 Inline

# Responses Data Schema