Skip to content

Credentials : Use this functionality in threads endpoint #169

@nishika26

Description

@nishika26

Currently, the /threads endpoint initializes the OpenAI client like this:

" client = OpenAI(api_key=settings.OPENAI_API_KEY)"

This pulls the API key from the global .env file, which is not ideal for multi-tenant setups.

Expected Behavior
The endpoint should:

  • Fetch the OpenAI API key from the credentials table based on the authenticated user's organization (UserOrganization)

  • Use that API key when initializing the OpenAI client

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions