ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend
Credentials: Validating Provider Keys
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18
- Forks
- 10
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 14
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the credentials endpoint and trace how provider keys are written to the credentials table. Review the OpenAI API request used for validation and the endpoint's error handling, then verify that valid keys are saved, invalid keys are rejected with a clear explanation, and failed validation does not persist the key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100