配置步骤

  1. 在 CC Switch 打开已经保存的 青云TOP API Provider。
  2. 点击 Provider 卡片上的 配置用量查询。
  3. 开启用量查询,预设模板选择 自定义。
  4. 保持 {{apiKey}} 为掩码状态,不要在截图中显示完整令牌。
  5. 粘贴下面的配置:
({
  request: {
    url: "https://top.qingyuntop.ai/api/usage/token/",
    method: "GET",
    headers: {
      "Authorization": "Bearer {{apiKey}}",
      "User-Agent": "cc-switch/1.0"
    }
  },
  extractor: function(response) {
    if (response.code === true && response.data) {
      return {
        isValid: true,
        planName: response.data.name,
        remaining: response.data.total_available,
        used: response.data.total_used,
        total: response.data.total_granted,
        unit: "quota"
      };
    }
    return {
      isValid: false,
      invalidMessage: response.message || "查询失败"
    };
  }
})

青云TOP API 模型令牌用量查询脚本

亚太合作伙伴平台把域名改为 https://top.qingyuntop.ai。点击 格式化 检查语法,再点击 测试脚本 和 保存配置。

Provider 卡片已经显示 青云TOP API 已用与剩余额度