ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend

Credentials: Validating Provider Keys

Open
#374 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.