Skip to content

Commit a8d0c1a

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@4dd10600f6584cc42c528846789d0c0c21166b38
1 parent 793ba66 commit a8d0c1a

4 files changed

Lines changed: 30 additions & 17 deletions

File tree

‎common/src/constants/__tests__/freebuff-free-promotions.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('free-promotion spend windows', () => {
2626
{
2727
modelId: FREEBUFF_SOLAR_PRO_4_MODEL_ID,
2828
from: '2026-09-09T15:49:00.000Z',
29-
to: '2099-01-01T00:00:00.000Z',
29+
to: '2026-09-13T05:00:00.000Z',
3030
},
3131
])
3232
})

‎common/src/constants/freebuff-models.ts‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -315,24 +315,25 @@ export const FREEBUFF_GPT_5_6_LUNA_REASONING_EFFORT = 'high' as const
315315
* by `applyOpenRouterProviderRouting`. Context 524,288, text in / text out,
316316
* using Upstage's non-ZDR endpoint for provider-side debugging.
317317
*
318-
* PRICE: Upstage's LIST card is $0.30/M in, $0.06/M cached, $1.20/M out.
319-
* OpenRouter's card shows $0.03/$0.006/$0.12 with `"discount": 0.9` — that is
320-
* Upstage's own launch promo ("Solar Pro 4: 90% off through Sep 10 (UTC)" on
321-
* the Upstage console), not an OpenRouter-only price.
318+
* PRICE: Upstage's LIST card is $0.30/M in, $0.06/M cached, $1.20/M out, and
319+
* Upstage bills our key 90% off it ($0.03/$0.006/$0.12). That began as a
320+
* launch promo ("Solar Pro 4: 90% off through Sep 10 (UTC)" on the Upstage
321+
* console; OpenRouter shows `"discount": 0.9`) and our rate outlived the
322+
* banner's date. It is not an OpenRouter-only price.
322323
*
323324
* The route is BYOK (`usage.is_byok: true`): OpenRouter serves it with our
324325
* own Upstage key, bills nothing itself (`usage.cost` is 0) and reports an
325326
* ESTIMATE of the upstream charge in `cost_details.upstream_inference_cost`,
326-
* computed at the LIST card. It does not know our key is on the promo, so
327-
* through 2026-09-10 that estimate is ten times Upstage's invoice. An earlier
328-
* version of this comment read the estimate as "what we are billed" and
329-
* concluded BYOK forfeits the discount; Upstage's invoice says otherwise.
330-
*
331-
* The OpenRouter lane therefore reprices this model from tokens while the
332-
* promo runs (web/src/llm-api/openrouter-price-overrides.ts, with the dates),
333-
* and falls back to OpenRouter's figure — correct again at list — when it
334-
* ends. Re-evaluate the row before then rather than silently changing what
335-
* "unmetered" means when the price changes. */
327+
* computed at the LIST card. It does not know our key's rate, so that
328+
* estimate is ten times Upstage's invoice. An earlier version of this comment
329+
* read the estimate as "what we are billed" and concluded BYOK forfeits the
330+
* discount; Upstage's invoice says otherwise.
331+
*
332+
* The OpenRouter lane therefore reprices this model from tokens
333+
* (web/src/llm-api/openrouter-price-overrides.ts), with no expiry while the
334+
* discount holds. Date or remove that entry when Upstage's invoice changes.
335+
* The Freebucks price is a separate, operator-set decision
336+
* (freebuff-solar-promo.ts). */
336337
/** Upstage's requested non-ZDR route for debugging. Pair with
337338
* `allow_fallbacks: false` in applyOpenRouterProviderRouting. */
338339
export const SOLAR_PRO_4_OPENROUTER_ENDPOINT = 'upstage'

‎common/src/constants/freebuff-solar-promo.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ export const SOLAR_PRICE_CHANGES = [
2525
price: 0,
2626
tagline: '0 Freebucks',
2727
},
28+
{
29+
// Metered again. Takes effect as each server deploys it.
30+
at: '2026-09-13T05:00:00Z',
31+
modelId: FREEBUFF_SOLAR_PRO_4_MODEL_ID,
32+
...SOLAR_REGULAR_OFFER,
33+
},
2834
] as const
2935

3036
export function solarOfferAt(now: number = Date.now()) {

‎common/src/util/__tests__/freebuff-price-changes.test.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const solar = 'upstage/solar-pro4'
1414
const start = Date.parse('2026-09-05T07:00:00Z')
1515
const end = Date.parse('2026-09-08T07:00:00Z')
1616
const restored = Date.parse('2026-09-09T15:49:00Z')
17+
const metered = Date.parse('2026-09-13T05:00:00Z')
1718
const quoteBeforeStart = () => ({
1819
...freebucksFixture(0, { [solar]: SOLAR_REGULAR_OFFER.price }),
1920
priceNotices: { [solar]: SOLAR_REGULAR_OFFER.tagline },
@@ -38,16 +39,21 @@ describe('announced Freebucks price changes', () => {
3839
const freeAgain = applyFreebucksPriceChanges(expired, restored)
3940
expect(freeAgain.prices[solar]).toBe(0)
4041
expect(freeAgain.priceNotices[solar]).toBe('0 Freebucks')
41-
expect(nextFreebucksPriceChange(freeAgain)).toBe(Infinity)
42+
expect(nextFreebucksPriceChange(freeAgain)).toBe(metered)
43+
const meteredAgain = applyFreebucksPriceChanges(freeAgain, metered)
44+
expect(meteredAgain.prices[solar]).toBe(5)
45+
expect(meteredAgain.priceNotices[solar]).toBe('Limited-time trial')
46+
expect(nextFreebucksPriceChange(meteredAgain)).toBe(Infinity)
4247
expect(quote.prices[solar]).toBe(5)
43-
expect(quote.priceChanges).toHaveLength(3)
48+
expect(quote.priceChanges).toHaveLength(4)
4449
})
4550

4651
it('catches up across all transitions, even when a delayed response lists them out of order', () => {
4752
const quote = quoteBeforeStart()
4853
quote.priceChanges.reverse()
4954
expect(applyFreebucksPriceChanges(quote, end).prices[solar]).toBe(5)
5055
expect(applyFreebucksPriceChanges(quote, restored).prices[solar]).toBe(0)
56+
expect(applyFreebucksPriceChanges(quote, metered).prices[solar]).toBe(5)
5157
})
5258

5359
it('does not add an unpriced model or invent metadata on older server responses', () => {

0 commit comments

Comments
 (0)