ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend

Credentials: Validating Provider Keys

Aperta
#374 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

good first issue
Lingua principale
Python
Stelle
18
Fork
10
Merge medio
2g 20h
PR unite (30g)
14

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dall’endpoint delle credenziali e segui il modo in cui le chiavi dei provider vengono scritte nella tabella delle credenziali. Esamina la richiesta all’API OpenAI utilizzata per la validazione e la gestione degli errori dell’endpoint, quindi verifica che le chiavi valide vengano salvate, che le chiavi non valide vengano rifiutate con una spiegazione chiara e che una validazione non riuscita non renda persistente la chiave.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api, backend
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.