Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为 One API 依照 OpenAI 格式实现余额查询相关接口 #92

Closed
ickacn opened this issue May 18, 2023 · 2 comments
Closed

为 One API 依照 OpenAI 格式实现余额查询相关接口 #92

ickacn opened this issue May 18, 2023 · 2 comments
Labels
enhancement New feature or request priority This will have high priority.

Comments

@ickacn
Copy link

ickacn commented May 18, 2023

目前前端是用的ChatGPT-Next-Web,後端用ONE-API,然後接到AZ,沒有使用openai的,然後在web頁面手動填寫one api產生的KEY使用。
發現在ChatGPT-Next-Web的log中會顯示類似下面的內容
[User IP] ...
[Time] 5/16/2023, 10:51:21 AM
[Auth] use user api key
[Proxy] dashboard/billing/subscription?path=dashboard&path=billing&path=subscription
[Base Url] https://one-api-ip
[OpenAI Request] invalid api key provided Bearer 5971a218b241415aa7159248af2e20ba
[OpenAI Route] params { path: [ 'dashboard', 'billing', 'usage' ] }
[Auth] allowed hashed codes: [ '4c9184f37cff01bcdc32dc486ec36961' ]
[Auth] hashed access code: d41d8cd98f00b204e9800998ecf8427e
[Auth] got access code:
[User IP] ...
[User IP] ...
[Proxy] dashboard/billing/usage?start_date=2023-05-01&end_date=2023-05-17&path=dashboard&path=billing&path=usage
[OpenAI Parse] [SyntaxError: Unexpected token < in JSON at position 0]
[OpenAI Route] params { path: [ 'dashboard', 'billing', 'subscription' ] }

是不是這樣的可以直接返回當前令牌的剩餘額度之類的,畢竟那個key是one-api產生的。

@songquanpeng
Copy link
Owner

是的,本来就是要这样搞,还没来得及实现。

@songquanpeng songquanpeng added enhancement New feature or request priority This will have high priority. labels May 18, 2023
@songquanpeng songquanpeng changed the title 建議將一些前端的API剩餘額度查詢劫持顯示為one api的剩餘額度 为 One API 依照 OpenAI 格式实现余额查询相关接口 May 18, 2023
@songquanpeng
Copy link
Owner

已实现,返回的是用户账户的剩余额度。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority This will have high priority.
Projects
None yet
Development

No branches or pull requests

2 participants