Repository navigation
Conversation
There was a problem hiding this comment.
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.
| const hasDefaultSystemBlock = preparedCustomSystemBlocks.some( | ||
| (block) => | ||
| block.type === "text" && block.text === CLAUDE_CODE_COMPATIBLE_DEFAULT_SYSTEM_BLOCKS[0].text | ||
| ); |
There was a problem hiding this comment.
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: "", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
buildClaudeCodeCompatibleRequestprepends 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. |
| "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", |
There was a problem hiding this comment.
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.
| 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 })), |
There was a problem hiding this comment.
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.
| {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> |
There was a problem hiding this comment.
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.
| # 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. |
There was a problem hiding this comment.
.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).
| # 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. |
|
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
|
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! |
|
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! |
|
Integrated into release/v3.7.4 |
* 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>
* 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>
* 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>
* 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>
Summary
.env.example, environment docs, and dashboard UI.Verification
npm run lintnpm run lint -- --quietnpm run typecheck:corenode --import tsx/esm --test tests/unit/claude-code-compatible-request.test.ts tests/unit/cc-compatible-provider.test.tsnpm run test:unitENABLE_CC_COMPATIBLE_PROVIDER=true