Skip to content

web: neutral Custom OpenAI-compatible preset for LLM profiles - #685

Merged
BaaRai merged 2 commits into
mainfrom
land/openai-compatible-preset-2026-11-29
Nov 28, 2026
Merged

BaaRai merged 2 commits into
mainfrom
land/openai-compatible-preset-2026-11-29

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Lands #677 rebased on current main, with the contributor commit unchanged apart from dropping a co-author trailer that does not belong in the public history.

What it adds

The format selector in System, LLM offers "Custom OpenAI-compatible". It selects the existing openai format, shows the expected base-URL shape (https://<host>/v1) and a one-line hint that the provider appends /chat/completions. Nothing is prefilled into the value and no vendor host is baked in, so an empty base URL keeps the documented public fallback.

The preset is UI-only and not stored. Reopening a saved openai profile re-derives it from the base URL: a host other than api.openai.com selects the preset, the public endpoint keeps its normal entry.

Tests

  • agent/provider_openai_compatible_test.go pins the normalization the preset relies on: bare /v1, trailing slash, a pasted /chat/completions, whitespace, a path-prefixed gateway, host and port, and the empty base URL fallback.
  • web/src/lib/openai-compatible.test.mjs covers the derivation helper, including the empty, case-insensitive and unparseable cases.
  • test:openai-compatible is wired into web/package.json and the web CI job.

Credits

@Dukotah, with authorship kept. Closes #648 in the original PR.

Verification

test:openai-compatible, test:i18n, npx tsc --noEmit, and the two new Go tests.

Dukotah and others added 2 commits November 29, 2026 00:01
Closes #648.

A self-hosted or relayed OpenAI-compatible endpoint has to be configured
today by picking the generic "openai" format and knowing the base-URL
convention, which the README documents but the form does not guide. The
common failures are a base URL that stops short of /v1 or one with
/chat/completions pasted on the end.

The preset is UI-only: it selects the existing openai format and shows
the expected base-URL shape and a one-line hint. No wire format, no
schema change, no vendor host, and nothing is prefilled into the value,
so an empty base URL still saves as empty and existing profiles are
untouched. Because the preset is not stored, it is re-derived when a
profile reopens: an openai profile pointing somewhere other than
api.openai.com shows the preset.

Tests, written before the change:

- agent: regression tests pinning the base-URL normalization the preset
  relies on (bare /v1, trailing slash, a pasted /chat/completions
  endpoint, whitespace, a path-prefixed gateway, host:port) and pinning
  that an empty base URL still resolves to the public endpoint.
- web: unit tests for the derivation helper, following the
  src/lib/*.test.mjs convention, wired into package.json and CI.
@BaaRai
BaaRai merged commit becc47a into main Nov 28, 2026
8 checks passed
@BaaRai
BaaRai deleted the land/openai-compatible-preset-2026-11-29 branch November 28, 2026 23:19
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.

Add a neutral "Custom OpenAI-compatible" preset for LLM profiles

2 participants