ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend
Credentials: Validating Provider Keys
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18
- 派生
- 10
- 平均合并
- 2 天 20 小时
- 30 天内合并 PR
- 14
描述
Describe the current behavior
Currently, when a user provides an OpenAI API key through the credentials endpoint, the key is saved directly to the credentials table without any validation. This means invalid, expired, or incorrectly formatted keys can be stored in the database. Users only discover the key is invalid later when they attempt to use it for LLM operations, leading to failed requests and a poor user experience.
Describe the enhancement you'd like
Add a validity check for OpenAI API keys before saving them to the credentials table. The validation should:
- Accept the API key from the user via the credentials endpoint
- Make a test request to OpenAI's API using the provided key (e.g., a lightweight call to list models or verify credentials)
- Only save the key to the database if the validation succeeds
- Return a clear error message to the user if the key is invalid, explaining why it failed
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从凭据端点开始,跟踪提供商密钥是如何写入凭据表的。检查用于验证的 OpenAI API 请求和端点的错误处理,然后确认有效密钥会被保存,无效密钥会在提供清晰说明的情况下被拒绝,并且验证失败不会持久化该密钥。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- api, backend
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100