💡 CC-Switch 配置余额显示方法
按照以下步骤即可快速完成 CC-Switch 的用量及余额查询配置:
📝 操作步骤
进入配置页面
点击界面中的 配置用量查询 按钮。
选择模板
选择预设模板。
填入配置代码
复制并粘贴下方代码至对应的配置框中:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| ({ request: { url: "{{baseUrl}}/v1/usage", method: "GET", headers: { "Authorization": "Bearer {{apiKey}}" } }, extractor: function(response) { const remaining = response?.remaining ?? response?.quota?.remaining ?? response?.balance; const unit = response?.unit ?? response?.quota?.unit ?? "USD"; return { isValid: response?.is_active ?? response?.isValid ?? true, remaining, unit }; } })
|