[Feature]: Add LLMTR as a built-in provider
Problem / pain point
Users of LLMTR, an OpenAI-compatible gateway (https://llmtr.com/v1, Bearer keys starting with llmtr-), currently have to set it up as a custom endpoint: pick the wire protocol, type the base URL, and enter a model id by hand. Onboarding doesn't recognise an llmtr- key either. I work on LLMTR.
Proposed solution
Add LLMTR as a built-in provider the same way Atlas Cloud was added in #404:
openai-chatwire, base URLhttps://llmtr.com/v1,LLMTR_API_KEY, default modelqwen/qwen3.8-27b-free(free tier), withllmtr/qwen3-8-27bin the shortlist- detect
llmtr-keys in onboarding - model discovery from
GET /v1/models; the onboarding key check uses a one-token chat request, since/v1/modelsis public and returns 200 for any key - key help link to https://llmtr.com/docs/en/api-keys/
No new dependencies, BYOK only, nothing bundled.
Alternatives considered
The custom OpenAI-compatible provider form already works with the same base URL; this only makes it a one-step setup and keeps the shortlist and key link in one place.
Scope
Provider / model
Hard-constraints check
- [x] I have read the hard constraints in CLAUDE.md and this proposal does not conflict with any of them.
Thanks for the detailed write-up — and for shipping LLMTR. The proposal is well-scoped: a single openai-chat provider entry, a key prefix in onboarding, /v1/models discovery, and a key help link. Nothing bundled, no new deps, BYOK-only.
Verdict on the hard constraints: this sits cleanly inside them. CLAUDE.md constraint 2 requires BYOK-only with no proxied calls, and AGENTS.md constraint 2 repeats it — a built-in provider entry (config + shortlist + onboarding hint) doesn't add a proxy or a bundled runtime, so it doesn't touch constraints 1 or 2. It also doesn't need a shipped dependency, so constraint 4 in CLAUDE.md is unaffected.
Where it lands in the codebase (verified from this checkout):
packages/providers/is the provider layer —CLAUDE.mddescribes it as "pi-ai adapter + custom provider extensions", and.github/labeler.yml:11mapsarea:providerstopackages/providers/**.- Provider registration should go through pi rather than a parallel SDK layer:
AGENTS.mdstates custom providers are registered viapi.registerProvider(), andCLAUDE.mdsays all LLM calls go through@mariozechner/pi-aiwith pi-ai gaps handled as thin extensions inpackages/providers. - pi-ai is currently
^0.72.1inapps/desktop/package.jsonand is locally patched (patches/@[email protected], declared underpnpm.patchedDependenciesin the rootpackage.json). Worth knowing before you assume a catalog entry exists upstream — if LLMTR needs to be a first-class entry rather than a config-only provider, the extension belongs inpackages/providers, not as a new pi-ai patch. - Onboarding key-prefix detection and the connection probe live in the Electron main/provider-config path under
apps/desktop/(the repo layout inCLAUDE.mdputs the shell there; I can't point at the exact detection module from this pass). CLAUDE.mdrequires at least one Vitest test for a new feature, so the PR should carry provider-level tests, not just a catalog entry.
Two things in the spec to tighten before a PR:
- The model IDs don't line up: the default is
qwen/qwen3.8-27b-freebut the shortlist entry isllmtr/qwen3-8-27b. Those look like the same model written two ways — the exactidstrings returned byGET /v1/modelsare what matter, since that's what gets stored in config and sent on the wire. Please paste the raw/v1/modelsids for both. - Making a free-tier model the default for the provider is fine, but it silently becomes what new users hit first. If the free tier is rate-limited or queue-backed, a shortlist-only entry with a paid model as default avoids a confusing first run. Your call — just flagging the UX consequence.
Implementation notes that would make review easy:
- Detect
llmtr-with an anchored prefix (^llmtr-) so it can't collide with other custom-endpoint keys, and place it alongside the existing provider probes rather than special-casing the onboarding flow. - Your reasoning on the key check is right: since
/v1/modelsis public and returns 200 for any key, the probe must be a chat request. Suggestmax_tokens: 1and treating only401/403as "invalid key" — map network failures,429, and5xxto an "unverified" state so a flaky network doesn't tell users their key is wrong. - For discovery, keep a static fallback shortlist when
/v1/modelsfails or times out, and cache results per session so onboarding isn't blocked on a slow gateway. - If
/v1/modelsdoesn't use the standard{"data":[{"id":...}]}shape, the parsing needs to be explicit — that's the most likely place for a silent empty shortlist.
Related history: the issue cites #404 (Atlas Cloud) as the pattern to copy. As you note, the generic custom OpenAI-compatible provider already works with https://llmtr.com/v1, so this is purely setup ergonomics — a shortlist, a key link, and prefix detection — not new protocol support. That framing should keep the review small.
Need more info:
- Raw model
idstrings fromGET /v1/models(and whether the response is OpenAI-standarddata[].id). - Which model should be the provider default vs. shortlist-only.^1
- Does
/v1/chat/completionssupport SSE streaming, and does it acceptmax_tokens(vsmax_completion_tokens)? - Is the auth header exactly
Authorization: Bearer llmtr-..., with no extra required header?
^1 If you'd rather not decide up front, shortlist-only is the lower-risk default for a first PR.
Open-CoDesign Bot