[GH-ISSUE #18758] issue: Multiple /models endpoints in openapi spec have similar operationId #105689

Closed
opened 2026-05-18 03:44:04 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @mkresse on GitHub (Oct 31, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18758

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.34

Ollama Version (if applicable)

No response

Operating System

MacOS 15.7.1

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

We are using the openapi specification (provided by http://localhost:8080/openapi.json) to generate an typescript api client using openapi-generator. I would expect, the generated code to compile without errors, so it can be used as typesafe client code to access openwebui api.

Actual Behavior

However, the typescript compiler fails with this error:

error TS2308: Module './DefaultApi' has already exported a member named 'GetModelsApiV1ModelsGetRequest'. Consider explicitly re-exporting to resolve the ambiguity.

17 export * from './ModelsApi';
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in openapi-client/apis/index.ts:17

After investigation of this error, it appears that since there are two different endpoints, which only differ in a trailing slash, the automatically generated "operationId" is also very similar. This results in the generation of two model classes with the same name (GetModelsApiV1ModelsGetRequest), which leads to the typescript compiler error.
The affected endpoints are:

  • /api/v1/models from backend/open_webui/main.py (--> operationId: get_models_api_v1_models_get) and
  • /api/v1/models/ from backend/open_webui/routers/models.py (--> operationId: get_models_api_v1_models__get)

Steps to Reproduce

Executing the following commands reproduces the problem:

mkdir test && cd test
docker run --rm -p 8080:8080 -e ENV=dev -v open-webui:/app/backend/data --name open-webui-main ghcr.io/open-webui/open-webui:v0.6.34
curl http://localhost:8080/openapi.json > openapi.json
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.16.0 generate -g typescript-fetch -i local/openapi.json -o local/openapi-client --skip-validate-spec
npm install typescript
npx tsc openapi-client/index.ts --lib ES2023,DOM

To fix the problem, it would suffice to manually change one of the operationIds (which can be simulated via sed -i '' 's/"get_models_api_v1_models_get"/"get_models_api_v1_models_get_chat"/g' openapi.json).

A final fix could be to manually specify the operation id in via fastapi decorator (see https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#openapi-operationid), like:

@app.get("/api/v1/models", operation_id="get_models_api_v1_models_get_chat")  # Experimental: Compatibility with OpenAI API
async def get_models(
    request: Request, refresh: bool = False, user=Depends(get_verified_user)
):

Logs & Screenshots

2025-10-31 15:48:50.766 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.65.1:64294 - "GET /openapi.json HTTP/1.1" 200

Additional Information

No response

Originally created by @mkresse on GitHub (Oct 31, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/18758 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.34 ### Ollama Version (if applicable) _No response_ ### Operating System MacOS 15.7.1 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior We are using the openapi specification (provided by http://localhost:8080/openapi.json) to generate an typescript api client using openapi-generator. I would expect, the generated code to compile without errors, so it can be used as typesafe client code to access openwebui api. ### Actual Behavior However, the typescript compiler fails with this error: error TS2308: Module './DefaultApi' has already exported a member named 'GetModelsApiV1ModelsGetRequest'. Consider explicitly re-exporting to resolve the ambiguity. 17 export * from './ModelsApi'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Found 1 error in openapi-client/apis/index.ts:17 After investigation of this error, it appears that since there are two different endpoints, which only differ in a trailing slash, the automatically generated "operationId" is also very similar. This results in the generation of two model classes with the same name (`GetModelsApiV1ModelsGetRequest`), which leads to the typescript compiler error. The affected endpoints are: - `/api/v1/models` from backend/open_webui/main.py (--> operationId: `get_models_api_v1_models_get`) and - `/api/v1/models/` from backend/open_webui/routers/models.py (--> operationId: `get_models_api_v1_models__get`) ### Steps to Reproduce Executing the following commands reproduces the problem: ``` mkdir test && cd test docker run --rm -p 8080:8080 -e ENV=dev -v open-webui:/app/backend/data --name open-webui-main ghcr.io/open-webui/open-webui:v0.6.34 curl http://localhost:8080/openapi.json > openapi.json docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.16.0 generate -g typescript-fetch -i local/openapi.json -o local/openapi-client --skip-validate-spec npm install typescript npx tsc openapi-client/index.ts --lib ES2023,DOM ``` To fix the problem, it would suffice to manually change one of the operationIds (which can be simulated via `sed -i '' 's/"get_models_api_v1_models_get"/"get_models_api_v1_models_get_chat"/g' openapi.json`). A final fix could be to manually specify the operation id in via fastapi decorator (see https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#openapi-operationid), like: @app.get("/api/v1/models", operation_id="get_models_api_v1_models_get_chat") # Experimental: Compatibility with OpenAI API async def get_models( request: Request, refresh: bool = False, user=Depends(get_verified_user) ): ### Logs & Screenshots 2025-10-31 15:48:50.766 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.65.1:64294 - "GET /openapi.json HTTP/1.1" 200 ### Additional Information _No response_
GiteaMirror added the bug label 2026-05-18 03:44:04 -05:00
Author
Owner

@tjbck commented on GitHub (Nov 2, 2025):

6681ff5cbd

<!-- gh-comment-id:3478496761 --> @tjbck commented on GitHub (Nov 2, 2025): 6681ff5cbda4da8b42b3ed9fea95a4b896e3fd5f
Author
Owner

@mkresse commented on GitHub (Nov 3, 2025):

I didn't dare to ask - this fix is even better, as it solves the ambiguity in the API. Thanks.

<!-- gh-comment-id:3479476713 --> @mkresse commented on GitHub (Nov 3, 2025): I didn't dare to ask - this fix is even better, as it solves the ambiguity in the API. Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#105689