feat: add support for AWS Bedrock provider#2826
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for AWS Bedrock as a new provider, including configuration management, request/response translation, and executor implementation. The review identified several areas for improvement: code duplication between the auth and service packages regarding configuration resolution, inefficient slice element modification in the patch handler, redundant logic across executor methods, and inconsistency in model hash calculations between the diff summary and the synthesizer. I have kept these comments as they highlight actionable technical debt and potential bugs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66a0cfacf9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
66a0cfa to
1733bfe
Compare
luispater
left a comment
There was a problem hiding this comment.
Summary
Adds first-class AWS Bedrock support (Converse + Converse-stream) across config → auth synthesis → executor → translators (Claude + OpenAI + OpenAI Responses) → model registry/watchers, including model aliasing (Name/ID/ARN) and token counting.
Key findings (non-blocking)
config.example.yaml: the commentedsensitive-wordslist items look mis-indented (may become invalid YAML when uncommented).- Usage accounting: please confirm whether Bedrock
cacheWriteInputTokensis additive vs a subset ofinputTokens; current mapping adds it toReasoningTokens, affecting totals. - OpenAI streaming ordering: if
metadataarrives beforemessageStop, the usage chunk can be emitted before the terminal finish_reason /[DONE]; consider buffering usage until completion for better OpenAI compatibility. - Tool results: consider also accepting
tool_call_idfortool_resultparts (in addition totool_use_id) for Responses-style payloads.
Checks / CI
pr-test-buildsucceeded.translator-path-guardfailed (ignored per review instructions).
Test plan
- I did not run anything locally (no checkout). Suggested:
go test ./...- Exercise non-stream + stream flows for: Chat Completions, Responses, and Claude Messages against a real Bedrock endpoint and an inference profile ARN.
This is an automated Codex review result and still requires manual verification by a human reviewer.
1733bfe to
2192d26
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2192d26ca6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
2192d26 to
bb9eab6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb9eab6a58
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
536be61 to
1376e1b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1376e1b9e4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
1376e1b to
3e9372f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e9372fef8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
- Add AWS Bedrock executor with Converse API support (/converse, /converse-stream) - Add Claude Messages API to Bedrock Converse request/response translation - Add OpenAI Chat Completions to Bedrock Converse translation support - Add Bedrock model registry, capability resolution, and alias configuration - Add Bedrock region endpoint derivation from region config - Extract shared request preparation into prepareBedrockRequest helper (Execute/ExecuteStream/CountTokens) - Fix PatchAWSBedrockKey value copy by using pointer reference - Fix model alias hash to include model.ID for change detection - Preserve non-text/non-toolUse blocks in Bedrock assistant message reordering
3e9372f to
ff7d63f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff7d63fa17
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@luispater 该特性我们已在生产环境应用了10 多天,未发现其他问题,帮忙评估一下是否可以接受这个特性。 |
…est URL Bedrock config model.ID (ARN) was not being used to construct the upstream request URL. The executor always used model.Name, causing 400 errors when invoking inference profiles. Now RouteTarget (ARN) takes precedence over Name.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a879a8e82d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
概述
为 AWS Bedrock provider 添加完整支持,通过 Bedrock Converse API 实现 Claude Messages API 和 OpenAI Chat Completions 两套协议的调用链路。
变更详情
🏗️ Bedrock Executor
BedrockExecutor,对接 AWS Bedrock Converse API(/model/{modelId}/converse和/model/{modelId}/converse-stream)🔄 Claude ↔ Bedrock 转译
anthropic格式 →converse格式)reasoningContent/reasoning多种嵌套路径)🔄 OpenAI ↔ Bedrock 转译
chat/completions格式 →converse格式)reasoningContent.reasoningText.text/reasoningContent.reasoning/reasoning.text/type: thinking等)⚙️ 配置与路由
aws-bedrock-api-key配置段:支持 API Key + Region 认证,模型通过 Name / ID(推理配置 ARN)/ Alias 三级映射prefix命名空间隔离和proxy-url独立代理设置🧪 模型注册与热更新
📝 配置示例
测试截图
代码已投入线上环境运行