chatgpt-web
chatgpt-web copied to clipboard
Allow alternative OpenAI-compatible endpoints
Context
This PR introduces functionality to allow users to specify a custom OpenAI-compatible API endpoint in addition to the default OpenAI API. The main goal behind this is to enable the usage of alternative endpoints such as self-hosted or third-party services. At stadt.werk, we use this feature to interact with our own self-hosted OpenAI-compatible server.
The enhancement extends the flexibility of the existing interface by letting users switch between OpenAI’s official endpoint (default behaviour) and their own custom endpoint through the UI. Additionally, the PR refines model fetching, which is essential for any non-OpenAI endpoints.
Compatability
- This change is fully backward-compatible with existing OpenAI API usage. If no custom endpoint is specified, the application will default to using OpenAI’s API as before.
- The enhancements have been tested with both OpenAI’s API and OpenAI-compatible llama.cpp infrastructure.
- Users who do not require a custom endpoint will not be affected by these changes.
We'd love to see this enhancement merged into chatgpt-web
, since we believe this can be a great feature that has also been mentioned a few times (here and here, for example).
Looking forward to feedback.