[GH-ISSUE #21826] feat: Add /api/completions endpoint for 100% OpenAI compatibility #58251

Closed
opened 2026-05-05 22:40:22 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @hdnh2006 on GitHub (Feb 24, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21826

Check Existing Issues

  • I have searched for all existing open AND closed issues and discussions for similar requests. I have found none that is comparable to my request.

Verify Feature Scope

  • I have read through and understood the scope definition for feature requests in the Issues section. I believe my feature request meets the definition and belongs in the Issues section instead of the Discussions.

Problem Description

Hello! I see Open WebUI as an orchestator for AI governance as well and not only as a single interface. Through the API Key provided by the interface, I connect with external apps while keeping all the control.

Image

Apps like continue use an endpoint called /completions which is not the same than /chat/completions. And I get an error like this:

Continue Autocomplete Error: HTTP 405 Method Not Allowed from https://open-webui-url/api/completions

{"detail":"Method Not Allowed"}

As we could do in the past with this PR, making Open WebUI compatible with the /embeddings endpoint. I would like to have the same behaviour with /completions endpoint.

I see somebody did in the past a PR that was closed without any feedback. I don't think the process is so complicated, we already have a similar behaviour for "continue response" featrue:

Image

Would you be open to a PR?

Desired Solution you'd like

The endpoint should call the /chat/completions endpoint using the variable DEFAULT_AUTOCOMPLETE_GENERATION_PROMPT_TEMPLATE

### Task:
You are an autocompletion system. Continue the text in `<text>` based on the **completion type** in `<type>` and the given language.

### **Instructions**:
1. Analyze `<text>` for context and meaning.
2. Use `<type>` to guide your output:
   - **General**: Provide a natural, concise continuation.
   - **Search Query**: Complete as if generating a realistic search query.
3. Start as if you are directly continuing `<text>`. Do **not** repeat, paraphrase, or respond as a model. Simply complete the text.
4. Ensure the continuation:
   - Flows naturally from `<text>`.
   - Avoids repetition, overexplaining, or unrelated ideas.
5. If unsure, return: `{ "text": "" }`.

### **Output Rules**:
- Respond only in JSON format: `{ "text": "<your_completion>" }`.

### **Examples**:

#### Example 1:
Input:
<type>General</type>
<text>The sun was setting over the horizon, painting the sky</text>
Output:
{ "text": "with vibrant shades of orange and pink." }

#### Example 2:
Input:
<type>Search Query</type>
<text>Top-rated restaurants in</text>
Output:
{ "text": "New York City for Italian cuisine." }

---

### Context:
<chat_history>
{{MESSAGES:END:6}}
</chat_history>
<type>{{TYPE}}</type>
<text>{{PROMPT}}</text>

#### Output:

Alternatives Considered

No response

Additional Context

We did something similar in the past with embeddings endpoint

Originally created by @hdnh2006 on GitHub (Feb 24, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/21826 ### Check Existing Issues - [x] I have searched for all existing **open AND closed** issues and discussions for similar requests. I have found none that is comparable to my request. ### Verify Feature Scope - [x] I have read through and understood the scope definition for feature requests in the Issues section. I believe my feature request meets the definition and belongs in the Issues section instead of the Discussions. ### Problem Description Hello! I see Open WebUI as an orchestator for AI governance as well and not only as a single interface. Through the API Key provided by the interface, I connect with external apps while keeping all the control. <img width="715" height="219" alt="Image" src="https://github.com/user-attachments/assets/a4d26e26-4fe1-4e4a-b6b1-10ddcc0ea0fb" /> Apps like [continue](https://www.continue.dev/) use an endpoint called `/completions` which is not the same than `/chat/completions`. And I get an error like this: ``` Continue Autocomplete Error: HTTP 405 Method Not Allowed from https://open-webui-url/api/completions {"detail":"Method Not Allowed"} ``` As we could do in the past with [this](https://github.com/open-webui/open-webui/pull/14667) PR, making Open WebUI compatible with the `/embeddings` endpoint. I would like to have the same behaviour with `/completions` endpoint. I see somebody did in the past a [PR](https://github.com/open-webui/open-webui/pull/20698) that was closed without any feedback. I don't think the process is so complicated, we already have a similar behaviour for "continue response" featrue: <img width="236" height="83" alt="Image" src="https://github.com/user-attachments/assets/5e89ff0c-61a1-42df-9f63-4209f2a9d26e" /> Would you be open to a PR? ### Desired Solution you'd like The endpoint should call the `/chat/completions` endpoint using the variable `DEFAULT_AUTOCOMPLETE_GENERATION_PROMPT_TEMPLATE` ``` ### Task: You are an autocompletion system. Continue the text in `<text>` based on the **completion type** in `<type>` and the given language. ### **Instructions**: 1. Analyze `<text>` for context and meaning. 2. Use `<type>` to guide your output: - **General**: Provide a natural, concise continuation. - **Search Query**: Complete as if generating a realistic search query. 3. Start as if you are directly continuing `<text>`. Do **not** repeat, paraphrase, or respond as a model. Simply complete the text. 4. Ensure the continuation: - Flows naturally from `<text>`. - Avoids repetition, overexplaining, or unrelated ideas. 5. If unsure, return: `{ "text": "" }`. ### **Output Rules**: - Respond only in JSON format: `{ "text": "<your_completion>" }`. ### **Examples**: #### Example 1: Input: <type>General</type> <text>The sun was setting over the horizon, painting the sky</text> Output: { "text": "with vibrant shades of orange and pink." } #### Example 2: Input: <type>Search Query</type> <text>Top-rated restaurants in</text> Output: { "text": "New York City for Italian cuisine." } --- ### Context: <chat_history> {{MESSAGES:END:6}} </chat_history> <type>{{TYPE}}</type> <text>{{PROMPT}}</text> #### Output: ``` ### Alternatives Considered _No response_ ### Additional Context We did something similar in the past with embeddings endpoint
Author
Owner

@Classic298 commented on GitHub (Feb 24, 2026):

a /completions endpoint already exists.

You are missing the v1 from your url path it looks like.

<!-- gh-comment-id:3953213487 --> @Classic298 commented on GitHub (Feb 24, 2026): a /completions endpoint already exists. You are missing the v1 from your url path it looks like.
Author
Owner

@Classic298 commented on GitHub (Feb 24, 2026):

ah you mean only open-webui-url.com/completions?

no v1
no api?

<!-- gh-comment-id:3953230974 --> @Classic298 commented on GitHub (Feb 24, 2026): ah you mean only open-webui-url.com/completions? no v1 no api?
Author
Owner

@hdnh2006 commented on GitHub (Feb 24, 2026):

a /completions endpoint already exists.

You are missing the v1 from your url path it looks like.

Sorry, but I can't see it in the swagger. As I say, all of them are {something}/completions

Image Image Image Image

As you can see in the following image, there's no such /api/completions endpoint

Image

ah you mean only open-webui-url.com/completions?

no v1 no api?

No, as I describe, the endpoint should keep api. Something like https://open-webui-url.com/api/completions

<!-- gh-comment-id:3953313684 --> @hdnh2006 commented on GitHub (Feb 24, 2026): > a /completions endpoint already exists. > > You are missing the v1 from your url path it looks like. Sorry, but I can't see it in the swagger. As I say, all of them are `{something}/completions` <img width="1508" height="128" alt="Image" src="https://github.com/user-attachments/assets/a4139a9c-356c-493a-92c8-deef683b7324" /> <img width="1517" height="223" alt="Image" src="https://github.com/user-attachments/assets/26bfb215-fd0f-430f-a0f1-b9fabe64c3a6" /> <img width="1500" height="78" alt="Image" src="https://github.com/user-attachments/assets/db0ac5b2-bf85-4fc6-aca5-ca2b2857d869" /> <img width="1505" height="454" alt="Image" src="https://github.com/user-attachments/assets/690d9eb9-1aa8-4e22-b68c-60cb04a6d050" /> As you can see in the following image, there's no such `/api/completions` endpoint <img width="473" height="91" alt="Image" src="https://github.com/user-attachments/assets/5ec273fc-2e4c-46ab-961b-ae2dc8dc8979" /> > ah you mean only open-webui-url.com/completions? > > no v1 no api? No, as I describe, the endpoint should keep `api`. Something like `https://open-webui-url.com/api/completions`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#58251