Skip to content

Added new AWS Bedrock Provider#652

Open
afalk42 wants to merge 4 commits intosteipete:mainfrom
afalk42:main
Open

Added new AWS Bedrock Provider#652
afalk42 wants to merge 4 commits intosteipete:mainfrom
afalk42:main

Conversation

@afalk42
Copy link
Copy Markdown

@afalk42 afalk42 commented Apr 6, 2026

AWS Bedrock provider

Added support for AWS Bedrock as a provider. This is using the AWS CE (Cost Explorer) API to retrieve costs of running LLMs, such as Claude Opus 4.6 on AWS Bedrock.

Supports setting a budget via environment variable and fully supports the Cost card in the menu with 30d history:

image

afalk42 added 4 commits April 5, 2026 19:36
  - BedrockUsageFetcher.fetchDailyReport — calls Cost Explorer with DAILY granularity over the last 30 days, groups by service, filters for
  "Bedrock" in service names, and produces CostUsageDailyReport.Entry items with per-model breakdowns
  - CostUsageFetcher.loadBedrockTokenSnapshot — Bedrock-specific path that bypasses the local file scanner and calls the AWS API directly
  - 4 UI guards updated — UsageStore.refreshTokenUsage, MenuCardView.tokenUsageSection, StatusItemController+Menu.makeCostHistorySubmenu,
  and menuCardModel tokenSnapshot wiring all now include .bedrock

  The Bedrock cost section should now show "Today" and "Last 30 days" values, plus the bar chart submenu with daily cost breakdowns by model
   (e.g. "Claude Opus 4.6 (Bedrock Edition)").
Copy link
Copy Markdown

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

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: 5cbc6f7745

ℹ️ 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 on lines +81 to +83
let env = ProcessInfo.processInfo.environment
guard let accessKeyID = BedrockSettingsReader.accessKeyID(environment: env),
let secretAccessKey = BedrockSettingsReader.secretAccessKey(environment: env)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Read Bedrock creds from provider context for cost history

loadBedrockTokenSnapshot pulls credentials from ProcessInfo.processInfo.environment instead of the provider-specific environment assembled from Settings/config overrides, so Bedrock keys saved in the app settings are ignored during cost-history fetches. In practice this makes the main Bedrock usage fetch work (it uses context.env) while the token/cost history section fails with missingCredentials unless AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are exported globally.

Useful? React with 👍 / 👎.

Comment on lines +34 to +37
case .bedrock:
env[BedrockSettingsReader.accessKeyIDKey] = apiKey
if let secret = config?.sanitizedCookieHeader, !secret.isEmpty {
env[BedrockSettingsReader.secretAccessKeyKey] = secret
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 Merge Bedrock secret/region overrides without apiKey guard

The new .bedrock environment mapping is inside a function-level guard that returns early unless config.sanitizedAPIKey is set, so Bedrock-specific fields in config (secretAccessKey/region) are never applied when the access key comes from the shell environment. This breaks mixed setups (e.g., AWS_ACCESS_KEY_ID from env + secret in Settings) and causes credential resolution to fail even though each field is presented as independently configurable.

Useful? React with 👍 / 👎.

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