danny-avila / LibreChat

Enhanced ChatGPT Clone: Features Anthropic, AWS, OpenAI, Assistants API, Azure, Groq, o1, GPT-4o, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, langchain, DALL-E-3, ChatGPT Plugins, OpenAI Functions, Secure Multi-User System, Presets, completely open-source for self-hosting. Actively in public development.
https://librechat.ai/
MIT License
18.59k stars 3.13k forks source link

Enhancement: Pass OpenAI Organization ID to OpenAI API requests #1570

Closed shaggy245 closed 9 months ago

shaggy245 commented 9 months ago

What is your question?

OpenAI documentation notes the ability to set an explicit organization ID via HTTP header (in addition to the API key). Is there an option to set an OpenAI organization ID in LibreChat's OpenAI configuration so that it is included in all API requests to OpenAI?

More Details

I hope to lock down LibreChat to a specific OpenAI organization ID so that, in the event that the associated OpenAI user is added to multiple Open AI organizations, API calls from LibreChat are still associated with an explicitly configured OpenAI organization.

I searched LibreChat docs, GitHub issues, and code and did not see anything obvious. Thanks!

What is the main subject of your question?

Endpoints

Screenshots

No response

Code of Conduct

danny-avila commented 9 months ago

Thanks for checking out the project!

Not currently but this a good suggestion and easily implemented, will mark this as planned.

danny-avila commented 9 months ago

You can now specify which organization to use for each API request to OpenAI. However, it is not required if you are only part of a single organization or intend to use your default organization. You can check your default organization here.

This can also help you limit your LibreChat instance from allowing API keys outside of your organization to be used, as a mismatch between key and organization will throw an API error.

OPENAI_ORGANIZATION=org-Y6rfake63IhVorgqfPQmGmgtId

All outgoing requests to OpenAI, including langchain/plugin requests, should result in error 401 no such organization if the org id is invalid or there is a mismatch.

PR #1590