Skip to content

feat(opencode): add Open WebUI provider#18306

Open
SamirMoustafa wants to merge 1 commit intoanomalyco:devfrom
SamirMoustafa:feat/open-webui-provider
Open

feat(opencode): add Open WebUI provider#18306
SamirMoustafa wants to merge 1 commit intoanomalyco:devfrom
SamirMoustafa:feat/open-webui-provider

Conversation

@SamirMoustafa
Copy link
Copy Markdown

@SamirMoustafa SamirMoustafa commented Mar 19, 2026

Issue for this PR

Closes #13537

Builds on feat: add provider openWebUI #14341 (thanks @PapeThePope).

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds Open WebUI as a provider (OpenAI-compatible API): login/connection in CLI and TUI, listing and models, handling for gzip/chunked streams, docs, and tests.

How did you verify your code works?

  • bun typecheck in packages/opencode
  • Manual: Open WebUI URL + API key via CLI/TUI, model list and a short chat/streaming run

Screenshots / recordings

N/A (CLI/TUI text flows).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Mar 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title Add Open WebUI Provider doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

The current PR (#18306) appears to be an updated or refactored version of the Open WebUI provider feature originally introduced in PR #14341. The description acknowledges this relationship, so these two PRs are related but the current one seems to be a successor/improvement to the earlier work.

@SamirMoustafa SamirMoustafa changed the title Add Open WebUI Provider feat/Add Open WebUI Provider Mar 20, 2026
@SamirMoustafa SamirMoustafa changed the title feat/Add Open WebUI Provider feat(opencode): add Open WebUI provider Mar 20, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@SamirMoustafa
Copy link
Copy Markdown
Author

Open WebUI + Ollama (local smoke test)

Download docker-compose.yml

docker compose up -d
docker compose exec ollama ollama pull qwen2.5:0.5b

Open http://localhost:3001 → admin signup → Settings → Account → API keys → create a key.

// Optional
export OPEN_WEBUI_BASE_URL=http://localhost:3001
export OPEN_WEBUI_API_KEY=…

Stop: docker compose down (volumes: docker compose down -v).
Ports: Web UI defaults to 3001 (OPEN_WEBUI_PORT in docker-compose.yml). Run docker compose only under infra/open-webui-local or add -f infra/open-webui-local/docker-compose.yml.

Screen.Recording.2026-03-20.at.2.15.07.AM.mov

@SamirMoustafa
Copy link
Copy Markdown
Author

Hi @adamdotdevin and @alexyaroshuk,
Please review this PR when you have a chance.
It introduces the Open WebUI provider and updates several core provider files, CLI/TUI components, and related documentation.

Download docker-compose.yml

docker compose up -d
docker compose exec ollama ollama pull qwen2.5:0.5b

Besides the commented Dockerfile, I have tested over a version of Open WebUI with these providers (anthropic.claude-haiku-4-5, anthropic.claude-sonnet-4-6, anthropic.claude-opus-4-6, google.gemini-3-flash-preview, google.gemini-3.1-pro-preview, openai.gpt-5.4-nano, openai.gpt-5.4-mini, openai.gpt-5.4, azure.gpt-5-mini, azure.gpt-oss-120b, azure.DeepSeek-V3.2, azure.Kimi-K2.5, mistral.mistral-small-2603, mistral.codestral-2508)
I'm happy to review any comments, so please let me know.

@MikeWang0316tw
Copy link
Copy Markdown

Great work on this! Quick question — is there a way to configure contextLength and maxTokens for Open WebUI models? Since they're dynamically discovered and not in models.dev, I wasn't sure if there's a supported way to set these, or if it needs to be done manually in opencode.json.

@SamirMoustafa
Copy link
Copy Markdown
Author

SamirMoustafa commented Mar 24, 2026

Great work on this! Quick question — is there a way to configure contextLength and maxTokens for Open WebUI models? Since they're dynamically discovered and not in models.dev, I wasn't sure if there's a supported way to set these, or if it needs to be done manually in opencode.json.

@MikeWang0316tw
Yes — for Open WebUI models (discovered at runtime), configure overrides manually in your project config.

Use either opencode.json, opencode.jsonc, or config.json at your project root.

{"$schema": "https://opencode.ai/config.json",
  "provider": {
    "openwebui": {
      "options": {
        "baseURL": "http://localhost:3001"
      },
      "models": {
        "qwen3.5:9b": {
          "limit": {
            "context": 8192,
            "output": 1024
          },
          "options": {
            "num_ctx": 8192,
            "num_predict": 512,
            "temperature": 0.2,
            "top_p": 0.9,
            "repeat_penalty": 1.05}}}}}}

In this example:

models.<id>.limit.context controls OpenCode context budgeting/compaction behavior.
models.<id>.limit.output drives maxOutputTokens in OpenCode.
models.<id>.options passes backend-specific request fields to your Open WebUI/Ollama stack.

A similar manual custom provider config flow in OpenCode is llama.cpp.

OpenAI-compatible API: model discovery, CLI/TUI connect, stream decode, docs, and tests.

Closes anomalyco#13537
@SamirMoustafa SamirMoustafa force-pushed the feat/open-webui-provider branch from 418cf39 to 552323b Compare March 29, 2026 15:45
@richardclli
Copy link
Copy Markdown

When will this merge? I need this feature ^.^

@richardclli
Copy link
Copy Markdown

@SamirMoustafa You may need to resolve the conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add Open WebUI as a provider

3 participants