unable to connect to perplexity api #1225

Closed
opened 2025-11-11 14:40:30 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @TheNasa on GitHub (Jun 12, 2024).

Bug Report

Description

unable to use perplexity api https://api.perplexity.ai
on perplexity docs
https://docs.perplexity.ai/docs/getting-started#:~:text=Our%20supported%20models%20are%20listed,easy%20integration%20with%20existing%20applications.
it said that its openai compatible
Bug Summary:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.perplexity', port=443): Max retries exceeded with url: /models (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fe3ff085510>: Failed to resolve 'api.perplexity' ([Errno -2] Name or service not known)"))
INFO: 192.168.100.12:0 - "GET /openai/models/0 HTTP/1.1" 500 Internal Server Error

Steps to Reproduce:
[Outline the steps to reproduce the bug. Be as detailed as possible.]

Expected Behavior:
connected to perplexity api

Actual Behavior:
[error] OpenAI: Network Problem

Environment

  • Open WebUI Version: [e.g., 0.3.2]

  • Operating System: [docker]

Reproduction Details

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.

Logs and Screenshots

Browser Console Logs:
[Include relevant browser console logs, if applicable]

Docker Container Logs:
[Include relevant Docker container logs, if applicable]

Screenshots (if applicable):
[Attach any relevant screenshots to help illustrate the issue]

Installation Method

[Describe the method you used to install the project, e.g., manual installation, Docker, package manager, etc.]

Additional Information

[Include any additional details that may help in understanding and reproducing the issue. This could include specific configurations, error messages, or anything else relevant to the bug.]

Note

If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!

Originally created by @TheNasa on GitHub (Jun 12, 2024). # Bug Report ## Description unable to use perplexity api https://api.perplexity.ai on perplexity docs https://docs.perplexity.ai/docs/getting-started#:~:text=Our%20supported%20models%20are%20listed,easy%20integration%20with%20existing%20applications. it said that its openai compatible **Bug Summary:** requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.perplexity', port=443): Max retries exceeded with url: /models (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fe3ff085510>: Failed to resolve 'api.perplexity' ([Errno -2] Name or service not known)")) INFO: 192.168.100.12:0 - "GET /openai/models/0 HTTP/1.1" 500 Internal Server Error **Steps to Reproduce:** [Outline the steps to reproduce the bug. Be as detailed as possible.] **Expected Behavior:** connected to perplexity api **Actual Behavior:** [error] OpenAI: Network Problem ## Environment - **Open WebUI Version:** [e.g., 0.3.2] - **Operating System:** [docker] ## Reproduction Details **Confirmation:** - [ ] I have read and followed all the instructions provided in the README.md. - [ ] I am on the latest version of both Open WebUI and Ollama. - [ ] I have included the browser console logs. - [ ] I have included the Docker container logs. ## Logs and Screenshots **Browser Console Logs:** [Include relevant browser console logs, if applicable] **Docker Container Logs:** [Include relevant Docker container logs, if applicable] **Screenshots (if applicable):** [Attach any relevant screenshots to help illustrate the issue] ## Installation Method [Describe the method you used to install the project, e.g., manual installation, Docker, package manager, etc.] ## Additional Information [Include any additional details that may help in understanding and reproducing the issue. This could include specific configurations, error messages, or anything else relevant to the bug.] ## Note If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
Author
Owner

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

It seems like the host being requested is api.perplexity and not api.perplexity.ai

@justinh-rahb commented on GitHub (Jun 12, 2024): It seems like the host being requested is `api.perplexity` and not `api.perplexity.ai`
Author
Owner

@TheNasa commented on GitHub (Jun 12, 2024):

It seems like the host being requested is api.perplexity and not api.perplexity.ai

sorry that part of the log is when im trying with different url
this is the log for https://api.perplexity.ai/

INFO:config:Saving 'OPENAI_API_BASE_URLS' to config.json
INFO: 192.168.100.12:0 - "POST /openai/urls/update HTTP/1.1" 200 OK
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://api.perplexity.ai/models')
INFO:config:Saving 'OPENAI_API_KEYS' to config.json
INFO: 192.168.100.12:0 - "POST /openai/keys/update HTTP/1.1" 200 OK
INFO:apps.openai.main:get_all_models()
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://api.perplexity.ai/models')
ERROR:apps.openai.main:404 Client Error: Not Found for url: https://api.perplexity.ai/models
Traceback (most recent call last):
File "/app/backend/apps/openai/main.py", line 322, in get_models
r.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.perplexity.ai/models
ERROR:apps.openai.main:Connection error: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://api.perplexity.ai/models')
INFO: 192.168.100.12:0 - "GET /openai/models/0 HTTP/1.1" 500 Internal Server Error
INFO:apps.openai.main:get_all_models()

on the perplexity docs, there is no mention of /models . but on open-webui /models is appended at the end of the url

@TheNasa commented on GitHub (Jun 12, 2024): > It seems like the host being requested is `api.perplexity` and not `api.perplexity.ai` sorry that part of the log is when im trying with different url this is the log for https://api.perplexity.ai/ INFO:config:Saving 'OPENAI_API_BASE_URLS' to config.json INFO: 192.168.100.12:0 - "POST /openai/urls/update HTTP/1.1" 200 OK INFO:apps.openai.main:get_all_models() ERROR:apps.openai.main:Connection error: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://api.perplexity.ai/models') INFO:config:Saving 'OPENAI_API_KEYS' to config.json INFO: 192.168.100.12:0 - "POST /openai/keys/update HTTP/1.1" 200 OK INFO:apps.openai.main:get_all_models() INFO:apps.openai.main:get_all_models() ERROR:apps.openai.main:Connection error: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://api.perplexity.ai/models') ERROR:apps.openai.main:404 Client Error: Not Found for url: https://api.perplexity.ai/models Traceback (most recent call last): File "/app/backend/apps/openai/main.py", line 322, in get_models r.raise_for_status() File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.perplexity.ai/models ERROR:apps.openai.main:Connection error: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://api.perplexity.ai/models') INFO: 192.168.100.12:0 - "GET /openai/models/0 HTTP/1.1" 500 Internal Server Error INFO:apps.openai.main:get_all_models() on the perplexity docs, there is no mention of /models . but on open-webui /models is appended at the end of the url
Author
Owner

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

you're missing /v1, the full endpoint URL should be:

https://api.perplexity.ai/v1
@justinh-rahb commented on GitHub (Jun 12, 2024): you're missing `/v1`, the full endpoint URL should be: ``` https://api.perplexity.ai/v1 ```
Author
Owner

@TheNasa commented on GitHub (Jun 12, 2024):

you're missing /v1, the full endpoint URL should be:

https://api.perplexity.ai/v1

unfortunately i've tried https://api.perplexity.ai/v1 too and it didnt work

ERROR:apps.openai.main:404 Client Error: Not Found for url: https://api.perplexity.ai/v1/models
Traceback (most recent call last):
File "/app/backend/apps/openai/main.py", line 322, in get_models
r.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.perplexity.ai/v1/models
INFO: 10.5.5.3:0 - "GET /openai/models/0 HTTP/1.1" 500 Internal Server Error
INFO:apps.openai.main:get_all_models()

@TheNasa commented on GitHub (Jun 12, 2024): > you're missing `/v1`, the full endpoint URL should be: > > ``` > https://api.perplexity.ai/v1 > ``` unfortunately i've tried https://api.perplexity.ai/v1 too and it didnt work ERROR:apps.openai.main:404 Client Error: Not Found for url: https://api.perplexity.ai/v1/models Traceback (most recent call last): File "/app/backend/apps/openai/main.py", line 322, in get_models r.raise_for_status() File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.perplexity.ai/v1/models INFO: 10.5.5.3:0 - "GET /openai/models/0 HTTP/1.1" 500 Internal Server Error INFO:apps.openai.main:get_all_models()
Author
Owner

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

Turns out, Perplexity doesn't use a version in their API URL. It's possible that is what's interfering:
https://docs.perplexity.ai/discuss/6568121c0e55130062a5ee60

I haven't got a key to test it with, but attempting to hit that domain at all seems to return absolutely nothing as though it does not exist... have you gotten this to work with anything else?

@justinh-rahb commented on GitHub (Jun 12, 2024): Turns out, Perplexity doesn't use a version in their API URL. It's possible that is what's interfering: https://docs.perplexity.ai/discuss/6568121c0e55130062a5ee60 I haven't got a key to test it with, but attempting to hit that domain at all seems to return absolutely nothing as though it does not exist... have you gotten this to work with _anything else_?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1225