Skip to content

Add LLMTR API provider - #1141

Open
knowhycodata wants to merge 1 commit into
ChatGPTBox-dev:masterfrom
knowhycodata:add-llmtr-provider
Open

knowhycodata wants to merge 1 commit into
ChatGPTBox-dev:masterfrom
knowhycodata:add-llmtr-provider

Conversation

@knowhycodata

@knowhycodata knowhycodata commented Nov 20, 2026 •

Copy link
Copy Markdown

This adds LLMTR as a builtin API provider. LLMTR is an OpenAI-compatible gateway at https://llmtr.com/v1. It serves some models from servers in Turkey (llmtr/... ids) and routes others to their upstream providers.

The change follows the NVIDIA NIM provider:

  • provider-registry.mjs: new llmtr builtin entry (https://llmtr.com/v1 + /chat/completions) and legacy preset resolution for llmtr_* / llmtrApiModelKeys.
  • openai-provider-mappings.mjs: llmtrApiKey legacy key field and group mapping.
  • config/index.mjs: llmtrApiModelKeys group ("LLMTR (API)"), six presets, llmtrApiKey default, isUsingLlmtrApiModel, and llmtr added to NEWLY_RESERVED_BUILTIN_PROVIDER_IDS so an existing custom provider named llmtr is migrated the same way as xai, nvidia-nim and mistral.
  • background/index.mjs: route the group through the OpenAI-compatible path.
  • popup/sections/GeneralPart.jsx: API key setup link for llmtr.

Presets:

  • llmtr/qwen3-8-27b (Qwen 3.8 27B, hosted in Turkey)
  • llmtr/qwen3-6-35b (Qwen 3.6 35B-A3B, hosted in Turkey)
  • llmtr/gemma-4 (Gemma 4, hosted in Turkey)
  • llmtr/trendyol-asure-12b (Trendyol Asure 12B, hosted in Turkey)
  • anthropic/claude-sonnet-5
  • deepseek/deepseek-v4-pro

None of them is enabled by default. GeneralPart.jsx gets an API key setup link for llmtr (https://llmtr.com/dashboard/keys), like the other builtin providers.

Testing:

  • Added cases to the provider registry, thin adapter, config predicate and migration tests, and added llmtr to the "all migrations completed" fixtures.
  • npm test on tests/unit: 1111 passed.
  • prettier --check and eslint on the changed files: clean. The two-line setup-link case was added afterwards and only syntax-checked (esbuild); it follows the format of the cases around it.
  • I did not build or load the extension in a browser.

No live call to LLMTR was made for this change.


Devin Review

View guided diff

Summary by CodeRabbit

  • New Features
    • Added LLMTR as a built-in provider, with six available models and a link to its dashboard for API key setup.
    • LLMTR sessions now use the app’s existing OpenAI-compatible API handling, including support for legacy LLMTR model names.

LLMTR is an OpenAI-compatible gateway at https://llmtr.com/v1. Add it as
a builtin provider with a small preset model group, following the NVIDIA
NIM provider. The presets include models hosted in Turkey (llmtr/...)
and two routed models.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

LLMTR is added as a built-in API provider with six model definitions, provider configuration and migration mappings, a registered API endpoint, and OpenAI-compatible session routing.

Changes: LLMTR Provider Integration

Layer / File(s) Summary
Model configuration and migration
src/config/index.mjs, src/config/openai-provider-mappings.mjs, tests/unit/config/*, tests/unit/popup/import-data-cleanup.test.mjs
Adds six LLMTR model definitions, the API-key default and provider mappings, and migration handling for the built-in provider ID. Tests cover the model predicate and migration fixtures.
Provider registration and model resolution
src/services/apis/provider-registry.mjs, src/popup/sections/GeneralPart.jsx, tests/unit/services/apis/provider-registry.test.mjs
Registers the LLMTR endpoint, resolves legacy LLMTR model names, and adds the API-key setup URL. Tests cover legacy model-name resolution.
OpenAI-compatible session routing
src/background/index.mjs, tests/unit/services/apis/thin-adapters.test.mjs
Routes LLMTR sessions through OpenAI-compatible API handling. Adds LLMTR configuration to the shared adapter test cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: peterdavehello

Merge Risk: Minimal · up to 5164f

This adds LLMTR as a disabled-by-default OpenAI-compatible provider with the supporting configuration, migration, and setup link. No concrete defect was found, so it is ready to merge after normal checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add LLMTR API provider" matches the main change. The PR adds LLMTR as a built-in OpenAI-compatible provider, with its base URL, presets, API key mapping, and predicate. The title is short a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Add LLMTR API provider" matches the main change. The PR adds LLMTR as a built-in OpenAI-compatible provider, with its base URL, presets, API key mapping, and predicate. The title is short and specific. It does not describe every detail, such as migration handling or the setup link, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 28e07eda-49c7-4692-abeb-1de452cda5f8
Commits

Reviewing files that changed from the base of the PR and between 955dfe0 and 5164f8e.

Files selected for processing: 10

  • src/background/index.mjs
  • src/config/index.mjs
  • src/config/openai-provider-mappings.mjs
  • src/popup/sections/GeneralPart.jsx
  • src/services/apis/provider-registry.mjs
  • tests/unit/config/config-predicates.test.mjs
  • tests/unit/config/migrate-user-config.test.mjs
  • tests/unit/popup/import-data-cleanup.test.mjs
  • tests/unit/services/apis/provider-registry.test.mjs
  • tests/unit/services/apis/thin-adapters.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T11:58:19.509753Z 5164f8e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qodo-code-review

qodo-code-review Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Add LLMTR as a built-in OpenAI-compatible provider

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Add six optional LLMTR model presets and an API-key setup link.
• Route LLMTR requests through the existing OpenAI-compatible provider path.
• Preserve secrets for existing custom providers named llmtr and cover integration paths with unit
 tests.
Merge Risk 🟡 Medium

Blast radius 🟡 Medium 💥 2 capabilities

  • 2 affected capabilities within one bounded functional scope: OpenAI-compatible provider integration.
  • The model selection, provider registry, secret mapping, background dispatch, and request construction form one bounded provider integration and one end-to-end user outcome: sending a prompt to the selected LLMTR model and displaying its response.
  • The provider and request layers are propagation hops, not independent capabilities.
  • This is a second user outcome within the same bounded provider integration: retaining the ability to use an existing custom provider after config migration.
  • It shares the provider configuration and request-resolution subsystem with LLMTR, but is distinct from adding a new LLMTR request because it concerns preservation of pre-existing custom-provider behavior.
Sources

src/config/openai-provider-mappings.mjs[29-31]

  deepSeekApiModelKeys: 'deepseek',
  nvidiaNimApiModelKeys: 'nvidia-nim',
  llmtrApiModelKeys: 'llmtr',

src/config/openai-provider-mappings.mjs[4-5]

  'nvidia-nim': 'nvidiaNimApiKey',
  llmtr: 'llmtrApiKey',

src/config/index.mjs[150-156]

export const llmtrApiModelKeys = [
  'llmtr_qwen3_8_27b',
  'llmtr_qwen3_6_35b',
  'llmtr_gemma_4',
  'llmtr_trendyol_asure_12b',
  'llmtr_claude_sonnet_5',
  'llmtr_deepseek_v4_pro',
Behavioral complexity 🟡 Medium 🧩 Compatibility cases

  • Before: OpenAI-compatible provider behavior was selected from existing provider/model groups, mappings, and legacy model-name resolution.
  • After: a new provider must remain consistent across model-group selection, concrete model values, legacy preset detection, provider ID mapping, secret lookup, endpoint construction, and background dispatch.
  • New correctness condition: every LLMTR activation shape, including legacy model names and API-mode group names, must resolve to the same llmtr provider, URL, and secret without changing routing for other providers.
  • These are newly added compatibility cases; the existing request pipeline itself is reused rather than counted as new algorithmic complexity.
Sources

src/config/index.mjs[150-156]

export const llmtrApiModelKeys = [
  'llmtr_qwen3_8_27b',
  'llmtr_qwen3_6_35b',
  'llmtr_gemma_4',
  'llmtr_trendyol_asure_12b',
  'llmtr_claude_sonnet_5',
  'llmtr_deepseek_v4_pro',

src/services/apis/provider-registry.mjs[37-44]

  {
    id: 'llmtr',
    name: 'LLMTR',
    baseUrl: 'https://llmtr.com/v1',
    chatCompletionsPath: '/chat/completions',
    builtin: true,
    enabled: true,
  },

src/config/openai-provider-mappings.mjs[29-31]

  deepSeekApiModelKeys: 'deepseek',
  nvidiaNimApiModelKeys: 'nvidia-nim',
  llmtrApiModelKeys: 'llmtr',
Potential damage 🟡 Medium 🩹 Temporary loss

  • A request-routing, endpoint, key, or external-contract fault prevents the LLMTR chat capability from completing.
  • This does not imply persistent application data damage or harm to unrelated providers.
  • Re-entering the correct key/configuration or fixing the provider contract can restore operation; reverting code restores the prior extension behavior but cannot compensate for an already failed external request.
  • Recoverable by correcting the LLMTR configuration or provider-side contract and retrying.
  • No repository evidence shows automatic retry or repair for a misconfigured provider, and a revert alone does not make an already failed external request succeed.
Sources

src/services/apis/provider-registry.mjs[37-44]

  {
    id: 'llmtr',
    name: 'LLMTR',
    baseUrl: 'https://llmtr.com/v1',
    chatCompletionsPath: '/chat/completions',
    builtin: true,
    enabled: true,
  },

src/config/openai-provider-mappings.mjs[4-5]

  'nvidia-nim': 'nvidiaNimApiKey',
  llmtr: 'llmtrApiKey',
Assessed commit 5164f8e
Diagram

graph TD
  Popup["Model selection"] --> Config["Model presets"] --> Background["Background routing"] --> Adapter["Compatible adapter"] --> Registry["Provider registry"] --> Gateway{{"LLMTR gateway"}}
  Config --> Mappings["Provider mappings"] --> Registry
Loading
High-Level Assessment

Using the existing OpenAI-compatible provider infrastructure is the best fit for this gateway. A dedicated adapter would duplicate request handling without a demonstrated LLMTR-specific requirement.

Files changed (10) +87 / -8

Enhancement (5) +58 / -1
index.mjsRoute LLMTR sessions through compatible API handling +2/-0

Route LLMTR sessions through compatible API handling

• Includes LLMTR model selections in the background's OpenAI-compatible session predicate.

src/background/index.mjs

index.mjsDefine LLMTR presets, credentials, and migration eligibility +43/-1

Define LLMTR presets, credentials, and migration eligibility

• Adds a six-model LLMTR group, an empty default API key, and a model-selection predicate. Reserves the llmtr provider ID so existing custom-provider collisions receive secret migration.

src/config/index.mjs

openai-provider-mappings.mjsMap LLMTR models and legacy credentials to the provider +2/-0

Map LLMTR models and legacy credentials to the provider

• Associates the LLMTR model group with its provider ID and maps that ID to the legacy llmtrApiKey field.

src/config/openai-provider-mappings.mjs

GeneralPart.jsxLink to LLMTR API-key setup +2/-0

Link to LLMTR API-key setup

• Adds the LLMTR dashboard key URL to the provider setup-link selection.

src/popup/sections/GeneralPart.jsx

provider-registry.mjsRegister the LLMTR gateway and resolve legacy presets +9/-0

Register the LLMTR gateway and resolve legacy presets

• Registers LLMTR's built-in chat-completions endpoint. Resolves llmtr-prefixed presets and the LLMTR group name to the provider ID.

src/services/apis/provider-registry.mjs

Tests (5) +29 / -7
config-predicates.test.mjsTest LLMTR model-group detection +9/-0

Test LLMTR model-group detection

• Checks that every exported LLMTR preset matches its selection predicate while an NVIDIA NIM preset does not.

tests/unit/config/config-predicates.test.mjs

migrate-user-config.test.mjsInclude LLMTR in reserved-ID migration tests +5/-4

Include LLMTR in reserved-ID migration tests

• Adds llmtr to the migration test provider list and updates completed-migration fixtures.

tests/unit/config/migrate-user-config.test.mjs

import-data-cleanup.test.mjsMark LLMTR migration complete in import fixtures +3/-3

Mark LLMTR migration complete in import fixtures

• Updates import-cleanup fixtures to include llmtr among completed built-in provider ID migrations.

tests/unit/popup/import-data-cleanup.test.mjs

provider-registry.test.mjsTest LLMTR legacy preset resolution +5/-0

Test LLMTR legacy preset resolution

• Verifies that an LLMTR preset and a group-prefixed legacy model name resolve to llmtr.

tests/unit/services/apis/provider-registry.test.mjs

thin-adapters.test.mjsExercise LLMTR requests through the compatible adapter +7/-0

Exercise LLMTR requests through the compatible adapter

• Adds LLMTR to shared adapter tests that verify the request URL, bearer key, and generated response using mocked fetch.

tests/unit/services/apis/thin-adapters.test.mjs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 10 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

View guided diff | Re-trigger cubic

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread src/config/index.mjs
Comment on lines +509 to +532
llmtr_qwen3_8_27b: {
value: 'llmtr/qwen3-8-27b',
desc: 'LLMTR (Qwen 3.8 27B, hosted in Turkey)',
},
llmtr_qwen3_6_35b: {
value: 'llmtr/qwen3-6-35b',
desc: 'LLMTR (Qwen 3.6 35B-A3B, hosted in Turkey)',
},
llmtr_gemma_4: {
value: 'llmtr/gemma-4',
desc: 'LLMTR (Gemma 4, hosted in Turkey)',
},
llmtr_trendyol_asure_12b: {
value: 'llmtr/trendyol-asure-12b',
desc: 'LLMTR (Trendyol Asure 12B, hosted in Turkey)',
},
llmtr_claude_sonnet_5: {
value: 'anthropic/claude-sonnet-5',
desc: 'LLMTR (Claude Sonnet 5)',
},
llmtr_deepseek_v4_pro: {
value: 'deepseek/deepseek-v4-pro',
desc: 'LLMTR (DeepSeek V4 Pro)',
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 LLMTR labels missing from localization catalog

The new Models descriptions and ModelGroups label reach t() without English catalog entries. All seven labels violate the localization requirement to register new source strings first.

Learn more

The model picker passes model descriptions through modelNameToDesc, and the provider-type picker translates group descriptions in ApiModes. None of the six new model descriptions or the new group description has an English catalog entry. Missing translations currently display their raw English keys, so this does not block API requests.

Example: Selecting the Qwen preset displays LLMTR (Qwen 3.8 27B, hosted in Turkey) as an unregistered translation key.

Recommended fix: Add all six model descriptions and LLMTR (API) as identity key/value pairs in src/_locales/en/main.json. Preserve existing keys, and avoid duplicating unchanged labels across other locales.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes add one optional provider path and a scoped configuration migration.

The request path appears sound, but the required English catalog entries must be added before merging.

Findings

  1. P2 New labels skip the catalog ▶

Summary

Adds LLMTR as a built-in OpenAI-compatible provider with six optional presets.

  • LLMTR models send chat requests through its built-in API provider.
  • Custom providers named llmtr enter the built-in ID collision migration.

Acknowledged validation gaps: knowhycodata explicitly states that no extension build, browser load, or live LLMTR call was performed. The final setup-link change received a syntax check only. These acknowledged gaps were not reported as findings.

Reviews (1) · Last reviewed commit: "Add LLMTR API provider" · Reviewed by Greptile

Comment thread src/config/index.mjs
},
llmtrApiModelKeys: {
value: llmtrApiModelKeys,
desc: 'LLMTR (API)',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 New labels skip the catalog

The new LLMTR group and six model labels are passed to t(), but none is registered in src/_locales/en/main.json. AGENTS.md requires new source strings to be added there first. Add all seven labels to the English catalog before merging so translators have the new text in the shared source file.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5164f8eafc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config/index.mjs
'nvidiaNim_inkling',
'nvidiaNim_minimax_m3',
]
export const llmtrApiModelKeys = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add an LLMTR mode to the default active model list

Profiles get their visible modes from defaultApiModeIds, and this group is not included there. Untouched profiles use that list directly, while customized profiles only receive new modes added to it through reconcileMaterializedApiModeDefaults. As a result, installing or upgrading will not expose any LLMTR model in the normal model picker unless users manually create an API mode in settings. Add at least one LLMTR preset to the default list so the provider is available through the standard flow.

Useful? React with 👍 / 👎.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Approach: sound — a mechanical mirror of the existing nvidia-nim builtin provider wiring, which touches exactly the set of files that provider touches.

Reviewed changes

  • Provider registry — new llmtr builtin entry (https://llmtr.com/v1 + /chat/completions), plus llmtr_* / llmtrApiModelKeys legacy preset resolution in resolveProviderIdFromLegacyModelName.
  • Config — llmtrApiModelKeys group with six presets, ModelGroups / Models entries, llmtrApiKey default, isUsingLlmtrApiModel, and llmtr in NEWLY_RESERVED_BUILTIN_PROVIDER_IDS so an existing custom provider with that id is migrated like xai / nvidia-nim / mistral.
  • Mappings and routing — legacy key field and group-to-provider mapping, and background routing through the OpenAI-compatible session path.
  • Popup — API key setup link for the provider.
  • Tests — predicates, registry resolution, thin adapter base URL/secret wiring, and migration/import fixtures extended with llmtr.

Everything else that a provider addition has to touch is already generic: manifest.json covers the endpoint via <all_urls>, no DNR rules are provider-specific, the popup provider/model selectors are driven by ModelGroups and the registry, and README does not enumerate providers.

Validation on my side: npm test passes 1111/1111, and eslint plus prettier --check are clean on all ten changed files. Since the PR notes no live call was made, I checked the contract directly: all six preset ids appear in GET https://llmtr.com/v1/models, and POST https://llmtr.com/v1/chat/completions returns a 401 auth_error rather than a 404, so the configured base URL and path resolve as intended.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant