Skip to content

fix(platform): make an LLM gateway work as a custom provider - #5064

Merged
yannickmonney merged 6 commits into
mainfrom
fix/gateway-custom-providers
Oct 28, 2026
Merged

yannickmonney merged 6 commits into
mainfrom
fix/gateway-custom-providers

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Summary

A custom provider pointed at an LLM gateway (found with a client's Bifrost gateway) did not work well: the wrong base URL failed with a cryptic message, the gateway's models read as unable to take tools, see images or set reasoning effort, Claude never got a chat title, and the model menu named Claude Sonnet 5.5 "Claude Sonnet 5 5". This fixes all four:

  • Wrong base URL says so. A listing that answers with a web page or 404 fails at once (no retry ladder) with a code (PROVIDER_CATALOG_NOT_JSON / PROVIDER_CATALOG_NOT_FOUND); the credential row, Check models and Refresh catalogs show a sentence naming the fix ("…Check that it is the API root; for most gateways it ends in /v1."), EN/DE/FR. Check models answers 502, so its code is now read off the transport error — its localized sentence was never reached before. The MCP refresh refusal gets the same hint.
  • A gateway's models carry what Tale knows about them. In a custom provider's listing, a row with no type, modalities or parameters (Bifrost's rows for the vendor models it routes; a bare /v1/models row) reads as taking tools, like a bare or allowlist entry, and — unknown — as not seeing images. Where Tale's shipped catalogs know the model (matched across id spellings, a vendor's catalog before an aggregator's defaults), image input, tools and an effort knob come from there; a vendor's reasoning-off value, tools rule and Responses-only tool API do not (a gateway translates the wire its own way — Bifrost ignores reasoning_effort: none for Claude). A model the catalogs know is not a chat model (embedding, speech, image) is no longer offered as one. Auto also skips a model that charges nothing for output, so an undescribed embedding model cannot win its price fallback.
  • Titles. The first message reaches the namer as data between <message> tags with the instruction not to answer it (the gateway's Claude, carrying a coding assistant's system prompt, answered "None" / "I'm Claude…" instead of naming). A model that spends the 48-token budget thinking is asked once more with 2048 tokens; a model known to think gets that room at once, with a 30 s deadline instead of 10 s.
  • Labels and search. Dashed versions read with a dot (claude-sonnet-5-5 → "Claude Sonnet 5.5"; date stamps stay apart), and the model menu's search also matches the id (gpt-5.6).
  • Claude Sonnet 5.5 joins the shipped Anthropic catalog with the vendor's facts (read 2026-10-28): 1M window, 128K output, $2/$10, cache hits $0.10, 5-min writes $2.50, vision, tools, effort, no off switch. Haiku 5.5 is left out (its price changes above 100K prompt tokens); Auto's curated list still names Sonnet 5.

Docs (EN/DE/FR): the custom-provider steps, what Tale assumes about undescribed models, the recovery sentence, and searching the model list by id.

Checklist

  • bun run check passes — the parts it runs, locally: oxfmt on every changed file, type-aware oxlint on every changed file, platform tsc --noEmit, platform server+pii unit suites, the affected UI suites, docs tests, lint:manual, lint:links, knip.
  • bun run lint:sast passes — Opengrep on the 13 changed source files, 0 findings.
  • Translations updated in services/platform/messages/{en,de,fr}/settings.yml (no de-CH override exists for these keys).
  • Docs updated in docs/{en,de,fr}/ (platform/admin/providers.md, platform/chat/basics.md).
  • README.md / README.de.md / README.fr.md — N/A, nothing they describe changed.

Test plan

Live, on an isolated local stack against that Bifrost gateway (a virtual key, base URL with and without /v1):

  • Base URL at the gateway's root → row reads "Model catalog unavailable: The base URL answered with a web page, not a model list. Check that it is the API root; for most gateways it ends in /v1."; one listing attempt in the log; Check models toasts the same sentence.
  • /v1 → 4 models; composer data: Claude Sonnet 5.5 / GPT 5.6 Luna / Sol / Gemini 2.5 Pro all tools + vision + effort (Claude's facts from the new catalog entry; before: GPT and Claude tools/vision/effort all false).
  • GPT 5.6 Luna at effort High answered through the gateway; GPT 5.6 Luna and Claude Sonnet 5.5 each described an attached image correctly (before: neither saw it).
  • Titles: Claude titled "Checking If 1001 Is Prime", "Listing Available Tool Names" (one call, no thinking; before: fallback); Gemini 2.5 Pro alone titled "Einladung zum Team-Offsite" (~950 thinking tokens; with the 10 s deadline it fell back).
  • Model menu: "Claude Sonnet 5.5"; search gpt-5.6 finds both GPT 5.6 models, sonnet 5.5 finds Claude.

Locally, beyond the fast tier: platform UI suite (778 files / 8,380 tests), chat browser tests (7 / 32), and a filtered backend:integration run of the lanes this touches (checkIdentityDomains, checkProjects, checkFiles, checkKnowledge, checkChat, checkMcp, checkRestProjectAgents): 137 / 148, all 7 lanes run. The 11 failures are all in checkKnowledge ("the organization's embedding model has no usable provider credential") — the OpenAI credential it needs is planted by an earlier lane outside the filter. The catalog, project-agent, custom-provider, picker and title checks pass ("thread-title model call is booked", one 48-token call). The full run is the queue's.

The mock model gateway (E2E, docs screenshots) now reads the message inside the title call's <message> tags, so mock titles stay the message's own words; its contract test sends the framed shape.

Manual boxes: SET-B40 (base URL that is not the API root), SET-F90 (a gateway's models carry what Tale knows); automation register rows for labels/search and titles.

… list

A custom provider whose base URL is not the API root (a gateway's
dashboard address without /v1, say) got a web page back from /models,
and the credential row read "Unexpected token '<', "<!doctype "... is not
valid JSON". The listing was also retried twice with back-off, although
the server answers the same way every time.

A listing that answers with something other than JSON, or with 404, now
fails at once with a code (PROVIDER_CATALOG_NOT_JSON /
PROVIDER_CATALOG_NOT_FOUND). The credential row, Check models and Refresh
catalogs turn the code into a sentence that names the fix, in English,
German and French; the MCP refresh refusal gives the same hint. The
message no longer quotes the page. Check models answers 502, so its code
is now read off the transport error; before, its localized sentence was
never reached.
A gateway such as Bifrost lists the vendor models it routes with a
window and a price, and nothing about what they take. Such a row read
as a chat model with no tools, no image input and no reasoning control,
so Auto passed over Claude and GPT behind the gateway, images reached
them as text, and no effort could be picked.

In a custom provider's listing, a row that states no type, modalities
or parameters now reads like a bare row or an allowlist entry: it takes
tools and, unknown, sees no images. Where Tale's shipped catalogs know
the model (matched across id spellings, a vendor's own catalog before an
aggregator's defaults), their facts replace that: image input, tools,
and an effort knob. A vendor's reasoning-off value and tools rule stay
behind, since a gateway translates the wire its own way. A model the
catalogs know is not a chat model, such as an embedding model, is no
longer offered as one.

Auto also skips a model that charges nothing for what it writes: an
embedding model or a text compressor read as chat would otherwise win
its price fallback.
The model menu derives a name from the model id. A vendor that spells a
version with dashes, as Anthropic does (`claude-sonnet-5-5`), read as
"Claude Sonnet 5 5", and a search for "sonnet 5.5" found nothing. A
number of one or two digits now takes the one-digit numbers after it
("Claude Sonnet 5.5", "Claude 3.5 Haiku"), while a date stamp or a longer
number stays apart.

The menu's search also matches the model's id, so `gpt-5.6` finds
"GPT 5.6 Luna" whatever the name reads.
The title call gave the model 48 tokens and the first message as the
user's turn. Claude behind a gateway thinks by default, and the gateway's
listing does not say so, so it spent all 48 tokens thinking and the chat
kept its fallback title. Given room, it answered the message instead of
naming it ("None", "I'm Claude, made by Anthropic, …"): that gateway's
Claude carries a coding assistant's system prompt.

The first message now reaches the namer as data between <message> tags,
with the instruction not to answer it; it cannot close the tags early.
Tried live with Claude Sonnet 5.5, GPT 5.6 Luna and Gemini 2.5 Pro
behind the gateway, a question, a request and an "ignore the above"
message were all named, Claude without thinking at all.

A model that spends the title's budget thinking is asked once more with
room for it (2048 tokens), and a model known to think gets that room at
once. A call that gives room to think also gets 30 seconds instead of
10, counted from the same start: Gemini 2.5 Pro thinks 8–12 s over a
title. Each call is held and booked at its own size; an empty answer
that left its budget unspent is not asked again.
The custom provider steps say that a gateway's API root usually ends in
/v1, and that its dashboard address is a web page, not the API. A new
paragraph says what Tale assumes about a model a gateway lists without
describing it, and where the facts come from when Tale knows the model.
The recovery list names the sentence a wrong base URL now shows and its
fix. Chat basics mention that the model list can be searched by a
model's id. English, German and French.
Anthropic's current Sonnet was missing from the shipped catalog, so a
direct Anthropic key could not pick it, and a gateway that routes it
(listed by Bifrost as anthropic/claude-sonnet-5-5) found nothing in
Tale's catalogs to say that it sees images or takes an effort setting.

The entry carries the vendor's facts, read from platform.claude.com on
2026-10-28: a 1M window, 128K output, $2 / $10 per million tokens, cache
hits at 0.05x ($0.10) and 5-minute writes at $2.50, image input, tools,
and the effort parameter. Thinking cannot be turned off, so it declares
no off value, like Opus 5.5 and Fable 5.1. The effort guard's list
follows the vendor's page (Sonnet 5.5 and Haiku 5.5 added).

Claude Haiku 5.5 is not added: its price changes above 100K prompt
tokens, which one catalog price cannot express. Auto's curated list
still names Sonnet 5.
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 5b8a85f Oct 28, 2026
63 checks passed
@yannickmonney
yannickmonney deleted the fix/gateway-custom-providers branch October 28, 2026 11:10
yannickmonney added a commit that referenced this pull request Oct 28, 2026
The authored notes for v0.5.94: everything since v0.5.93 (1ea59ab),
which is #5062 and #5064.

Highlights: a custom provider in front of an LLM gateway (the base URL
sentence, the facts of the gateway's models, chat titles, labels and
search), Claude Sonnet 5.5 on the Anthropic provider, and image models
without tools leaving the chat model lists. Upgrade notes: no migration,
the API contract unchanged at 3.49.0, what changes for an organization
with such a gateway, Auto skipping zero-output-price models, the title's
larger budget for a model that thinks, and the pins #5062 refuses.
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.

1 participant