Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新日志

## 1.4.1 - 2026-09-10

- `/newapi quota` 不再要求 AstrBot 管理员权限,与 `/newapi channel`、`/newapi flow` 保持一致,所有绑定实例的会话均可使用。

## 1.4.0 - 2026-09-09

- 新增 `/newapi quota`,生成全部渠道的额度图,突出周额度并展示 5 小时额度、当前窗口和主动重置次数。
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 命令

命令仅限 AstrBot 管理员使用
命令不要求 AstrBot 管理员权限,只有绑定了 new-api 实例的会话可以执行

- `/newapi channel`:列出所有渠道;订阅渠道会同时查询 Account Info
- `/newapi channel <渠道名称或 ID>`:查看渠道详情和可用的 Account Info
Expand Down Expand Up @@ -68,7 +68,7 @@ Codex 仅展示主账户周额度,忽略附加限额(包括 `gpt-5.3-codex-s

流图以 3600 × 2240 为最小画布,并根据实际列数、标签宽度和各列节点数量自动扩大。提高 Top N 会显示更多节点,同时自动增加画布高度,避免标签从上下边缘溢出。

命令行时间范围支持分钟(`m`)、小时(`h`)和天(`d`),最大为 30 天;必须带单位,裸数字不会被接受。
命令行时间范围支持分钟(`m`)、小时(`h`)、天(`d`),最大为 30 天;必须带单位,裸数字不会被接受。

渠道列表中的“计费额度”来自 new-api 的 `used_quota`,并使用 `/api/status` 返回的 `quota_per_unit` 将渠道 USD 余额换算为相同单位。它是 new-api 的内部计费额度,不等同于 Flow 中的实际请求 token 数。

Expand Down
5 changes: 2 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ class NewApiInstance:
"astrbot_plugin_newapi",
"team-s2",
"查询 new-api 渠道信息并绘制配额图与 Dashboard 流图",
"1.4.0",
"1.4.1",
)
class NewApiPlugin(star.Star):
"""Expose read-only new-api administration commands to AstrBot admins."""
"""Expose read-only new-api commands to sessions bound to an instance."""

def __init__(self, context: star.Context, config: AstrBotConfig) -> None:
"""Initialize the plugin from AstrBot configuration.
Expand Down Expand Up @@ -356,7 +356,6 @@ async def _show_channel(
yield event.plain_result(f"查询 new-api 失败:{error}")

@newapi.command("quota")
@filter.permission_type(filter.PermissionType.ADMIN)
async def quota(self, event: AstrMessageEvent):
"""Send a quota image for every channel in the bound instance."""
try:
Expand Down
2 changes: 1 addition & 1 deletion metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: astrbot_plugin_newapi
display_name: new-api 管理
desc: 按 AstrBot 会话查询多个 new-api 实例的渠道、订阅套餐余量并绘制 Dashboard Flow
short_desc: 按会话查看多个 new-api 实例的渠道、套餐余量和 token 流向
version: 1.4.0
version: 1.4.1
author: team-s2
repo: https://github.com/team-s2/astrbot_plugin_newapi