Skip to content

feat: claude platform on aws channel#4957

Open
yingfengli wants to merge 3 commits into
QuantumNous:mainfrom
yingfengli:feat/claude-platform-on-aws
Open

feat: claude platform on aws channel#4957
yingfengli wants to merge 3 commits into
QuantumNous:mainfrom
yingfengli:feat/claude-platform-on-aws

Conversation

@yingfengli
Copy link
Copy Markdown

@yingfengli yingfengli commented May 19, 2026

Summary

Add a new channel type for Claude Platform on AWS — Anthropic's new offering (GA May 2026) that exposes the native Anthropic Messages API through AWS IAM auth and AWS Marketplace billing, with same-day access to new Claude models and beta features (Agent Skills, Code Execution, Files API, Extended Thinking, Prompt Caching).

This service is distinct from Amazon Bedrock:

  • Anthropic operates the inference stack (vs AWS for Bedrock)
  • Wire protocol is the native /v1/messages (vs Bedrock's /converse)
  • Features are released same-day with the first-party Claude API

Changes

Layer Change
Backend New channel type 58 (ChannelTypeClaudeOnAws) and api type APITypeClaudeOnAws
Backend New package relay/channel/claude_platform_on_aws/ (4 files): adapter embeds claude.Adaptor, only overrides URL / header / DoRequest paths
Backend Self-contained AWS SigV4 v4 signer (no new dependency), verified against the AWS official IAM ListUsers test vector
Backend dto.ChannelOtherSettings adds 3 fields: claude_on_aws_auth_type, claude_on_aws_region, claude_on_aws_workspace_id
Frontend (default) Type-58 form fields (auth method / region / workspace id), Claude icon, full i18n keys for en/zh/fr/ja/ru/vi
Frontend (classic) Same fields and icon mapping

Stats: 32 files changed, +1106 / -34, 0 new dependencies.

Authentication

Two modes, controlled by claude_on_aws_auth_type:

  • sigv4 (default): AWS Signature Version 4 via IAM credentials. The channel key field stores <AccessKeyID>|<SecretAccessKey> or <AK>|<SK>|<SessionToken> (matching the existing AWS Bedrock channel's key|region convention).
  • api_key: Bearer key issued in the AWS Console (under Claude Platform on AWS → API keys). Sent as Authorization: Bearer <key>.

Each request must carry an anthropic-workspace-id header; the value is taken from the channel settings, with optional override via the request header (so multiple workspaces can share a single channel).

Validation

Unit tests

  • TestSigV4_AWSReferenceVector — passes against AWS official IAM ListUsers vector (signature 5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7)
  • TestSigV4_ClaudePlatformOnAws_AddsRequiredHeaders
  • TestParseSigV4ApiKey (5 sub-cases)
  • TestCanonicalQuery

End-to-end against real AWS

Tested with API Key auth mode (Anthropic API key generated in AWS Console):

Scenario Result
Channel test (/api/channel/test/:id) ✅ 3.3s round-trip, 200 OK
Native /v1/messages (non-stream) ✅ Anthropic native response shape with inference_geo, cache_creation etc.
Native /v1/messages (SSE streaming) ✅ Complete event sequence: message_start → content_block_delta → message_stop
OpenAI /v1/chat/completions ✅ Auto protocol conversion (Claude ↔ OpenAI)
anthropic-beta header passthrough ✅ Verified by sending an invalid beta name and observing upstream's specific error
Extended Thinking (explicit thinking.type=enabled) ✅ Returns thinking + text content blocks
-thinking suffix shortcut (e.g. claude-sonnet-4-6-thinking) ✅ new-api auto-injects thinking config
Prompt Caching ✅ 1st call cache_creation_input_tokens=4003, 2nd call cache_read_input_tokens=4003
Tool Use (client tools) ✅ Correct stop_reason=tool_use and tool input
Code Execution beta (Anthropic-managed sandbox) bash_code_execution_tool_result.stdout="6765" for Fibonacci(20)

Build / lint

  • go build ./... — clean
  • go test ./relay/channel/claude_platform_on_aws/... — all pass
  • go vet on touched packages — clean
  • gofmt — clean
  • bun run typecheck (web/default) — clean
  • bun run build — both themes build successfully

Known limitations / out of scope

These are not blockers for this PR; they can be follow-ups:

  • Files API / Batches API: this PR only handles the /v1/messages route. The upstream /v1/files and /v1/batches routes are currently RelayNotImplemented placeholders project-wide; supporting them is a separate effort.
  • Auto model list refresh: the channel works in fetch-on-demand mode (like Amazon Bedrock); auto-pulling model list via /v1/models over SigV4 is not implemented.

Resources


中文摘要

为 new-api 增加 Claude Platform on AWS 通道(channel type 58)。该服务是 AWS 在 2026 年 5 月 GA 的 Claude 接入新方式,与 Bedrock 并列但相互独立:

  • 推理栈由 Anthropic 运营(Bedrock 由 AWS 运营)
  • 协议是原生 Anthropic Messages API(Bedrock 是 /converse)
  • Beta 特性(Agent Skills、Code Execution、Files API、Extended Thinking、Prompt Caching)与官方 Claude API 同日发布
  • 鉴权走 AWS IAM SigV4 或 AWS Console 颁发的 API Key,计费走 AWS Marketplace

设计要点

  • 后端新建 relay/channel/claude_platform_on_aws/ 包,通过 Go 嵌入复用 claude.Adaptor 的协议处理(streaming / thinking / tool use 全部继承),仅覆盖 URL / header / DoRequest 三处差异
  • SigV4 签名自实现,零新增第三方依赖,通过 AWS 官方测试向量验证
  • 前端 default + classic 双主题同步,六国语言 i18n
  • 上游已有的中文注释一律保留未动,新增的注释全部使用英文

联调状态

  • 9 项 Beta 特性 + 基础流式/非流式链路全部通过(详见上方表格)
  • 后端 / 前端 build 与 lint 全部干净
  • 通过 AWS 官方 SigV4 测试向量验证签名实现 100% 一致

Summary by CodeRabbit

  • New Features

    • Added "Claude Platform on AWS" channel with full UI for configuration, model selection, and key-format hints.
    • Supports two auth modes: API Key and AWS SigV4 (IAM); requires AWS region and workspace ID.
    • Streaming enabled for the new channel.
  • Localization

    • Added translations and help text for AWS/Claude Platform on AWS across multiple locales.
  • Tests

    • Added signing and parsing tests for AWS SigV4 behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 608b7b1c-2d22-427c-a9bc-18fbc84ae9c1

📥 Commits

Reviewing files that changed from the base of the PR and between fe72ac6 and 8c2ed6a.

📒 Files selected for processing (39)
  • common/api_type.go
  • common/endpoint_type.go
  • constant/api_type.go
  • constant/channel.go
  • dto/channel_settings.go
  • relay/channel/claude_platform_on_aws/adaptor.go
  • relay/channel/claude_platform_on_aws/constants.go
  • relay/channel/claude_platform_on_aws/sigv4.go
  • relay/channel/claude_platform_on_aws/sigv4_test.go
  • relay/common/relay_info.go
  • relay/relay_adaptor.go
  • web/classic/src/components/table/channels/modals/EditChannelModal.jsx
  • web/classic/src/constants/channel.constants.js
  • web/classic/src/helpers/render.jsx
  • web/classic/src/i18n/locales/en.json
  • web/classic/src/i18n/locales/fr.json
  • web/classic/src/i18n/locales/ja.json
  • web/classic/src/i18n/locales/ru.json
  • web/classic/src/i18n/locales/vi.json
  • web/classic/src/i18n/locales/zh-CN.json
  • web/classic/src/i18n/locales/zh-TW.json
  • web/classic/src/i18n/locales/zh.json
  • web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx
  • web/default/src/features/channels/constants.ts
  • web/default/src/features/channels/lib/channel-form.ts
  • web/default/src/features/channels/lib/channel-type-config.ts
  • web/default/src/features/channels/lib/channel-utils.ts
  • web/default/src/features/channels/types.ts
  • web/default/src/i18n/locales/_reports/_sync-report.json
  • web/default/src/i18n/locales/_reports/ja.untranslated.json
  • web/default/src/i18n/locales/_reports/ru.untranslated.json
  • web/default/src/i18n/locales/_reports/vi.untranslated.json
  • web/default/src/i18n/locales/_reports/zh.untranslated.json
  • web/default/src/i18n/locales/en.json
  • web/default/src/i18n/locales/fr.json
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/vi.json
  • web/default/src/i18n/locales/zh.json
✅ Files skipped from review due to trivial changes (13)
  • common/api_type.go
  • web/classic/src/constants/channel.constants.js
  • web/default/src/i18n/locales/_reports/_sync-report.json
  • web/default/src/i18n/locales/_reports/ru.untranslated.json
  • web/classic/src/i18n/locales/zh-CN.json
  • web/default/src/i18n/locales/_reports/vi.untranslated.json
  • web/default/src/i18n/locales/fr.json
  • web/classic/src/i18n/locales/fr.json
  • web/classic/src/i18n/locales/zh.json
  • web/default/src/i18n/locales/zh.json
  • web/default/src/features/channels/lib/channel-type-config.ts
  • web/classic/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/_reports/zh.untranslated.json
🚧 Files skipped from review as they are similar to previous changes (25)
  • constant/channel.go
  • common/endpoint_type.go
  • relay/common/relay_info.go
  • web/default/src/features/channels/types.ts
  • web/default/src/features/channels/constants.ts
  • web/classic/src/helpers/render.jsx
  • web/classic/src/i18n/locales/en.json
  • web/default/src/i18n/locales/en.json
  • web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx
  • relay/relay_adaptor.go
  • web/default/src/features/channels/lib/channel-utils.ts
  • web/classic/src/i18n/locales/vi.json
  • dto/channel_settings.go
  • web/default/src/i18n/locales/vi.json
  • constant/api_type.go
  • relay/channel/claude_platform_on_aws/constants.go
  • web/classic/src/i18n/locales/zh-TW.json
  • relay/channel/claude_platform_on_aws/sigv4_test.go
  • web/default/src/i18n/locales/_reports/ja.untranslated.json
  • web/classic/src/components/table/channels/modals/EditChannelModal.jsx
  • web/classic/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/features/channels/lib/channel-form.ts
  • relay/channel/claude_platform_on_aws/adaptor.go
  • relay/channel/claude_platform_on_aws/sigv4.go

Walkthrough

Adds a new Claude Platform on AWS channel (ID 58) with SigV4 signing support, a dedicated relay adaptor, backend type/constants/DTO updates, UI configuration in classic and default frontends, and localization across multiple locales.

Changes

Claude Platform on AWS Channel Support

Layer / File(s) Summary
Backend Constants and Type Mappings
constant/channel.go, constant/api_type.go, common/api_type.go, common/endpoint_type.go, dto/channel_settings.go
Introduces channel type ChannelTypeClaudeOnAws (58), maps it to APITypeClaudeOnAws, adds endpoint handling, and extends ChannelOtherSettings with auth type, region, and workspace ID.
AWS SigV4 Request Signing
relay/channel/claude_platform_on_aws/sigv4.go, relay/channel/claude_platform_on_aws/sigv4_test.go
Implements SigV4 credential parsing, canonicalization, signing-key derivation, request signing, body buffering, and tests covering AWS reference vectors and Claude-on-AWS scenarios.
Adaptor and Routing Integration
relay/channel/claude_platform_on_aws/constants.go, relay/channel/claude_platform_on_aws/adaptor.go, relay/relay_adaptor.go, relay/common/relay_info.go
Adds the Claude-on-AWS adaptor (embedding base Claude adaptor), implements region/workspace resolution and auth branching (API key vs SigV4), integrates the adaptor into the relay factory, and enables stream support for the channel.
Frontend Constants and Configuration
web/classic/src/constants/channel.constants.js, web/classic/src/helpers/render.jsx, web/default/src/features/channels/constants.ts, web/default/src/features/channels/types.ts, web/default/src/features/channels/lib/channel-utils.ts, web/default/src/features/channels/lib/channel-type-config.ts
Adds channel type 58 to frontends, icon mapping, display constants, key-format hints for API key and SigV4 modes, and model hints.
Classic UI Implementation
web/classic/src/components/table/channels/modals/EditChannelModal.jsx
Extends EditChannelModal to load/save Claude-on-AWS settings (auth type, region, workspace ID) within settings JSON, render auth method selector and AWS inputs, and adjust API key placeholder for SigV4 format.
Default UI Implementation
web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx, web/default/src/features/channels/lib/channel-form.ts
Adds form schema fields and Zod validation for type 58, transforms settings JSON to/from form state, and renders conditional AWS auth/region/workspace ID fields.
Internationalization
web/default/src/i18n/locales/{en,fr,ja,ru,vi,zh}.json, web/classic/src/i18n/locales/*
Adds localization keys and strings for "Authentication Method", AWS region, SigV4 (IAM), "Claude Platform on AWS", Workspace ID, credential format examples, and required anthropic-workspace-id header across multiple locales; updates sync-report metrics.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • seefs001
  • Calcium-Ion

Poem

🐰 I hopped through code and signed the sky,
AK and SK with a SigV4 sigh,
Claude on AWS in regions wide,
Workspace IDs tucked safe inside,
Hop—new channels bloom with a happy cry.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: claude platform on aws channel' clearly and concisely describes the primary feature being added: a new channel type for Claude Platform on AWS, which is the main focus of all 32 file changes across backend and frontend.
Docstring Coverage ✅ Passed Docstring coverage is 84.62% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.42.2)
web/classic/src/components/table/channels/modals/EditChannelModal.jsx

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (2)
web/classic/src/components/table/channels/modals/EditChannelModal.jsx (1)

2731-2793: ⚡ Quick win

Missing key format hint when SigV4 authentication is selected.

When claude_on_aws_auth_type is 'sigv4', users need to enter credentials in AK|SK or AK|SK|SessionToken format, but the key input placeholder (line 3168) falls through to the generic message from type2secretPrompt. Type 33 (AWS Bedrock) handles this by conditionally setting the placeholder based on aws_key_type.

Consider adding type 58 to the conditional placeholder logic in the key input field (around line 3163-3169):

💡 Suggested enhancement
 placeholder={
   inputs.type === 33
     ? inputs.aws_key_type === 'api_key'
       ? t('请输入 API Key,格式:APIKey|Region')
       : t(
           '按照如下格式输入:AccessKey|SecretAccessKey|Region',
         )
+    : inputs.type === 58
+    ? inputs.claude_on_aws_auth_type === 'sigv4'
+      ? t(
+          '按照如下格式输入:AccessKeyID|SecretAccessKey 或 AK|SK|SessionToken',
+        )
+      : t('请输入 API Key')
     : t(type2secretPrompt(inputs.type))
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/classic/src/components/table/channels/modals/EditChannelModal.jsx` around
lines 2731 - 2793, The key input's placeholder isn't updated for channel type 58
when users select SigV4; update the logic that computes the placeholder (the
same logic that references type2secretPrompt / aws_key_type for type 33) to also
handle type 58 by checking inputs.claude_on_aws_auth_type and, when it's
'sigv4', set the placeholder to the AK|SK or AK|SK|SessionToken hint; when it's
'api_key' keep the existing type2secretPrompt/default placeholder. Locate the
key input that uses type2secretPrompt (the secret/key field for Claude on AWS)
and add the conditional branch based on inputs.claude_on_aws_auth_type (and
channel type 58) to return the SigV4-specific placeholder.
web/default/src/i18n/locales/en.json (1)

426-426: 🏗️ Heavy lift

Use hierarchical i18n keys for the new AWS/Claude strings.

These newly added entries use raw UI text as keys. Please switch them to semantic hierarchical keys (for example, channels.claudeOnAws.authMethod.label) to comply with project i18n naming rules and keep key naming consistent.

As per coding guidelines, use “hierarchical and semantically clear translation key names such as dashboard.overview.title and maintain naming consistency”.

Also applies to: 470-471, 705-705, 4480-4487

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/default/src/i18n/locales/en.json` at line 426, The i18n file uses raw UI
text keys (e.g., "Authentication Method") instead of hierarchical semantic keys;
refactor those keys to hierarchical names (for example rename "Authentication
Method" → "channels.claudeOnAws.authMethod.label") and apply the same pattern
for the other affected entries (lines referenced around 470-471, 705, and
4480-4487) and then update any code that references the old literal keys to use
the new keys (search for usages of "Authentication Method" and the other raw
keys and replace them with the new hierarchical keys such as
channels.claudeOnAws.* to keep naming consistent).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/default/src/features/channels/lib/channel-form.ts`:
- Around line 130-133: The claude_on_aws_auth_type default is set to 'api_key'
but should be SigV4; update every initialization/fallback that sets
claude_on_aws_auth_type (e.g., the defaults object where
claude_on_aws_auth_type: 'api_key' appears and any other places that fallback to
'api_key' such as form initializers/serializers referenced around the other
occurrences) to use 'sigv4' (or the canonical string used elsewhere for SigV4)
so new/edited channels default to SigV4; ensure related fields
claude_on_aws_region and claude_on_aws_workspace_id remain unchanged and run a
quick search for all usages of claude_on_aws_auth_type to update any conditional
logic that assumes 'api_key'.
- Around line 68-71: The Zod schema currently leaves claude_on_aws_region and
claude_on_aws_workspace_id optional which allows invalid submissions when the
channel type is Claude-on-AWS (type === 58); update the channel form Zod object
schema that contains claude_on_aws_auth_type, claude_on_aws_region and
claude_on_aws_workspace_id to add a conditional validation (using .refine or
.superRefine on the parent schema) that when type === 58 enforces
claude_on_aws_region and claude_on_aws_workspace_id are present and non-empty
(and optionally validate claude_on_aws_auth_type if you need to constrain auth
types), returning clear field-specific errors for those two fields so the form
cannot submit invalid configs.

In `@web/default/src/i18n/locales/fr.json`:
- Line 426: Replace the English strings left in fr.json with French translations
while keeping the existing translation keys and hierarchy intact: specifically
update the value for "Authentication Method" to "Méthode d'authentification" and
translate the other English values referenced at the ranges (lines ~470, ~471,
~705 and ~4480-~4487) to appropriate French text, preserving naming consistency
and any hierarchical key structure so only the values change and key names
remain unchanged.

In `@web/default/src/i18n/locales/ja.json`:
- Line 426: The ja.json locale contains untranslated English values (e.g., the
key "Authentication Method") which cause mixed-language UI; update the value for
"Authentication Method" and any other English entries in ja.json (including the
groups noted around the other ranges) to their correct Japanese translations,
preserving the JSON keys unchanged and ensuring encoding/escaping remains valid
so the file stays a well-formed JSON locale file.

In `@web/default/src/i18n/locales/ru.json`:
- Line 426: Several new entries in the Russian locale file are left in English
(e.g., the key "Authentication Method" in ru.json and the other untranslated
entries around lines referenced 4480-4487); update those values to proper
Russian translations, preserving the JSON keys and punctuation, ensure the file
remains valid JSON (proper quoting, commas, and UTF-8 encoding), and run a quick
lint/format check to confirm no syntax errors after replacing the English
strings with their Russian equivalents.

In `@web/default/src/i18n/locales/vi.json`:
- Line 426: The Vietnamese locale contains untranslated English entries (for
example the key "Authentication Method" and other newly added keys around lines
noted in the review); update vi.json by replacing these English values with
proper Vietnamese translations for each key (including the entries referenced at
lines ~426, ~470-471, ~705, and ~4480-4487), and ensure the translation keys
follow the repository's naming convention (use hierarchical, semantically clear
keys such as dashboard.overview.title where applicable) so the file remains
consistent and UI strings render fully in Vietnamese.

In `@web/default/src/i18n/locales/zh.json`:
- Line 4480: The zh.json entry for the key "Workspace ID *" is still English;
update the value in the Chinese locale file so the key "Workspace ID *" maps to
an appropriate Chinese translation (e.g., "工作区 ID *") to avoid mixed-language
UI—locate the string "Workspace ID *" in zh.json and replace its value with the
Chinese text.

---

Nitpick comments:
In `@web/classic/src/components/table/channels/modals/EditChannelModal.jsx`:
- Around line 2731-2793: The key input's placeholder isn't updated for channel
type 58 when users select SigV4; update the logic that computes the placeholder
(the same logic that references type2secretPrompt / aws_key_type for type 33) to
also handle type 58 by checking inputs.claude_on_aws_auth_type and, when it's
'sigv4', set the placeholder to the AK|SK or AK|SK|SessionToken hint; when it's
'api_key' keep the existing type2secretPrompt/default placeholder. Locate the
key input that uses type2secretPrompt (the secret/key field for Claude on AWS)
and add the conditional branch based on inputs.claude_on_aws_auth_type (and
channel type 58) to return the SigV4-specific placeholder.

In `@web/default/src/i18n/locales/en.json`:
- Line 426: The i18n file uses raw UI text keys (e.g., "Authentication Method")
instead of hierarchical semantic keys; refactor those keys to hierarchical names
(for example rename "Authentication Method" →
"channels.claudeOnAws.authMethod.label") and apply the same pattern for the
other affected entries (lines referenced around 470-471, 705, and 4480-4487) and
then update any code that references the old literal keys to use the new keys
(search for usages of "Authentication Method" and the other raw keys and replace
them with the new hierarchical keys such as channels.claudeOnAws.* to keep
naming consistent).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e5b765d-cd51-4eaf-9b23-0f5af0e477cf

📥 Commits

Reviewing files that changed from the base of the PR and between 5dd0d3b and 1f31465.

📒 Files selected for processing (32)
  • common/api_type.go
  • common/endpoint_type.go
  • constant/api_type.go
  • constant/channel.go
  • dto/channel_settings.go
  • relay/channel/claude_platform_on_aws/adaptor.go
  • relay/channel/claude_platform_on_aws/constants.go
  • relay/channel/claude_platform_on_aws/sigv4.go
  • relay/channel/claude_platform_on_aws/sigv4_test.go
  • relay/common/relay_info.go
  • relay/relay_adaptor.go
  • web/classic/src/components/table/channels/modals/EditChannelModal.jsx
  • web/classic/src/constants/channel.constants.js
  • web/classic/src/helpers/render.jsx
  • web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx
  • web/default/src/features/channels/constants.ts
  • web/default/src/features/channels/lib/channel-form.ts
  • web/default/src/features/channels/lib/channel-type-config.ts
  • web/default/src/features/channels/lib/channel-utils.ts
  • web/default/src/features/channels/types.ts
  • web/default/src/i18n/locales/_reports/_sync-report.json
  • web/default/src/i18n/locales/_reports/fr.untranslated.json
  • web/default/src/i18n/locales/_reports/ja.untranslated.json
  • web/default/src/i18n/locales/_reports/ru.untranslated.json
  • web/default/src/i18n/locales/_reports/vi.untranslated.json
  • web/default/src/i18n/locales/_reports/zh.untranslated.json
  • web/default/src/i18n/locales/en.json
  • web/default/src/i18n/locales/fr.json
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/vi.json
  • web/default/src/i18n/locales/zh.json

Comment thread web/default/src/features/channels/lib/channel-form.ts
Comment thread web/default/src/features/channels/lib/channel-form.ts
Comment thread web/default/src/i18n/locales/fr.json Outdated
Comment thread web/default/src/i18n/locales/ja.json Outdated
Comment thread web/default/src/i18n/locales/ru.json Outdated
Comment thread web/default/src/i18n/locales/vi.json Outdated
Comment thread web/default/src/i18n/locales/zh.json Outdated
yingfengli added a commit to yingfengli/new-api that referenced this pull request May 19, 2026
…ous#4957

Backend (relay/channel/claude_platform_on_aws/):
  - Add godoc comments to GetChannelName / GetModelList and the
    SigV4 helpers hashSHA256Hex / hmacSHA256 / deriveSigningKey.
  - Add doc comments to TestParseSigV4ApiKey / TestCanonicalQuery.

Frontend (web/default/):
  - Default auth type to sigv4 (matches the backend documented
    default and AWS's primary recommendation; the previous api_key
    default could silently create channels with the wrong mode).
  - Required-field validation for channel type 58: region,
    workspace_id and auth type must be set.
  - i18n: complete the zh translation for "Workspace ID *" and
    sync new keys across fr / ja / ru / vi.

Frontend (web/classic/):
  - Show a SigV4-aware placeholder on the key input when
    type=58 and auth_type=sigv4
    ("AccessKeyID|SecretAccessKey or AK|SK|SessionToken").
  - Sync i18n keys across en / fr / ja / ru / vi / zh-CN /
    zh-TW / zh.
@yingfengli
Copy link
Copy Markdown
Author

Thanks for the thorough review! Pushed 86649e84 addressing the feedback.

Backend (relay/channel/claude_platform_on_aws/)

  • Added godoc comments for GetChannelName / GetModelList and the SigV4 helpers (hashSHA256Hex, hmacSHA256, deriveSigningKey).
  • Added doc comments for TestParseSigV4ApiKey / TestCanonicalQuery.

Frontend web/default/

  • Default auth type → sigv4 (form defaults / parser fallbacks / serializer fallback). This now matches the backend's documented default and AWS's "primary" recommendation. Existing channels are unaffected — their claude_on_aws_auth_type is already explicitly persisted in settings.
  • Added required-field validation for channel type 58: region, workspace_id and auth_type must all be set before submit.
  • i18n: completed the zh translation for "Workspace ID *"; new keys synced across fr / ja / ru / vi.

Frontend web/classic/

  • The key input now shows a SigV4-aware placeholder when type=58 && auth_type=sigv4:
    AccessKeyID|SecretAccessKey or AK|SK|SessionToken.
  • i18n synced across en / fr / ja / ru / vi / zh-CN / zh-TW / zh.

The docstring coverage warning should now be resolved.


中文摘要

已根据 review 推了一个 follow-up commit:

  • 后端补齐 godoc 注释
  • Default 前端默认鉴权改为 sigv4(对齐后端文档与 AWS 官方"primary"推荐),并加了必填校验
  • Classic 前端 key 输入框在 SigV4 模式下显示对应格式提示
  • 中文 / 多语言 i18n 同步

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
web/default/src/i18n/locales/fr.json (1)

705-705: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Finish French localization for remaining Claude-on-AWS labels/help text.

These values still surface mixed English in fr.json, which creates an inconsistent French UI.

🌍 Suggested patch
-    "Claude Platform on AWS": "Claude Platform on AWS",
+    "Claude Platform on AWS": "Plateforme Claude sur AWS",
-    "API Key mode: paste the key generated in AWS Console → Claude Platform on AWS → API keys": "Mode Clé API : collez la clé générée dans AWS Console → Claude Platform on AWS → API keys",
+    "API Key mode: paste the key generated in AWS Console → Claude Platform on AWS → API keys": "Mode clé API : collez la clé générée dans la console AWS → Plateforme Claude sur AWS → Clés API",
-    "Region of the Claude Platform on AWS endpoint, used in URL aws-external-anthropic.{region}.api.aws": "Région du point de terminaison Claude Platform on AWS, utilisée dans l'URL aws-external-anthropic.{region}.api.aws",
+    "Region of the Claude Platform on AWS endpoint, used in URL aws-external-anthropic.{region}.api.aws": "Région du point de terminaison Plateforme Claude sur AWS, utilisée dans l'URL aws-external-anthropic.{region}.api.aws",
-    "Required anthropic-workspace-id header. Find it in AWS Console → Claude Platform on AWS → Workspaces.": "En-tête anthropic-workspace-id requis. Trouvez-le dans AWS Console → Claude Platform on AWS → Workspaces.",
+    "Required anthropic-workspace-id header. Find it in AWS Console → Claude Platform on AWS → Workspaces.": "En-tête anthropic-workspace-id requis. Trouvez-le dans la console AWS → Plateforme Claude sur AWS → Espaces de travail.",

As per coding guidelines, "Use hierarchical and semantically clear translation key names such as dashboard.overview.title and maintain naming consistency".

Also applies to: 4482-4482, 4485-4485, 4487-4487

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/default/src/i18n/locales/fr.json` at line 705, Replace the English
strings in fr.json with proper French translations for the remaining
Claude-on-AWS labels/help text: locate the entry whose key/value is "Claude
Platform on AWS" and update the value to the French equivalent (e.g.,
"Plateforme Claude sur AWS") and do the same for the other remaining English
entries referenced in the review (the other Claude-on-AWS labels at the same
block). Keep the existing JSON keys intact, only change the values to French,
and ensure wording follows the project's hierarchical/semantic translation
naming style and tone.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/classic/src/components/table/channels/modals/EditChannelModal.jsx`:
- Line 204: The default auth mode for Type 58 is incorrectly set to 'api_key';
update all occurrences that set or fallback to claude_on_aws_auth_type to use
'sigv4' instead (this impacts initialization, loading, saving and UI fallback
paths). Search for the symbol claude_on_aws_auth_type and replace the default
value 'api_key' with 'sigv4' in the EditChannelModal.jsx defaults and any other
places referenced in the diff (including the other reported occurrences at the
same symbol) so new channels pick sigv4 by default and remain backend-aligned.

---

Duplicate comments:
In `@web/default/src/i18n/locales/fr.json`:
- Line 705: Replace the English strings in fr.json with proper French
translations for the remaining Claude-on-AWS labels/help text: locate the entry
whose key/value is "Claude Platform on AWS" and update the value to the French
equivalent (e.g., "Plateforme Claude sur AWS") and do the same for the other
remaining English entries referenced in the review (the other Claude-on-AWS
labels at the same block). Keep the existing JSON keys intact, only change the
values to French, and ensure wording follows the project's hierarchical/semantic
translation naming style and tone.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fb415fd6-1adb-4334-96b3-13857f253e79

📥 Commits

Reviewing files that changed from the base of the PR and between 1f31465 and 86649e8.

📒 Files selected for processing (19)
  • relay/channel/claude_platform_on_aws/adaptor.go
  • relay/channel/claude_platform_on_aws/sigv4.go
  • relay/channel/claude_platform_on_aws/sigv4_test.go
  • web/classic/src/components/table/channels/modals/EditChannelModal.jsx
  • web/classic/src/i18n/locales/en.json
  • web/classic/src/i18n/locales/fr.json
  • web/classic/src/i18n/locales/ja.json
  • web/classic/src/i18n/locales/ru.json
  • web/classic/src/i18n/locales/vi.json
  • web/classic/src/i18n/locales/zh-CN.json
  • web/classic/src/i18n/locales/zh-TW.json
  • web/classic/src/i18n/locales/zh.json
  • web/default/src/features/channels/lib/channel-form.ts
  • web/default/src/i18n/locales/_reports/_sync-report.json
  • web/default/src/i18n/locales/fr.json
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/vi.json
  • web/default/src/i18n/locales/zh.json
✅ Files skipped from review due to trivial changes (4)
  • web/classic/src/i18n/locales/zh-CN.json
  • web/classic/src/i18n/locales/fr.json
  • web/classic/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (8)
  • web/default/src/i18n/locales/_reports/_sync-report.json
  • web/default/src/i18n/locales/vi.json
  • relay/channel/claude_platform_on_aws/sigv4_test.go
  • web/default/src/i18n/locales/ja.json
  • web/default/src/features/channels/lib/channel-form.ts
  • web/default/src/i18n/locales/ru.json
  • relay/channel/claude_platform_on_aws/adaptor.go
  • relay/channel/claude_platform_on_aws/sigv4.go

Comment thread web/classic/src/components/table/channels/modals/EditChannelModal.jsx Outdated
yingfengli added a commit to yingfengli/new-api that referenced this pull request May 19, 2026
…sh fr i18n

- Classic UI: default claude_on_aws_auth_type to 'sigv4' across init,
  parsed-settings fallback, catch branch, legacy-data fallback, UI Select
  value, and persist default. Matches the default UI behavior and PR
  objective; prevents silently selecting api_key for new type 58 channels.
- French i18n (web/default): switch to lowercase "console AWS" and localize
  "API keys" -> "Clés API" / "Workspaces" -> "Espaces de travail" to match
  existing fr.json conventions (cf. line 351 "Clés API", line 4438
  "Espaces de travail"). The product name "Claude Platform on AWS" is
  intentionally kept untranslated for cross-locale consistency: zh/ja/ru/vi/en
  all retain the original spelling, in line with AWS documentation conventions
  for product names.

Addresses PR QuantumNous#4957 second-round review feedback.
@yingfengli
Copy link
Copy Markdown
Author

Thanks for the review. Pushed fe72ac66 addressing both round-2 comments:

1. Default auth mode (Major)
Aligned classic UI to default claude_on_aws_auth_type = 'sigv4' across all
5 fallback paths in EditChannelModal.jsx (init, parsed-settings load, JSON
parse error, legacy data, persist, UI Select value). Now consistent with the
default UI and the PR's stated goal.

2. French localization (Minor)
Applied lowercase console AWS, localized API keysClés API and
WorkspacesEspaces de travail to match existing fr.json conventions
(line 351 Clés API, line 4438 Espaces de travail).

The product name Claude Platform on AWS is intentionally kept untranslated
across all locales (zh/ja/ru/vi/en/fr) — matching AWS official documentation
conventions for product names. Happy to translate it if maintainers prefer
otherwise.


感谢 review。已通过 fe72ac66 修复两处问题:

  • Classic UI 默认认证模式从 api_key 全面改为 sigv4(共 5 处 fallback)
  • 法语本地化补全(console AWS / Clés API / Espaces de travail)
  • 产品名 Claude Platform on AWS 跨语种统一保持英文(对齐 AWS 官方文档约定)

Add a new channel type for Claude Platform on AWS — Anthropic's
new offering that exposes the native Anthropic Messages API through
AWS IAM auth and AWS Marketplace billing, with same-day access to
new Claude models and beta features (Agent Skills, Code Execution,
Files API, Extended Thinking, Prompt Caching).

Channel type: 58 (ChannelTypeClaudeOnAws)
API type:    APITypeClaudeOnAws

The wire protocol is identical to the first-party Anthropic Messages
API. The adapter embeds claude.Adaptor and only overrides the URL,
header and DoRequest paths — every other concern (streaming,
thinking, tool use, prompt caching, response parsing) is reused.

Authentication supports two modes:
  - sigv4   (default): AWS Signature Version 4 via IAM credentials
  - api_key:           Bearer key issued in the AWS Console
SigV4 signing is implemented in-package (no new dependency) and
verified against the AWS official IAM ListUsers test vector.

Each request must carry an anthropic-workspace-id header; the value
is taken from the channel's other_settings, with optional override
via the request header.

Frontend changes:
  - default theme: type-58 form fields (auth method / region /
    workspace id), Claude icon, full i18n keys
  - classic theme: same fields and icon mapping

Tested end-to-end against AWS:
  - native /v1/messages (streaming and non-streaming)
  - OpenAI /v1/chat/completions via protocol conversion
  - extended thinking (explicit and -thinking suffix)
  - prompt caching, tool use, code execution beta
  - anthropic-beta header passthrough
…ous#4957

Backend (relay/channel/claude_platform_on_aws/):
  - Add godoc comments to GetChannelName / GetModelList and the
    SigV4 helpers hashSHA256Hex / hmacSHA256 / deriveSigningKey.
  - Add doc comments to TestParseSigV4ApiKey / TestCanonicalQuery.

Frontend (web/default/):
  - Default auth type to sigv4 (matches the backend documented
    default and AWS's primary recommendation; the previous api_key
    default could silently create channels with the wrong mode).
  - Required-field validation for channel type 58: region,
    workspace_id and auth type must be set.
  - i18n: complete the zh translation for "Workspace ID *" and
    sync new keys across fr / ja / ru / vi.

Frontend (web/classic/):
  - Show a SigV4-aware placeholder on the key input when
    type=58 and auth_type=sigv4
    ("AccessKeyID|SecretAccessKey or AK|SK|SessionToken").
  - Sync i18n keys across en / fr / ja / ru / vi / zh-CN /
    zh-TW / zh.
…sh fr i18n

- Classic UI: default claude_on_aws_auth_type to 'sigv4' across init,
  parsed-settings fallback, catch branch, legacy-data fallback, UI Select
  value, and persist default. Matches the default UI behavior and PR
  objective; prevents silently selecting api_key for new type 58 channels.
- French i18n (web/default): switch to lowercase "console AWS" and localize
  "API keys" -> "Clés API" / "Workspaces" -> "Espaces de travail" to match
  existing fr.json conventions (cf. line 351 "Clés API", line 4438
  "Espaces de travail"). The product name "Claude Platform on AWS" is
  intentionally kept untranslated for cross-locale consistency: zh/ja/ru/vi/en
  all retain the original spelling, in line with AWS documentation conventions
  for product names.

Addresses PR QuantumNous#4957 second-round review feedback.
@yingfengli yingfengli force-pushed the feat/claude-platform-on-aws branch from fe72ac6 to 8c2ed6a Compare May 19, 2026 09:18
@yingfengli
Copy link
Copy Markdown
Author

Force-pushed to add SSH signatures on all 3 commits — no code changes. The
"Commits must have verified signatures" requirement on this PR was the only
remaining hard block, and it required rewriting commit objects (signature
goes into the commit object itself, so SHAs change).

What changed:

  • ✅ All 3 commits now SSH-signed (you should see "Verified" badges)
  • ❌ Tree contents are identical — git diff between old and new SHAs is empty

Old → new SHA mapping:

Old New
feat 1f314659 199525fb
fix #1 86649e84 8cc55bae
fix #2 fe72ac66 8c2ed6ae

Sorry for the noise — happy to squash or restructure further if helpful.


为补齐 commit 签名要求做了一次 force-push,代码内容完全没变,只是给 3 个 commit 加上了 SSH 签名(签名信息写进 commit object,所以 SHA 全变了)。

  • ✅ 3 个 commit 现在都有 GitHub Verified 标签
  • ❌ tree 内容一致,新旧 SHA 之间 diff 为空

如需要 squash 或调整 commit 结构,可以再改。

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