Skip to content

Fix CC-compatible relay format and UI copy - #1742

Closed
rdself wants to merge 4 commits into
cheaper-inference:release/v3.7.4from
rdself:coder/cc-compatible-provider-ui
Closed

rdself wants to merge 4 commits into
cheaper-inference:release/v3.7.4from
rdself:coder/cc-compatible-provider-ui

Conversation

@rdself

@rdself rdself commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Always prepend the Claude Code-compatible system skeleton unless the request already contains it.
  • Clarify the hidden CC-compatible provider entry in .env.example, environment docs, and dashboard UI.
  • Replace visible placeholder copy in the CC-compatible provider details, connection badges, model section, and supported endpoint labels.
  • Add warning callouts for CC-compatible relay configuration and keep the details actions responsive on narrow viewports.

Verification

  • npm run lint
  • npm run lint -- --quiet
  • npm run typecheck:core
  • node --import tsx/esm --test tests/unit/claude-code-compatible-request.test.ts tests/unit/cc-compatible-provider.test.ts
  • npm run test:unit
  • Desktop UI screenshot checked with ENABLE_CC_COMPATIBLE_PROVIDER=true

Copilot AI review requested due to automatic review settings April 28, 2026 18:43
@rdself
rdself requested a review from diegosouzapw as a code owner April 28, 2026 18:43

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request enhances the Claude Code (CC) compatible provider by improving documentation, refining the UI with better responsive layouts and warning hints, and updating localization strings for clarity. The logic for injecting default system blocks was refactored to prevent duplicate skeletons by checking for existing blocks rather than relying on a boolean flag. Feedback is provided regarding the robustness of the skeleton detection logic and the need for form validation on the now-empty default base URL to prevent invalid submissions.

Comment on lines +570 to +573
const hasDefaultSystemBlock = preparedCustomSystemBlocks.some(
(block) =>
block.type === "text" && block.text === CLAUDE_CODE_COMPATIBLE_DEFAULT_SYSTEM_BLOCKS[0].text
);

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.

medium

The logic for detecting an existing skeleton only checks the first block of the default system blocks. If CLAUDE_CODE_COMPATIBLE_DEFAULT_SYSTEM_BLOCKS contains multiple blocks, this check could be bypassed by a request that only includes the first block, leading to an incomplete system prompt for the relay. A more robust approach would be to verify the presence of the entire skeleton or use a specific metadata marker to identify injected blocks.

name: "",
prefix: "",
baseUrl: "https://api.anthropic.com",
baseUrl: "",

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.

medium

The baseUrl now defaults to an empty string. Please ensure that the form validation in AddCcCompatibleModal prevents submission if this field is empty, as the placeholder https://relay.example.com/v1 might be mistaken for a default value by users, leading to the creation of invalid provider nodes with no base URL.

Copilot AI 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.

Pull request overview

Updates OmniRoute’s Claude Code–compatible relay support so requests consistently include the required Claude Code system skeleton, and refreshes the UI/docs copy for the experimental CC-compatible provider.

Changes:

  • Ensure buildClaudeCodeCompatibleRequest prepends the CC-compatible default system skeleton unless it’s already present.
  • Replace placeholder UI/i18n copy for CC-compatible provider details and supported endpoints; add warning callouts and improve responsiveness on narrow viewports.
  • Update unit tests to reflect the new system block behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/claude-code-compatible-request.test.ts Adjusts expectations for injected default system skeleton and system block ordering.
tests/unit/cc-compatible-provider.test.ts Updates CC-compatible provider tests for skeleton injection and cache marker positioning.
src/i18n/messages/en.json Replaces placeholder strings with real UI copy for CC-compatible provider fields and endpoint labels.
src/i18n/messages/zh-CN.json Adds/updates Chinese translations for the same CC-compatible provider UI copy.
src/app/(dashboard)/dashboard/providers/page.tsx Updates the “Add CC Compatible” modal copy, defaults, and adds a warning callout.
src/app/(dashboard)/dashboard/providers/[id]/page.tsx Adds CC-compatible warning callouts, tweaks layout for responsiveness, and refines validation hint display logic.
open-sse/services/claudeCodeCompatible.ts Implements “always prepend skeleton unless already present” behavior for CC-compatible system blocks.
docs/ENVIRONMENT.md Clarifies what ENABLE_CC_COMPATIBLE_PROVIDER is for and when to use it.
.env.example Expands the CC-compatible provider flag guidance for operators.

Comment thread src/i18n/messages/en.json
Comment on lines +2726 to +2730
"ccCompatibleBaseUrlHint": "Base URL for a Claude Code-only relay. Do not include /messages.",
"ccCompatibleBaseUrlPlaceholder": "https://relay.example.com/v1",
"ccCompatibleChatPathHint": "Defaults to Claude Code's strict Messages API path. Change only if your relay documents a different path.",
"ccCompatibleContext1mDescription": "Adds the context-1m beta header when the selected Claude model supports it.",
"ccCompatibleContext1mLabel": "Enable 1M context beta",

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

The CC-compatible provider strings were updated in en.json/zh-CN.json, but most other locale files still contain placeholder values like "Cc Compatible Base Url Hint" / "Cc Compatible Validation Hint". Because next-intl imports per-locale message files (no automatic fallback), users on those locales will still see the placeholder copy this PR is trying to remove. Please update the same keys across the remaining locale JSON files (even if temporarily copying the English text) so the UI copy fix applies to all locales.

Copilot uses AI. Check for mistakes.
Comment on lines 570 to 578
const hasDefaultSystemBlock = preparedCustomSystemBlocks.some(
(block) =>
block.type === "text" && block.text === CLAUDE_CODE_COMPATIBLE_DEFAULT_SYSTEM_BLOCKS[0].text
);

if (hasDefaultSystemBlock) return preparedCustomSystemBlocks;

return [
...CLAUDE_CODE_COMPATIBLE_DEFAULT_SYSTEM_BLOCKS.map((block) => ({ ...block })),

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

Per the repo's coverage gate (npm run test:coverage with 60% minimums), this PR changes production code in open-sse/ and src/ but the verification list doesn't include a coverage run. Please run npm run test:coverage and ensure the coverage thresholds pass (or add/adjust unit tests if needed) before merging.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +2791 to +2799
{isCcCompatible && (
<div className="mb-4 rounded-lg border border-amber-500/25 bg-amber-500/10 px-3 py-2 text-sm text-text-muted">
<div className="flex items-start gap-2">
<span className="material-symbols-outlined mt-0.5 text-[18px] text-amber-500">
warning
</span>
<p>{t("ccCompatibleValidationHint")}</p>
</div>
</div>

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

The same CC-compatible warning callout markup is now duplicated in several places (provider header card, AddApiKeyModal, EditCompatibleNodeModal, and the add-provider modal in providers/page.tsx). Consider extracting this into a small shared component to keep styling/copy consistent and reduce future update churn.

Copilot uses AI. Check for mistakes.
Comment thread .env.example
Comment on lines 707 to +711
# Enable the Claude Code compatible provider endpoint.
# This is only for third-party relays that accept Claude Code clients exclusively.
# OmniRoute rewrites requests to pass those relays' Claude Code client validation.
# If you only want to use Claude Code CLI, or you are not sure what these relays are,
# keep this disabled and add a regular Anthropic-compatible provider instead.

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

.env.example still says this flag "Enable[s] the ... provider endpoint" while docs/ENVIRONMENT.md now describes it as revealing the experimental CC-compatible provider UI for Claude Code-only relays. To avoid confusion for operators, align the .env.example description with the updated docs (or clarify if it truly enables more than just UI exposure).

Suggested change
# Enable the Claude Code compatible provider endpoint.
# This is only for third-party relays that accept Claude Code clients exclusively.
# OmniRoute rewrites requests to pass those relays' Claude Code client validation.
# If you only want to use Claude Code CLI, or you are not sure what these relays are,
# keep this disabled and add a regular Anthropic-compatible provider instead.
# Reveal the experimental Claude Code-compatible provider option in the UI.
# This is only for third-party relays that accept Claude Code clients exclusively.
# OmniRoute rewrites requests to pass those relays' Claude Code client validation.
# If you only want to use Claude Code CLI, or you are not sure what these relays are,
# leave this disabled and add a regular Anthropic-compatible provider instead.

Copilot uses AI. Check for mistakes.
@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.7.4 April 28, 2026 23:00
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for this great contribution! 🎉 It's now officially merged into the release/v3.7.4 branch and will be part of the next release. We appreciate your effort!

2 similar comments
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for this great contribution! 🎉 It's now officially merged into the release/v3.7.4 branch and will be part of the next release. We appreciate your effort!

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for this great contribution! 🎉 It's now officially merged into the release/v3.7.4 branch and will be part of the next release. We appreciate your effort!

diegosouzapw added a commit that referenced this pull request Apr 28, 2026
@diegosouzapw diegosouzapw mentioned this pull request Apr 28, 2026
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Integrated into release/v3.7.4

diegosouzapw added a commit that referenced this pull request Apr 28, 2026
* chore(release): v3.7.4 — version bump, openapi and changelog sync

* fix: preserve previous_response_id and conversation_id fields on empty input array (#1729)

* fix: bypass UI validation block for optional API keys and fix string fallback typing (#1721)

* fix(proxy): disable HTTP keep-alive and pipelining in Undici proxy dispatcher to prevent socket hang up

* feat(proxy): implement bulk proxy import via pipe-delimited parser with update-or-create logic

* docs: update changelog for v3.7.4 fixes and proxy features

* test: update responses store expectations for empty input arrays

* feat(pwa): add fullscreen installable PWA with manifest, service worker, and cross-platform app icons. (#1728)

Integrated into release/v3.7.4

* Fix image provider validation and Stability image requests (#1726)

Integrated into release/v3.7.4

* docs: add PR 1726 and PR 1728 to v3.7.4 changelog

* fix(security): replace insecure Math.random with crypto.getRandomValues for fallback UUID generation

* fix(migrations): intercept 007 migration to use IF NOT EXISTS logic on fresh installs

Fixes #1733

* test: fix typescript compilation errors in unit tests

* fix(db): reconcile legacy reasoning cache migration

* chore(release): bump to v3.7.4 — changelog, docs, version sync

* fix(cc-compatible): preserve Claude Code system skeleton (#1740)

Integrated into release/v3.7.4

* docs(changelog): update for PR #1740 merge

* docs(changelog): include workflow updates

* fix(db): reconcile legacy reasoning cache migration (#1734)

Integrated into release/v3.7.4

* Add endpoint tunnel visibility settings (#1743)

Integrated into release/v3.7.4

* Normalize max reasoning effort for Codex routing (#1744)

Integrated into release/v3.7.4

* Fix Claude Code gateway config helper (#1745)

Integrated into release/v3.7.4

* Refresh CLI fingerprint provider profiles (#1746)

Integrated into release/v3.7.4

* Integrated into release/v3.7.4 (PR #1742)

* docs(changelog): update for PRs 1742-1746

---------

Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
Co-authored-by: Yash Ghule <y.ghule77@gmail.com>
Co-authored-by: backryun <bakryun0718@proton.me>
Co-authored-by: dhaern <manker_lol@hotmail.com>
Co-authored-by: Randi <55005611+rdself@users.noreply.github.com>
Co-authored-by: Duncan L <leungd@gmail.com>
This was referenced Apr 30, 2026
@rdself
rdself deleted the coder/cc-compatible-provider-ui branch April 30, 2026 08:30
@diegosouzapw diegosouzapw mentioned this pull request May 4, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
* chore(release): v3.7.4 — version bump, openapi and changelog sync

* fix: preserve previous_response_id and conversation_id fields on empty input array (cheaper-inference#1729)

* fix: bypass UI validation block for optional API keys and fix string fallback typing (cheaper-inference#1721)

* fix(proxy): disable HTTP keep-alive and pipelining in Undici proxy dispatcher to prevent socket hang up

* feat(proxy): implement bulk proxy import via pipe-delimited parser with update-or-create logic

* docs: update changelog for v3.7.4 fixes and proxy features

* test: update responses store expectations for empty input arrays

* feat(pwa): add fullscreen installable PWA with manifest, service worker, and cross-platform app icons. (cheaper-inference#1728)

Integrated into release/v3.7.4

* Fix image provider validation and Stability image requests (cheaper-inference#1726)

Integrated into release/v3.7.4

* docs: add PR 1726 and PR 1728 to v3.7.4 changelog

* fix(security): replace insecure Math.random with crypto.getRandomValues for fallback UUID generation

* fix(migrations): intercept 007 migration to use IF NOT EXISTS logic on fresh installs

Fixes cheaper-inference#1733

* test: fix typescript compilation errors in unit tests

* fix(db): reconcile legacy reasoning cache migration

* chore(release): bump to v3.7.4 — changelog, docs, version sync

* fix(cc-compatible): preserve Claude Code system skeleton (cheaper-inference#1740)

Integrated into release/v3.7.4

* docs(changelog): update for PR cheaper-inference#1740 merge

* docs(changelog): include workflow updates

* fix(db): reconcile legacy reasoning cache migration (cheaper-inference#1734)

Integrated into release/v3.7.4

* Add endpoint tunnel visibility settings (cheaper-inference#1743)

Integrated into release/v3.7.4

* Normalize max reasoning effort for Codex routing (cheaper-inference#1744)

Integrated into release/v3.7.4

* Fix Claude Code gateway config helper (cheaper-inference#1745)

Integrated into release/v3.7.4

* Refresh CLI fingerprint provider profiles (cheaper-inference#1746)

Integrated into release/v3.7.4

* Integrated into release/v3.7.4 (PR cheaper-inference#1742)

* docs(changelog): update for PRs 1742-1746

---------

Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
Co-authored-by: Yash Ghule <y.ghule77@gmail.com>
Co-authored-by: backryun <bakryun0718@proton.me>
Co-authored-by: dhaern <manker_lol@hotmail.com>
Co-authored-by: Randi <55005611+rdself@users.noreply.github.com>
Co-authored-by: Duncan L <leungd@gmail.com>
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
* chore(release): v3.7.4 — version bump, openapi and changelog sync

* fix: preserve previous_response_id and conversation_id fields on empty input array (cheaper-inference#1729)

* fix: bypass UI validation block for optional API keys and fix string fallback typing (cheaper-inference#1721)

* fix(proxy): disable HTTP keep-alive and pipelining in Undici proxy dispatcher to prevent socket hang up

* feat(proxy): implement bulk proxy import via pipe-delimited parser with update-or-create logic

* docs: update changelog for v3.7.4 fixes and proxy features

* test: update responses store expectations for empty input arrays

* feat(pwa): add fullscreen installable PWA with manifest, service worker, and cross-platform app icons. (cheaper-inference#1728)

Integrated into release/v3.7.4

* Fix image provider validation and Stability image requests (cheaper-inference#1726)

Integrated into release/v3.7.4

* docs: add PR 1726 and PR 1728 to v3.7.4 changelog

* fix(security): replace insecure Math.random with crypto.getRandomValues for fallback UUID generation

* fix(migrations): intercept 007 migration to use IF NOT EXISTS logic on fresh installs

Fixes cheaper-inference#1733

* test: fix typescript compilation errors in unit tests

* fix(db): reconcile legacy reasoning cache migration

* chore(release): bump to v3.7.4 — changelog, docs, version sync

* fix(cc-compatible): preserve Claude Code system skeleton (cheaper-inference#1740)

Integrated into release/v3.7.4

* docs(changelog): update for PR cheaper-inference#1740 merge

* docs(changelog): include workflow updates

* fix(db): reconcile legacy reasoning cache migration (cheaper-inference#1734)

Integrated into release/v3.7.4

* Add endpoint tunnel visibility settings (cheaper-inference#1743)

Integrated into release/v3.7.4

* Normalize max reasoning effort for Codex routing (cheaper-inference#1744)

Integrated into release/v3.7.4

* Fix Claude Code gateway config helper (cheaper-inference#1745)

Integrated into release/v3.7.4

* Refresh CLI fingerprint provider profiles (cheaper-inference#1746)

Integrated into release/v3.7.4

* Integrated into release/v3.7.4 (PR cheaper-inference#1742)

* docs(changelog): update for PRs 1742-1746

---------

Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
Co-authored-by: Yash Ghule <y.ghule77@gmail.com>
Co-authored-by: backryun <bakryun0718@proton.me>
Co-authored-by: dhaern <manker_lol@hotmail.com>
Co-authored-by: Randi <55005611+rdself@users.noreply.github.com>
Co-authored-by: Duncan L <leungd@gmail.com>
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
* chore(release): v3.7.4 — version bump, openapi and changelog sync

* fix: preserve previous_response_id and conversation_id fields on empty input array (cheaper-inference#1729)

* fix: bypass UI validation block for optional API keys and fix string fallback typing (cheaper-inference#1721)

* fix(proxy): disable HTTP keep-alive and pipelining in Undici proxy dispatcher to prevent socket hang up

* feat(proxy): implement bulk proxy import via pipe-delimited parser with update-or-create logic

* docs: update changelog for v3.7.4 fixes and proxy features

* test: update responses store expectations for empty input arrays

* feat(pwa): add fullscreen installable PWA with manifest, service worker, and cross-platform app icons. (cheaper-inference#1728)

Integrated into release/v3.7.4

* Fix image provider validation and Stability image requests (cheaper-inference#1726)

Integrated into release/v3.7.4

* docs: add PR 1726 and PR 1728 to v3.7.4 changelog

* fix(security): replace insecure Math.random with crypto.getRandomValues for fallback UUID generation

* fix(migrations): intercept 007 migration to use IF NOT EXISTS logic on fresh installs

Fixes cheaper-inference#1733

* test: fix typescript compilation errors in unit tests

* fix(db): reconcile legacy reasoning cache migration

* chore(release): bump to v3.7.4 — changelog, docs, version sync

* fix(cc-compatible): preserve Claude Code system skeleton (cheaper-inference#1740)

Integrated into release/v3.7.4

* docs(changelog): update for PR cheaper-inference#1740 merge

* docs(changelog): include workflow updates

* fix(db): reconcile legacy reasoning cache migration (cheaper-inference#1734)

Integrated into release/v3.7.4

* Add endpoint tunnel visibility settings (cheaper-inference#1743)

Integrated into release/v3.7.4

* Normalize max reasoning effort for Codex routing (cheaper-inference#1744)

Integrated into release/v3.7.4

* Fix Claude Code gateway config helper (cheaper-inference#1745)

Integrated into release/v3.7.4

* Refresh CLI fingerprint provider profiles (cheaper-inference#1746)

Integrated into release/v3.7.4

* Integrated into release/v3.7.4 (PR cheaper-inference#1742)

* docs(changelog): update for PRs 1742-1746

---------

Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
Co-authored-by: Yash Ghule <y.ghule77@gmail.com>
Co-authored-by: backryun <bakryun0718@proton.me>
Co-authored-by: dhaern <manker_lol@hotmail.com>
Co-authored-by: Randi <55005611+rdself@users.noreply.github.com>
Co-authored-by: Duncan L <leungd@gmail.com>
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.

4 participants