feat: configurable OpenAI API endpoint. #95

Closed
opened 2025-11-11 14:05:09 -06:00 by GiteaMirror · 27 comments
Owner

Originally created by @ahkhan03 on GitHub (Dec 15, 2023).

Originally assigned to: @tjbck on GitHub.

Is your feature request related to a problem? Please describe.
Make the API endpoint url configurable so the user can connect other OpenAI-compatible APIs with the web-ui.

Describe the solution you'd like
Make it configurable through environment variables or add a new field in the Settings > Add-ons.

Describe alternatives you've considered
Tried this but it is not open source and self-hostable.

Additional context
Nill.

Originally created by @ahkhan03 on GitHub (Dec 15, 2023). Originally assigned to: @tjbck on GitHub. **Is your feature request related to a problem? Please describe.** Make the API endpoint url configurable so the user can connect other OpenAI-compatible APIs with the web-ui. **Describe the solution you'd like** Make it configurable through environment variables or add a new field in the **Settings** > **Add-ons**. **Describe alternatives you've considered** Tried [this](https://www.typingmind.com/) but it is not open source and self-hostable. **Additional context** Nill.
Author
Owner

@justinh-rahb commented on GitHub (Dec 16, 2023):

Would love to see this as well. Supposedly the new Mistral API platform is OpenAI API compatible, so that too would be an option available that I'm personally most interested in right now. In addition to Azure OpenAPI endpoints, LiteLLM, etc.

Bonus if it doesn't need to be an either/or situation, like if we could add endpoints in addition to the default OpenAI one, that would be most beneficial.

@justinh-rahb commented on GitHub (Dec 16, 2023): Would love to see this as well. Supposedly the new Mistral API platform is OpenAI API compatible, so that too would be an option available that I'm personally most interested in right now. In addition to Azure OpenAPI endpoints, LiteLLM, etc. Bonus if it doesn't need to be an either/or situation, like if we could add endpoints in addition to the default OpenAI one, that would be most beneficial.
Author
Owner

@tjbck commented on GitHub (Dec 21, 2023):

Actively taking a look! One question I have is, how would users fetch the list of available models? Do other services offer api endpoints equivalent to https://api.openai.com/v1/models?

@tjbck commented on GitHub (Dec 21, 2023): Actively taking a look! One question I have is, how would users fetch the list of available models? Do other services offer api endpoints equivalent to `https://api.openai.com/v1/models`?
Author
Owner

@Flowm commented on GitHub (Dec 21, 2023):

The Mistral API seems to be very similar (Docs, API spec)

@Flowm commented on GitHub (Dec 21, 2023): The Mistral API seems to be very similar ([Docs](https://docs.mistral.ai/), [API spec](https://docs.mistral.ai/api/))
Author
Owner

@tjbck commented on GitHub (Dec 21, 2023):

@Flowm, Could you try to check if Mistral api supports the /models api route? Thanks!

@tjbck commented on GitHub (Dec 21, 2023): @Flowm, Could you try to check if Mistral api supports the `/models` api route? Thanks!
Author
Owner

@ahkhan03 commented on GitHub (Dec 21, 2023):

I tried it with mistral and anyscale, and both support /models route. I tried several others in the past few days, and all of them supported it, but I have confirmed for these two just now. They have additional fields in the returned JSON, but they all have data.id, data.object, and data.owned_by in common, which should be enough for integrating with OpenAI compatible tools.

@ahkhan03 commented on GitHub (Dec 21, 2023): I tried it with mistral and anyscale, and both support `/models` route. I tried several others in the past few days, and all of them supported it, but I have confirmed for these two just now. They have additional fields in the returned JSON, but they all have `data.id`, `data.object`, and `data.owned_by` in common, which should be enough for integrating with OpenAI compatible tools.
Author
Owner

@justinh-rahb commented on GitHub (Dec 21, 2023):

@tjbck I'd be happy to give you an API key (with an expiry date of course) for Mistral if it'll help you get this feature completed. You can find my contact info in my profile.

@justinh-rahb commented on GitHub (Dec 21, 2023): @tjbck I'd be happy to give you an API key (with an expiry date of course) for Mistral if it'll help you get this feature completed. You can find my contact info in my profile.
Author
Owner

@chymian commented on GitHub (Dec 22, 2023):

to name one more on the ever growing list of openAI compatible APIs with resonable pricing: together.ai

API-endpoint: https://api.together.xyz/
see: https://docs.together.ai/docs/openai-api-compatibility

they offer a $25 entry bonus and prices for 1M token between $0.1 to $0.9.
@Flowm @justinh-rahb , the also offer the new Mixtral Mod. for very reconable prices.

curl -s  https://api.together.xyz/v1/models -H "Content-Type: application/json"  -H "Authorization: Bearer 1bef28e8a23fa3a11xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"|jq
[
  {
    "id": "Austism/chronos-hermes-13b",
    "object": "model",
    "created": 1692896905
  },
  {
    "id": "DiscoResearch/DiscoLM-mixtral-8x7b-v2",
    "object": "model",
    "created": 1702245101
  },
  {
    "id": "EleutherAI/llemma_7b",
    "object": "model",
    "created": 1697837306
  },
  {
    "id": "Gryphe/MythoMax-L2-13b",
    "object": "model",
    "created": 1693943905
  },
  {
    "id": "Meta-Llama/Llama-Guard-7b",
    "object": "model",
    "created": 0
  },
  {
    "id": "Nexusflow/NexusRaven-V2-13B",
    "object": "model",
    "created": 1701796524
  },
  {
    "id": "NousResearch/Nous-Capybara-7B-V1p9",
    "object": "model",
    "created": 1701203533
  },
  {
    "id": "NousResearch/Nous-Hermes-Llama2-13b",
    "object": "model",
    "created": 1691017613
  },
  {
    "id": "NousResearch/Nous-Hermes-Llama2-70b",
    "object": "model",
    "created": 1697837306
  }
  
...
@chymian commented on GitHub (Dec 22, 2023): to name one more on the ever growing list of openAI compatible APIs with resonable pricing: __together.ai__ API-endpoint: https://api.together.xyz/ see: https://docs.together.ai/docs/openai-api-compatibility they offer a $25 entry bonus and prices for 1M token between $0.1 to $0.9. @Flowm @justinh-rahb , the also offer the new Mixtral Mod. for very reconable prices. ```bash curl -s https://api.together.xyz/v1/models -H "Content-Type: application/json" -H "Authorization: Bearer 1bef28e8a23fa3a11xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"|jq [ { "id": "Austism/chronos-hermes-13b", "object": "model", "created": 1692896905 }, { "id": "DiscoResearch/DiscoLM-mixtral-8x7b-v2", "object": "model", "created": 1702245101 }, { "id": "EleutherAI/llemma_7b", "object": "model", "created": 1697837306 }, { "id": "Gryphe/MythoMax-L2-13b", "object": "model", "created": 1693943905 }, { "id": "Meta-Llama/Llama-Guard-7b", "object": "model", "created": 0 }, { "id": "Nexusflow/NexusRaven-V2-13B", "object": "model", "created": 1701796524 }, { "id": "NousResearch/Nous-Capybara-7B-V1p9", "object": "model", "created": 1701203533 }, { "id": "NousResearch/Nous-Hermes-Llama2-13b", "object": "model", "created": 1691017613 }, { "id": "NousResearch/Nous-Hermes-Llama2-70b", "object": "model", "created": 1697837306 } ... ```
Author
Owner

@tjbck commented on GitHub (Dec 23, 2023):

Hey guys! Just added the custom api endpoint feature to #265 branch. If any of you guys could try it out and confirm that it works, I'll merge it to main! Thanks!

@tjbck commented on GitHub (Dec 23, 2023): Hey guys! Just added the custom api endpoint feature to #265 branch. If any of you guys could try it out and confirm that it works, I'll merge it to main! Thanks!
Author
Owner

@justinh-rahb commented on GitHub (Dec 23, 2023):

Hey guys! Just added the custom api endpoint feature to #265 branch. If any of you guys could try it out and confirm that it works, I'll merge it to main! Thanks!

@tjbck Loading the model names from the /models endpoint is working:
Screenshot 2023-12-22 at 11 55 51 PM

However, generation is not responding:
Screenshot 2023-12-22 at 11 58 15 PM

I got the same response with all models. Unfortunately the Docker log doesn't show me anything useful, anywhere else I can look or enable debugging?

@justinh-rahb commented on GitHub (Dec 23, 2023): > Hey guys! Just added the custom api endpoint feature to #265 branch. If any of you guys could try it out and confirm that it works, I'll merge it to main! Thanks! @tjbck Loading the model names from the /models endpoint is working: <img width="778" alt="Screenshot 2023-12-22 at 11 55 51 PM" src="https://github.com/ollama-webui/ollama-webui/assets/52832301/cee2d382-0e7c-4a37-a7da-30e2e7ad0705"> However, generation is not responding: <img width="778" alt="Screenshot 2023-12-22 at 11 58 15 PM" src="https://github.com/ollama-webui/ollama-webui/assets/52832301/d9f4d46d-4daa-4e8d-989f-5eb3f9dc1906"> I got the same response with all models. Unfortunately the Docker log doesn't show me anything useful, anywhere else I can look or enable debugging?
Author
Owner

@ahkhan03 commented on GitHub (Dec 23, 2023):

@tjbck I just tried this branch. The model list loads correctly, but it shows a CORS policy issue in the browser console.

Access to fetch at 'https://api.mistral.ai/v1/chat/completions' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field x-title is not allowed by Access-Control-Allow-Headers in preflight response.

POST https://api.mistral.ai/v1/chat/completions net::ERR_FAILED

TypeError: Failed to fetch
at window.fetch (start.c756bce8.js:1:1402)
at X (3.92fc93bc.js:4:1895)
at async 3.92fc93bc.js:1:6227
at async Promise.all (index 0)
at async z (3.92fc93bc.js:1:6142)
at async ce (3.92fc93bc.js:7:2070)```
@ahkhan03 commented on GitHub (Dec 23, 2023): @tjbck I just tried this branch. The model list loads correctly, but it shows a CORS policy issue in the browser console. ```Access to fetch at 'https://api.mistral.ai/v1/chat/completions' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field x-title is not allowed by Access-Control-Allow-Headers in preflight response.``` ```POST https://api.mistral.ai/v1/chat/completions net::ERR_FAILED``` ``` TypeError: Failed to fetch at window.fetch (start.c756bce8.js:1:1402) at X (3.92fc93bc.js:4:1895) at async 3.92fc93bc.js:1:6227 at async Promise.all (index 0) at async z (3.92fc93bc.js:1:6142) at async ce (3.92fc93bc.js:7:2070)```
Author
Owner

@tjbck commented on GitHub (Dec 23, 2023):

Just a header problem it seems like, I'll remove some fields and let you guys know!

@tjbck commented on GitHub (Dec 23, 2023): Just a header problem it seems like, I'll remove some fields and let you guys know!
Author
Owner

@tjbck commented on GitHub (Dec 23, 2023):

Please try again and let me know!

@tjbck commented on GitHub (Dec 23, 2023): Please try again and let me know!
Author
Owner

@ahkhan03 commented on GitHub (Dec 23, 2023):

I tested it for anyscale and mistral models and it is working perfectly now.

@ahkhan03 commented on GitHub (Dec 23, 2023): I tested it for anyscale and mistral models and it is working perfectly now.
Author
Owner

@justinh-rahb commented on GitHub (Dec 23, 2023):

I can archive my chatbot-ui forks now 😂

@justinh-rahb commented on GitHub (Dec 23, 2023): I can archive my chatbot-ui forks now 😂
Author
Owner

@tjbck commented on GitHub (Dec 23, 2023):

@ahkhan03 @justinh-rahb Thanks a lot! Could not have implemented this feature without you guys 😅

@tjbck commented on GitHub (Dec 23, 2023): @ahkhan03 @justinh-rahb Thanks a lot! Could not have implemented this feature without you guys 😅
Author
Owner

@justinh-rahb commented on GitHub (Dec 23, 2023):

@tjbck hoping to be able to contribute more, you've got the best UI going for Ollama AND ChatGPT/Mistral APIs right now. There's a lot of people getting interested in running local inference or using the API for privacy and solutions like this are key enablers. Here's to more in 2024! 🎉🚀

@justinh-rahb commented on GitHub (Dec 23, 2023): @tjbck hoping to be able to contribute more, you've got the best UI going for Ollama **AND** ChatGPT/Mistral APIs right now. There's a lot of people getting interested in running local inference or using the API for privacy and solutions like this are key enablers. Here's to more in 2024! 🎉🚀
Author
Owner

@davidsyoung commented on GitHub (Dec 29, 2023):

Thank you for implementing this, HUGELY appreciated!

By far the best UI.

I am using it with TabbyAPI (Exllamav2 API), and unfort they set max_tokens to a default of 150.

Would it be possible in some way to get configurable max_tokens in the UI? It could be called num_predict to be correct for the modelfile, and if sending to an external openai use num_tokens instead?

Edit: Implemented in #322 along with some small fixes. :)

@davidsyoung commented on GitHub (Dec 29, 2023): Thank you for implementing this, HUGELY appreciated! By far the best UI. I am using it with TabbyAPI (Exllamav2 API), and unfort they set max_tokens to a default of 150. Would it be possible in some way to get configurable max_tokens in the UI? It could be called num_predict to be correct for the modelfile, and if sending to an external openai use num_tokens instead? Edit: Implemented in #322 along with some small fixes. :)
Author
Owner

@tjbck commented on GitHub (Jan 5, 2024):

Hey guys! #381 migrates OpenAI API requests to the backend for proper multi-user support, I'd greatly appreciate if any one of you guys can help with the testing OpenAI compatible APIs, Thanks as always!

@tjbck commented on GitHub (Jan 5, 2024): Hey guys! #381 migrates OpenAI API requests to the backend for proper multi-user support, I'd greatly appreciate if any one of you guys can help with the testing OpenAI compatible APIs, Thanks as always!
Author
Owner

@ahkhan03 commented on GitHub (Jan 5, 2024):

I tested it with Anyscale and Mistral APIs, and it is working correctly for all users!!

@ahkhan03 commented on GitHub (Jan 5, 2024): I tested it with Anyscale and Mistral APIs, and it is working correctly for all users!!
Author
Owner

@tjbck commented on GitHub (Jan 5, 2024):

@ahkhan03 Thanks a lot!

@tjbck commented on GitHub (Jan 5, 2024): @ahkhan03 Thanks a lot!
Author
Owner

@justinh-rahb commented on GitHub (Jan 6, 2024):

Working with LiteLLM proxy for OpenAI, Mistral, Claude, etc. 👌
Screenshot 2024-01-06 at 2 51 28 AM

@justinh-rahb commented on GitHub (Jan 6, 2024): Working with LiteLLM proxy for OpenAI, Mistral, Claude, etc. 👌 <img width="756" alt="Screenshot 2024-01-06 at 2 51 28 AM" src="https://github.com/ollama-webui/ollama-webui/assets/52832301/1d027ac4-23d7-410e-a90e-64d497c512dc">
Author
Owner

@helenadeus commented on GitHub (Apr 6, 2024):

hello - how did you configure claude as a model? do you have it locally or is there a way to connect to the anthropic apis..?

@helenadeus commented on GitHub (Apr 6, 2024): hello - how did you configure claude as a model? do you have it locally or is there a way to connect to the anthropic apis..?
Author
Owner

@OpenWaygate commented on GitHub (Apr 25, 2024):

My endpoint don't support /models api, is there a way to call my endpoint directly? It's openai-compatible.

@OpenWaygate commented on GitHub (Apr 25, 2024): My endpoint don't support /models api, is there a way to call my endpoint directly? It's openai-compatible.
Author
Owner

@Averyy commented on GitHub (Jun 21, 2024):

You can add Claude by setting up litellm https://litellm.vercel.app/docs/proxy/deploy and then in Open WebUI you add your litellm ip/key in connections and it'll pull all your litellm.

Took a bit of tinkering but once you get it setup it works perfectly.

@Averyy commented on GitHub (Jun 21, 2024): You can add Claude by setting up litellm https://litellm.vercel.app/docs/proxy/deploy and then in Open WebUI you add your litellm ip/key in connections and it'll pull all your litellm. Took a bit of tinkering but once you get it setup it works perfectly.
Author
Owner

@justinh-rahb commented on GitHub (Jun 21, 2024):

You can add Claude by setting up litellm https://litellm.vercel.app/docs/proxy/deploy and then in Open WebUI you add your litellm ip/key in connections and it'll pull all your litellm.

Took a bit of tinkering but once you get it setup it works perfectly.

Or use our Pipelines server, this is now our preferred method for Azure/Anthropic/Cohere/Google API access and much more.

@justinh-rahb commented on GitHub (Jun 21, 2024): > You can add Claude by setting up litellm https://litellm.vercel.app/docs/proxy/deploy and then in Open WebUI you add your litellm ip/key in connections and it'll pull all your litellm. > > Took a bit of tinkering but once you get it setup it works perfectly. Or use our [Pipelines](https://github.com/open-webui/pipelines) server, this is now our preferred method for Azure/Anthropic/Cohere/Google API access and much more.
Author
Owner

@Averyy commented on GitHub (Jun 25, 2024):

You can add Claude by setting up litellm https://litellm.vercel.app/docs/proxy/deploy and then in Open WebUI you add your litellm ip/key in connections and it'll pull all your litellm.
Took a bit of tinkering but once you get it setup it works perfectly.

Or use our Pipelines server, this is now our preferred method for Azure/Anthropic/Cohere/Google API access and much more.

Oh I didn't even realize this was an alternative, thanks will check it out.

@Averyy commented on GitHub (Jun 25, 2024): > > You can add Claude by setting up litellm https://litellm.vercel.app/docs/proxy/deploy and then in Open WebUI you add your litellm ip/key in connections and it'll pull all your litellm. > > Took a bit of tinkering but once you get it setup it works perfectly. > > Or use our [Pipelines](https://github.com/open-webui/pipelines) server, this is now our preferred method for Azure/Anthropic/Cohere/Google API access and much more. Oh I didn't even realize this was an alternative, thanks will check it out.
Author
Owner

@stanus74 commented on GitHub (Sep 6, 2024):

Thank you for implementing this, HUGELY appreciated!

By far the best UI.

I am using it with TabbyAPI (Exllamav2 API), and unfort they set max_tokens to a default of 150.

Would it be possible in some way to get configurable max_tokens in the UI? It could be called num_predict to be correct for the modelfile, and if sending to an external openai use num_tokens instead?

Edit: Implemented in #322 along with some small fixes. :)

i can use tabbyapi with curl. i want use with openwebui . what is the endpoint. http://ip:8080 and set auth code dont work for me

@stanus74 commented on GitHub (Sep 6, 2024): > Thank you for implementing this, HUGELY appreciated! > > By far the best UI. > > I am using it with TabbyAPI (Exllamav2 API), and unfort they set max_tokens to a default of 150. > > Would it be possible in some way to get configurable max_tokens in the UI? It could be called num_predict to be correct for the modelfile, and if sending to an external openai use num_tokens instead? > > Edit: Implemented in #322 along with some small fixes. :) i can use tabbyapi with curl. i want use with openwebui . what is the endpoint. http://ip:8080 and set auth code dont work for me
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#95