Skip to content

[AISAGE-707] chore(ai-gateway): remove the in-code custom pricing fallback - #9003

Merged
chrarnoldus merged 1 commit into
mainfrom
chore/remove-custom-pricing-fallback
Oct 28, 2026
Merged

chrarnoldus merged 1 commit into
mainfrom
chore/remove-custom-pricing-fallback

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

Custom pricing now lives in ai_gateway_config.custom_pricing, so the hardcoded CUSTOM_PRICING_FALLBACK_CONFIG (the Gemini 3.8 Flash and Gemini 4 Argon discounts) is removed.

  • When no config is stored, or the first read fails, the gateway applies no custom pricing (EMPTY_CUSTOM_PRICING_CONFIG). This matches how preferred provider order handles an unset value. If a read fails after a successful one, the cached getter still serves the last valid value.
  • The admin Custom Pricing screen and admin.customPricing.get no longer return or show in-code defaults. An unset config opens the editor with { "models": [] }.
  • The Providers & Models page shows list prices until the stored config loads.
  • Tests that relied on the fallback now use a TEST_CUSTOM_PRICING_CONFIG fixture in packages/web-shared/src/tests/helpers/custom-pricing.helper.ts.

Verification

  • pnpm --filter @kilocode/web-shared typecheck and pnpm --filter web typecheck
  • oxlint on the changed files
  • Jest: packages/web-shared/src/lib/ai-gateway/, apps/web/src/components/organizations/providers-and-models, apps/web/src/lib/agent-briefing/summary.test.ts, apps/web/src/routers/admin/custom-pricing-router.test.ts (all pass)

Models used: Claude Opus 5.5 (kilo/anthropic/claude-opus-5.5). No subagents were used.

@chrarnoldus chrarnoldus self-assigned this Oct 28, 2026
@kilo-code-bot

kilo-code-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed all 18 files in the removal of the in-code custom pricing fallback; the new EMPTY_CUSTOM_PRICING_CONFIG default, the dropped fallback field on admin.customPricing.get, the useCustomPricingConfig fallback, and the migrated test fixture are internally consistent and keep the existing createCachedFetch last-known-good semantics.

Assumptions: [INFERENCE] The Gemini promotional pricing now depends entirely on ai_gateway_config.custom_pricing being populated in each deployed environment; the repository contains only the column migration (0309_good_silk_fever.sql) and no seed, so the stored config must already exist before this deploys, otherwise those models bill and display at list price and a single failed first read (cold instance, replica unavailable) also bills list price until the retry succeeds. [INFERENCE] I did not execute the Jest suites or typecheck and relied on the PR's stated verification.

Files Reviewed (18 files)
  • apps/web/src/app/admin/gateway/CustomPricingContent.tsx
  • apps/web/src/components/organizations/providers-and-models/offeringPricing.test.ts
  • apps/web/src/components/organizations/providers-and-models/useCustomPricingConfig.ts
  • apps/web/src/lib/agent-briefing/summary.test.ts
  • apps/web/src/routers/admin/custom-pricing-router.test.ts
  • apps/web/src/routers/admin/custom-pricing-router.ts
  • packages/web-shared/src/lib/ai-gateway/custom-pricing-config.test.ts
  • packages/web-shared/src/lib/ai-gateway/custom-pricing-config.ts
  • packages/web-shared/src/lib/ai-gateway/custom-pricing.constants.ts
  • packages/web-shared/src/lib/ai-gateway/custom-pricing.test.ts
  • packages/web-shared/src/lib/ai-gateway/handlers/model-endpoints.test.ts
  • packages/web-shared/src/lib/ai-gateway/models.client-boundary.test.ts
  • packages/web-shared/src/lib/ai-gateway/processUsage.test.ts
  • packages/web-shared/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts
  • packages/web-shared/src/lib/ai-gateway/request-cost-limit.test.ts
  • packages/web-shared/src/lib/ai-gateway/rewriteModelResponse.test.ts
  • packages/web-shared/src/lib/ai-gateway/usage-cost.test.ts
  • packages/web-shared/src/tests/helpers/custom-pricing.helper.ts

Reviewed by deepseek-flash-latest · Input: 92.4K · Output: 14.5K · Cached: 1.6M

Review guidance: REVIEW.md from base branch main

@chrarnoldus
chrarnoldus added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 89bf27e Oct 28, 2026
57 checks passed
@chrarnoldus
chrarnoldus deleted the chore/remove-custom-pricing-fallback branch October 28, 2026 11:40
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