Skip to content

feat(models): set aws-bedrock claude models to 30% discount - #1368

Merged
steebchen merged 3 commits into
mainfrom
steebchen/bedrock-claude-discount
Dec 29, 2025
Merged

steebchen merged 3 commits into
mainfrom
steebchen/bedrock-claude-discount

Conversation

@steebchen

@steebchen steebchen commented Dec 29, 2025

Copy link
Copy Markdown
Member

Apply 30% discount to all AWS Bedrock Claude model variants including Sonnet, Opus, and Haiku models across all versions.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Applied a uniform 30% discount to multiple Claude model/provider configurations affecting pricing behavior.
  • Tests

    • Updated pricing tests to compare effective prices using provider priority and discount multipliers to determine the cheapest provider.

✏️ Tip: You can customize this high-level summary in your review settings.

Apply 40% discount to all AWS Bedrock Claude model variants.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 29, 2025 21:45
@coderabbitai

coderabbitai Bot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Added a per-provider discount: 0.3 field to many Anthropic provider entries and updated the cheapest-provider test to compute effective prices using provider priority and discount multipliers rather than a simple discounted vs regular price comparison.

Changes

Cohort / File(s) Summary
Anthropic model provider entries
packages/models/src/models/anthropic.ts
Added discount: 0.3 to numerous provider objects for multiple Claude model variants (aws-bedrock providers updated across several Claude entries).
Price selection test logic
packages/models/src/models.spec.ts
Imported getProviderDefinition and replaced the previous direct price comparison with multi-step effective-price computation factoring provider priority and discount to determine the cheapest provider.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • smakosh

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title states a 30% discount, but the PR description objectives indicate both 40% and 30% discounts. The actual changes show 0.3 discount (30%), which matches the PR title.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR applies a 40% discount to all AWS Bedrock Claude model variants by adding a discount: 0.4 field to their provider configurations. The discount is consistently applied across all Claude model families (Sonnet, Opus, and Haiku) available on AWS Bedrock.

  • Adds discount: 0.4 field to 9 AWS Bedrock Claude model provider configurations
  • Covers all Claude model variants: Sonnet (3.5, 3.7, 4, 4.5), Opus (4, 4.1, 4.5), and Haiku (3.5)
  • Maintains consistency in placement and formatting across all modified provider objects

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

steebchen and others added 2 commits December 29, 2025 22:03
The test was incorrectly calculating the discount price without
accounting for provider priority, causing false test failures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update discount from 40% to 30% per request.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@steebchen steebchen changed the title feat(models): set aws-bedrock claude models to 40% discount feat(models): set aws-bedrock claude models to 30% discount Dec 29, 2025

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/models/src/models.spec.ts (1)

522-559: Fix the effective price calculation for the regular provider—apply discount uniformly across all providers.

The test calculates effective prices differently from the implementation. The selectByPriceOnly function applies the discount multiplier to all providers:

const totalPrice = (((inputPrice + outputPrice) / 2) * (1 - discount))

However, the test only applies the discount to discountProvider but omits it for regularProvider. Update the test to apply the discount uniformly:

const regularDiscount = (regularProvider as ProviderModelMapping).discount ?? 0;
const regularDiscountMultiplier = 1 - regularDiscount;
const regularBasePrice = ((regularProvider.inputPrice! + regularProvider.outputPrice!) / 2) * regularDiscountMultiplier;

Additionally, when effective prices are equal, the implementation selects the first provider in the loop. The test should either handle this tie-breaking behavior explicitly or ensure test data always produces distinct effective prices.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4d1b17 and 1f5f70c.

📒 Files selected for processing (2)
  • packages/models/src/models.spec.ts
  • packages/models/src/models/anthropic.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/models/src/models/anthropic.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Never use any or as any unless absolutely necessary in TypeScript code
For database reads: Use db().query.<table>.findMany() or db().query.<table>.findFirst()

Files:

  • packages/models/src/models.spec.ts
**/*.{ts,tsx,js,jsx,json,md}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use tabs for indentation

Files:

  • packages/models/src/models.spec.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Always use top-level import, never use require or dynamic imports
No unnecessary code comments

Files:

  • packages/models/src/models.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests should use *.spec.ts file naming convention

Files:

  • packages/models/src/models.spec.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Always use top-level import, never use require or dynamic imports

Files:

  • packages/models/src/models.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: e2e-shards (4)
  • GitHub Check: e2e-shards (3)
  • GitHub Check: e2e-shards (5)
  • GitHub Check: e2e-shards (1)
  • GitHub Check: e2e-shards (2)
  • GitHub Check: generate / run
  • GitHub Check: lint / run
  • GitHub Check: build / run
  • GitHub Check: test / run
  • GitHub Check: autofix
🔇 Additional comments (1)
packages/models/src/models.spec.ts (1)

7-7: LGTM!

The import of getProviderDefinition is necessary to access provider priority data for the updated effective price calculations in the test below.

@steebchen
steebchen added this pull request to the merge queue Dec 29, 2025
Merged via the queue into main with commit 2e68061 Dec 29, 2025
15 of 16 checks passed
@steebchen
steebchen deleted the steebchen/bedrock-claude-discount branch December 29, 2025 22:19
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.

2 participants