账户计费面板模块

功能说明

接口前缀为:

  1. 主站:https://ai.burncloud.com
  2. 企业站:https://b.burncloud.com

OpenAI SDK 兼容的计费查询接口。使用 Token 认证,提供订阅信息和使用量查询。主要用于第三方应用和 SDK 集成,确保与 OpenAI API 的完全兼容性。

🔐 用户鉴权

获取订阅额度信息

💡 请求示例:

const response = await fetch('/dashboard/billing/subscription', {  
  method: 'GET',  
  headers: {  
    'Content-Type': 'application/json',  
    'Authorization': 'Bearer your_user_token',
    'New-Api-User': 'Bearer your_user_id'
  }  
});  
const data = await response.json();

✅ 成功响应示例:

{  
  "object": "billing_subscription",  
  "has_payment_method": true,  
  "soft_limit_usd": 100.0,  
  "hard_limit_usd": 100.0,  
  "system_hard_limit_usd": 100.0,  
  "access_until": 1640995200  
}

❗ 失败响应示例:

{  
  "error": {  
    "message": "获取配额失败",  
    "type": "upstream_error"  
  }  
}

🧾 字段说明:

兼容 OpenAI SDK 路径 - 获取订阅额度信息

💡 请求示例:

const response = await fetch('/v1/dashboard/billing/subscription', {  
  method: 'GET',  
  headers: {  
    'Content-Type': 'application/json',  
    'Authorization': 'Bearer your_user_token',
    'New-Api-User': 'Bearer your_user_id'
  }  
});  
const data = await response.json();

✅ 成功响应示例:

{  
  "object": "billing_subscription",  
  "has_payment_method": true,  
  "soft_limit_usd": 100.0,  
  "hard_limit_usd": 100.0,  
  "system_hard_limit_usd": 100.0,  
  "access_until": 1640995200  
}

❗ 失败响应示例:

{  
  "error": {  
    "message": "获取配额失败",  
    "type": "upstream_error"  
  }  
}

🧾 字段说明:

获取使用量信息

💡 请求示例:

const response = await fetch('/dashboard/billing/usage', {  
  method: 'GET',  
  headers: {  
    'Content-Type': 'application/json',  
    'Authorization': 'Bearer your_user_token',
    'New-Api-User': 'Bearer your_user_id'
  }  
});  
const data = await response.json();

✅ 成功响应示例:

{  
  "object": "list",  
  "total_usage": 2500.0  
}

❗ 失败响应示例:

{  
  "error": {  
    "message": "获取使用量失败",  
    "type": "new_api_error"  
  }  
}

🧾 字段说明:

兼容 OpenAI SDK 路径 - 获取使用量信息

💡 请求示例:

const response = await fetch('/v1/dashboard/billing/usage', {  
  method: 'GET',  
  headers: {  
    'Content-Type': 'application/json',  
    'Authorization': 'Bearer your_user_token',
    'New-Api-User': 'Bearer your_user_id'
  }  
});  
const data = await response.json();

✅ 成功响应示例:

{  
  "object": "list",  
  "total_usage": 2500.0  
}

❗ 失败响应示例:

{  
  "error": {  
    "message": "获取使用量失败",  
    "type": "new_api_error"  
  }  
}

🧾 字段说明:


Revision #1
Created 30 October 2025 04:07:24 by Burncloud
Updated 30 October 2025 04:08:01 by Burncloud