openai-billing-api
v1.0.4
Published
Integrating OpenAI Billing API with TypeScript and Axios
Downloads
2
Readme
openai-billing-api
Install
npm install openai-billing-api
Usage
import { BillingApi } from 'openai-billing-api';
const api = new BillingApi({
apiKey: 'sk-xxxx',
sesssionKey: 'sess-xxxx',
organization: 'org-xxx',
});
await api.getSubscriptions();
see more: test cases
API
getSubscriptions()
查订阅信息
getCreditGrants()
查普通账单
此接口需要从 网页获取 sessionKey
getBillingUsage(startDate, endDate)
查使用量
getDayUsage(date)
查日使用量
日期格式统一为:YYYY-MM-DD, 如 2023-05-01.