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-CLI | 用于管理渠道和用户的 Python 包 #1754

Open
RexWzh opened this issue Aug 20, 2024 · 3 comments
Open

One-API-CLI | 用于管理渠道和用户的 Python 包 #1754

RexWzh opened this issue Aug 20, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@RexWzh
Copy link

RexWzh commented Aug 20, 2024

写了个 Python 包,用于管理渠道和用户,其他功能根据需求更新。

安装方式:pip install one-api-cli

使用示例:https://github.com/cubenlp/one-api-cli/blob/main/demo/one-api.ipynb

在这个位置 https://{one-api-url}/panel/profile 获取鉴权令牌。

深度截图_选择区域_20240820234606

渠道基本操作:

from one_api_cli import OneAPI, Channel
# 默认从环境变量读取鉴权
auth = OneAPI() # auth = OneAPI(access_token="", one_api_url="")

# 创建渠道
ch = auth.create_channel(name="test", key='sk-123', base_url = 'https://api.openai.com', models='gpt-test')

# 获取所有渠道
all_chs = auth.get_channels()
newch = Channel(1) # 获取指定渠道

# 更新渠道信息
newch.update(name="update_name", models='gpt-3.5-turbo')

Issue 提到计划转成组织号,如果弄了,这个仓库可以迁移过去。
另外,个人有一些 Github 组织号维护经验,包括 lean-zhcubenlp ,不过没学过 go 语言,有需要可以交流~ @songquanpeng

@RexWzh
Copy link
Author

RexWzh commented Aug 21, 2024

site options 是指 https://{one-api-url}/panel/setting 下的内容吗?

web 端(berry 主题) 可以在管理页面里 panel/profile 查看密钥,刚看到访问 /api/user/token 也可以。
image

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

No branches or pull requests

2 participants
@RexWzh and others