callstack / callstack/ai-cli

feat: cost warning

未关闭
#31 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
46
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

**Is your feature request related to a problem? Please describe.**
Currently there is a scenario when AI CLI can make expensive API call without user confirmation. This happens when user use `--file` option and asks a query in CLI params. In such case, even when the price threshold is exceeded and user gets a warning, he is not able to prevent this API call.

**Describe the solution you'd like**
In case file context is used, and user exceeds warning threshold for context and, and there is a query in CLI params: then CLI should ask user to confirm if it should make the API call before making it.

```shell-session
# ai -i --file file.md Some question
Using the provided file will increase conversation costs by $1.1193 per message.
Do you want to continue? [y/N]:
```

**Describe alternatives you've considered**
Warning as is, but there is a risk of making expensive API can which user would not want if he knew the costs.

**Additional context**
We should use current cost calculation features.
In rare case cost is not available, we should refer to token count.

贡献指南

打开贡献指南

调研方向

首先跟踪查询作为 CLI 参数提供时 --file 选项现有的成本计算和警告流程。当超出上下文成本阈值时,在 API 调用前请求确认,并在成本不可用时使用 token 数量,即表示工作完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
ai, cli
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。