Skip to content

Add OpenWebUI + LMStudio integration (CORS, docker compose, env-var host)#10

Open
offbyonebit wants to merge 2 commits into
mainfrom
claude/arc-optimized-openwebui-lmstudio-gwbpfd
Open

Add OpenWebUI + LMStudio integration (CORS, docker compose, env-var host)#10
offbyonebit wants to merge 2 commits into
mainfrom
claude/arc-optimized-openwebui-lmstudio-gwbpfd

Conversation

@offbyonebit

@offbyonebit offbyonebit commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • CORS middleware added to server.py — without it, OpenWebUI (running in a browser) gets blocked by same-origin policy when calling arc-llama from a different port
  • created field in /v1/models now uses the GGUF file's mtime instead of 0 — model pickers in OpenWebUI sort and display timestamps correctly
  • ARC_LLAMA_HOST / ARC_LLAMA_PORT env vars on arc-llama serve — the container needs to bind to 0.0.0.0, now possible without editing config.toml
  • docker-compose.yml — new file; docker compose up brings up arc-llama + Open WebUI together, with GPU device passthrough and a shared network; chat UI at http://localhost:3000
  • README — new Open WebUI and LMStudio sections covering both the compose path and bare-metal configuration

Rebase note (2026-07-10)

Rebased onto current main (9ebb2b8) and resolved the server.py import conflict (kept agent/UploadFile/FileResponse imports from main; added os + CORSMiddleware). Follow-up commit: compose healthcheck uses python3 urllib instead of curl (runtime image has no curl — depends_on: service_healthy would otherwise hang forever). Unit tests in tests/test_openwebui_integration.py.

Test plan

  • docker compose up starts both services; Open WebUI at :3000 shows arc-llama models in the model picker
    • Not run here: host has Docker but no docker compose plugin; GPU image build not exercised.
  • Bare-metal: arc-llama serve, configure Open WebUI with base URL http://127.0.0.1:11437/v1, models appear
    • Not run end-to-end against a real Open WebUI instance.
  • GET /v1/models returns created as a non-zero Unix timestamp for registered GGUFs
    • Verified via unit tests + live uvicorn probe (created from GGUF mtime).
  • Browser fetch to http://127.0.0.1:11437/v1/models from a different origin succeeds (CORS headers present)
    • Verified: OPTIONS preflight + GET with Origin: http://localhost:3000 return Access-Control-Allow-Origin: *.
  • ARC_LLAMA_HOST=0.0.0.0 arc-llama serve binds to all interfaces
    • Verified: serve options bind envvars; live bind on 0.0.0.0:18765 (LISTEN 00000000:… in /proc/net/tcp).
  • arc-llama upstream add lmstudio http://127.0.0.1:1234 merges LMStudio models into the model list
    • CLI add verified; /v1/models merges owned_by: upstream:lmstudio when upstream is configured (mocked LMStudio list).

https://claude.ai/code/session_016pwPb8iA8Ch62118zCNfyS


Generated by Claude Code; rebased/verified by Grok

claude and others added 2 commits July 10, 2026 08:25
…ding

- server.py: add CORSMiddleware (allow_origins=["*"]) so browser-based
  clients like Open WebUI can call arc-llama from any origin
- server.py: populate `created` from file mtime instead of hard-coded 0,
  so model pickers sort and display timestamps correctly
- cli.py: `arc-llama serve` now reads ARC_LLAMA_HOST / ARC_LLAMA_PORT
  env vars, making it container-friendly without editing config.toml
- docker-compose.yml: new file wiring arc-llama + Open WebUI together;
  `docker compose up` gives a working chat UI on http://localhost:3000
- README: add Open WebUI and LMStudio sections with bare-metal and
  compose quick-starts, including LMStudio upstream pattern

https://claude.ai/code/session_016pwPb8iA8Ch62118zCNfyS
The runtime image installs python3 but not curl, so the compose healthcheck
(and open-webui depends_on: service_healthy) would never pass. Switch to a
python3 urllib probe. Also pin down CORS, GGUF mtime `created`, serve env
vars, upstream add, and compose structure with unit tests.
@offbyonebit
offbyonebit marked this pull request as ready for review July 10, 2026 13:26
@offbyonebit
offbyonebit force-pushed the claude/arc-optimized-openwebui-lmstudio-gwbpfd branch from d197345 to b1b891f Compare July 10, 2026 13:26

Copy link
Copy Markdown
Owner Author

Rebased onto current main (9ebb2b8) and marked ready for review.

Conflicts: only server.py (imports). Kept main’s agent/UploadFile/FileResponse stack; added os + CORSMiddleware. CLI env vars, README, and compose applied cleanly.

Extra fix: compose healthcheck was curl, which is not in the runtime image — switched to a python3 urllib probe so depends_on: service_healthy can actually succeed.

Verified (automated + live local bind):

  • CORS preflight + GET → Access-Control-Allow-Origin: *
  • /v1/models created = GGUF mtime (non-zero)
  • ARC_LLAMA_HOST / ARC_LLAMA_PORT bound on serve; live listen on 0.0.0.0
  • upstream add lmstudio + model list merge (owned_by: upstream:lmstudio)
  • unit tests: tests/test_openwebui_integration.py (6 passed)

Not verified on this host: full docker compose up (no compose plugin installed) and a real Open WebUI browser session against a GPU-backed arc-llama. Those two checklist items remain for a machine with compose + Arc.

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.

2 participants