Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/en_US/ai_tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Select your preferred LLM provider from the dropdown:

**OpenAI**
Use GPT models from OpenAI, or any OpenAI-compatible API provider (e.g.,
LiteLLM, LM Studio, EXO, or other local inference servers).
LiteLLM, LM Studio, EXO, hosted services such as GLM (Z.ai), or local
inference servers).

* **API URL**: Custom API endpoint URL (leave empty for default: https://api.openai.com/v1). Include the ``/v1`` path prefix if required by your provider.
* **API Key File**: Path to a file containing your OpenAI API key (obtain from https://platform.openai.com/). This path refers to the filesystem where the pgAdmin server is running (e.g., inside the container if using Docker). The ``~`` prefix is expanded to the home directory of the user running the pgAdmin server process. Optional when using a custom URL with a provider that does not require authentication.
Expand All @@ -77,7 +78,10 @@ Select your preferred LLM provider from the dropdown:

.. note:: You can also use the *OpenAI* provider with a custom API URL for any
OpenAI-compatible endpoint, including Docker Model Runner and other local
inference servers.
inference servers. pgAdmin sends ``max_tokens`` by default and learns to use
``max_completion_tokens`` when a server explicitly rejects it. When the
``ALLOWED_LLM_API_URLS`` configuration setting is non-empty, custom API URLs must match one of its entries; an
empty list permits any URL.

After configuring your provider, click *Save* to apply the changes.

Expand Down
13 changes: 10 additions & 3 deletions docs/en_US/preferences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ Use the fields on the *AI* panel to configure your LLM provider:

* Use the *API URL* field to set a custom API endpoint URL. Leave empty to use
the default OpenAI API (``https://api.openai.com/v1``). Set a custom URL to
use any OpenAI-compatible API provider (e.g., LiteLLM, LM Studio, EXO).
use any OpenAI-compatible API provider (e.g., LiteLLM, LM Studio, EXO,
GLM (Z.ai)).
Include the ``/v1`` path prefix if required by your provider
(e.g., ``http://localhost:1234/v1``).

Expand Down Expand Up @@ -101,8 +102,14 @@ Use the fields on the *AI* panel to configure your LLM provider:

.. note:: You can also use the *OpenAI* provider with a custom API URL for any
OpenAI-compatible endpoint, including Docker Model Runner, LM Studio, EXO,
and other local inference servers. This can be useful when you want to use
a provider that isn't explicitly listed but supports the OpenAI API format.
hosted services such as GLM (Z.ai), and other local inference servers. This
can be useful when you want to use a provider that isn't explicitly listed
but supports the OpenAI API format.

.. note:: With the default allowlist enabled, an administrator must add any
API host not already in ``ALLOWED_LLM_API_URLS`` before pgAdmin can connect
to it. By default the list allows the OpenAI and Anthropic APIs and loopback
addresses on any port. An empty allowlist disables this restriction.

The Browser Node
****************
Expand Down
2 changes: 2 additions & 0 deletions web/pgadmin/llm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class LLMError:
code: Optional[str] = None
provider: Optional[str] = None
retryable: bool = False
http_status: Optional[int] = None
param: Optional[str] = None

def __str__(self) -> str:
if self.code:
Expand Down
Loading
Loading