diff --git a/.env.example b/.env.example index 0d1bb08..6de31f3 100644 --- a/.env.example +++ b/.env.example @@ -15,7 +15,7 @@ ANTHROPIC_WORKSPACE_ID= # Must exactly match the approved rule. Default is inference-only; the current # Console only offers workspace:developer, which requires operator approval. ANTHROPIC_FEDERATION_SCOPE=workspace:inference -# Used only for Gitdog's generation fallback (GPT-6.1 Sol); no embeddings. +# Used only for Gitdog's generation fallback (GPT-6.2 Sol); no embeddings. OPENAI_API_KEY= # 32 random bytes, base64 (openssl rand -base64 32). Encrypts users' own # provider keys at rest; changing it makes every saved key unreadable. diff --git a/CLAUDE.md b/CLAUDE.md index 1d6caa3..54d7dd5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,7 +9,7 @@ **Gitdog** is an AI-powered GitHub issue and discussion assistant. - Repository-aware issue and discussion formatting, answers, and maintainer tagging -- Claude Opus 5.5 generation with GPT-6.1 Sol fallback (see [docs/ai-models.md](docs/ai-models.md)) +- Claude Opus 5.5 generation with GPT-6.2 Sol fallback (see [docs/ai-models.md](docs/ai-models.md)) - Keyword repository index plus AI repository tools (search, read file) for code search - Private workspace per user - Free and Pro token quotas with optional prepaid token packs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03361a8..1f9a17f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,7 @@ organized, how to run it locally and what a pull request needs. | -------- | -------------------------------------------------------------------- | | Frontend | React 19, TypeScript, Vite, Tailwind CSS, react-i18next (en, ko, ja) | | Backend | Convex | -| AI | Claude Opus 5.5 with GPT-6.1 Sol fallback; users' own keys optional | +| AI | Claude Opus 5.5 with GPT-6.2 Sol fallback; users' own keys optional | | GitHub | GitHub App (OAuth, webhooks, repository access) | | Payments | Lemon Squeezy | | Hosting | Firebase Hosting | @@ -31,7 +31,7 @@ organized, how to run it locally and what a pull request needs. GitHub webhook ─▶ Convex ─▶ repository index (keyword search) │ ▼ - Claude Opus 5.5 (GPT-6.1 Sol fallback) + Claude Opus 5.5 (GPT-6.2 Sol fallback) │ ▼ draft reply or review ─▶ approval ─▶ GitHub comment / PR review diff --git a/convex/_ai/chatBilling.ts b/convex/_ai/chatBilling.ts index 8501759..df0a596 100644 --- a/convex/_ai/chatBilling.ts +++ b/convex/_ai/chatBilling.ts @@ -378,8 +378,11 @@ export function getChatReservationLimits( messages: ChatMessage[], options?: ChatCompletionOptions, ): { inputTokenLimit: number; outputTokenLimit: number } { - // Every token is at least one byte, so the request size bounds its input - // tokens, and the cacheable prefix bounds the extra a cache write costs. + // The request size bounds its input tokens, and the cacheable prefix bounds + // the extra a Claude cache write costs. OpenAI caching is off; were it to + // write a whole prompt, the serialized request covers it for any text whose + // tokens average over 1.25 bytes, and otherwise settlement holds the + // attempt for reconciliation instead of charging it. const inputTokenLimit = chatRequestBytes(messages, options) + Math.ceil( diff --git a/convex/_ai/config.ts b/convex/_ai/config.ts index b8ea63b..dae096e 100644 --- a/convex/_ai/config.ts +++ b/convex/_ai/config.ts @@ -27,8 +27,8 @@ export const GENERATION_MODELS = { effort: "medium", }, openai: { - modelId: "gpt-6.1-sol", - name: "GPT-6.1 Sol", + modelId: "gpt-6.2-sol", + name: "GPT-6.2 Sol", effort: "high", }, } as const; @@ -97,6 +97,18 @@ export const CHAT_MODELS: Record< outputMultiplier: 5, }, }, + "gpt-6.2-sol": { + provider: "openai", + inputPer1M: 2, + outputPer1M: 10, + quotaWeight: 1, + cacheReadMultiplier: 0.05, + longContext: { + inputTokens: 272_000, + inputMultiplier: 2, + outputMultiplier: 1.5, + }, + }, "gpt-6.1-sol": { provider: "openai", inputPer1M: 2, @@ -190,6 +202,8 @@ export const USER_KEY_MODELS: Record<"anthropic" | "openai", UserKeyModel[]> = { defaultEffort: "medium", }, ], + // Keys saved before GPT-6.2 Sol were checked against 6.1 and store no + // model, so 6.1 stays the default they resolve to. openai: [ { modelId: "gpt-6.1-sol", @@ -197,6 +211,12 @@ export const USER_KEY_MODELS: Record<"anthropic" | "openai", UserKeyModel[]> = { efforts: ["low", "medium", "high"], defaultEffort: "high", }, + { + modelId: "gpt-6.2-sol", + name: "GPT-6.2 Sol", + efforts: ["low", "medium", "high"], + defaultEffort: "high", + }, ], }; diff --git a/convex/_ai/model.ts b/convex/_ai/model.ts index 13a0987..95ecd19 100644 --- a/convex/_ai/model.ts +++ b/convex/_ai/model.ts @@ -76,6 +76,8 @@ export type ChatCompletionOptions = { topP?: number; tools?: ToolDefinition[]; billingLabel?: string; + // How long the provider may take; the provider's default when unset. + timeoutMs?: number; responseFormat?: { name: string; schema: Record; diff --git a/convex/_ai/providers.ts b/convex/_ai/providers.ts index d3d9481..6393c51 100644 --- a/convex/_ai/providers.ts +++ b/convex/_ai/providers.ts @@ -54,6 +54,7 @@ async function request( headers: Record, body: RecordValue, deadline?: number, + timeoutMs = REQUEST_TIMEOUT_MS, ): Promise<{ data: RecordValue; requestId?: string }> { let started = false; let requestId: string | undefined; @@ -66,7 +67,7 @@ async function request( method: "POST", headers: { "Content-Type": "application/json", ...headers }, body: serialized, - signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), + signal: AbortSignal.timeout(timeoutMs), }); requestId = response.headers.get("request-id") ?? @@ -291,6 +292,7 @@ export class ClaudeProvider implements AiProvider { ...(options?.tools?.length ? { tools: options.tools } : {}), }, this.enforceDeadline ? CLAUDE_API_ENDS_AT : undefined, + options?.timeoutMs, ); const counts = record(data.usage) ? data.usage : {}; // With fallbacks, top-level usage covers the attempt that produced the @@ -521,28 +523,40 @@ export class OpenAIProvider implements AiProvider { } : {}), }, + undefined, + options?.timeoutMs, ); const counts = record(data.usage) ? data.usage : {}; - const billed = usage(counts.input_tokens, counts.output_tokens, requestId); const details = record(counts.input_tokens_details) ? counts.input_tokens_details : {}; + // Should OpenAI still report cache usage, its writes and reads are part + // of input_tokens and count as the input they cost on this model. + const cacheWrite = details.cache_write_tokens ?? 0; + const cacheRead = details.cached_tokens ?? 0; if ( - (details.cached_tokens ?? 0) !== 0 || - (details.cache_write_tokens ?? 0) !== 0 - ) { - throw new ChatProviderRequestError( - "OpenAI returned unexpected prompt cache usage", - "ambiguous", - { providerRequestId: requestId }, - ); - } - if (counts.total_tokens !== billed.totalTokens) + !tokens(counts.input_tokens) || + !tokens(counts.output_tokens) || + !tokens(cacheWrite) || + !tokens(cacheRead) || + cacheWrite + cacheRead > counts.input_tokens || + counts.total_tokens !== counts.input_tokens + counts.output_tokens + ) throw new ChatProviderRequestError( "OpenAI returned inconsistent usage metadata", "ambiguous", { providerRequestId: requestId }, ); + const billed = usage( + cacheAdjustedInputTokens( + this.modelId, + counts.input_tokens - cacheWrite - cacheRead, + cacheWrite, + cacheRead, + ), + counts.output_tokens, + requestId, + ); try { if (!Array.isArray(data.output)) throw new Error("Invalid output"); const history: Array< diff --git a/convex/pullRequests/internalAction.ts b/convex/pullRequests/internalAction.ts index e669a91..3c13683 100644 --- a/convex/pullRequests/internalAction.ts +++ b/convex/pullRequests/internalAction.ts @@ -617,6 +617,8 @@ export const generate = internalAction({ beforeProviderStart: ensureCurrent, activeProviderWaitMs: REVIEW_ACTIVE_PROVIDER_WAIT_MS, }); + // The metered route is the one that switches to the fallback provider. + runProvider = provider; let result: Awaited>; try { if (discussion) run.discussionEntries = discussion.length; diff --git a/convex/pullRequests/workflow.ts b/convex/pullRequests/workflow.ts index a01e7c4..41be0cd 100644 --- a/convex/pullRequests/workflow.ts +++ b/convex/pullRequests/workflow.ts @@ -194,6 +194,11 @@ const MAX_COVERAGE_PASSES = 8; // up to 120. A coverage request starts only within 4 minutes of the action's // start, so even the slowest one ends before the action is stopped. const COVERAGE_REQUEST_CUTOFF_MS = 4 * 60_000; +// The closing synthesis reads the whole review and can take a reasoning model +// past the usual two minutes. It may run until this long after the action +// started (never less than two minutes nor more than five), which still leaves +// room for verification before Convex stops the action. +const FINAL_REQUEST_END_MS = 7 * 60_000; // After the main review, focused second looks at the same source. Each one // resends the main review's last request with only its closing state // replaced, so the repository context and sources are read from the prompt @@ -1610,6 +1615,13 @@ export async function reviewWithContext(args: { maxTokens: REVIEW_OUTPUT_TOKENS, billingLabel: "pr-review/final", responseFormat: REVIEW_RESPONSE_FORMAT, + timeoutMs: Math.min( + 5 * 60_000, + Math.max( + 2 * 60_000, + actionStarted + FINAL_REQUEST_END_MS - Date.now(), + ), + ), }, ); let final: Awaited>; diff --git a/docs/ai-models.md b/docs/ai-models.md index 68ca3b7..21f5bec 100644 --- a/docs/ai-models.md +++ b/docs/ai-models.md @@ -9,7 +9,7 @@ and CLI never store provider keys. - Primary: **Claude Opus 5.5** (`claude-opus-5-5`) at `medium` effort, with Anthropic's server-side refusal fallback. -- Fallback: **GPT-6.1 Sol** (`gpt-6.1-sol`) at `high` reasoning effort through +- Fallback: **GPT-6.2 Sol** (`gpt-6.2-sol`) at `high` reasoning effort through the OpenAI Responses API. - Claude is used strictly before **2027-01-18 00:00 Asia/Seoul** (`2027-01-17T15:00:00Z`); after that, new requests go to OpenAI. @@ -31,7 +31,9 @@ those keys instead of Gitdog's: - Each key runs the model and effort its owner chooses (web settings or `gitdog provider-keys model`), checked against the key when chosen and when the key is saved again. Anthropic: Claude Opus 5.5 (default, `medium`), - Sonnet 5.5 (`high`) or Haiku 5.5 (`medium`); OpenAI: GPT-6.1 Sol (`high`). + Sonnet 5.5 (`high`) or Haiku 5.5 (`medium`); OpenAI: GPT-6.1 Sol (default, + `high`; keys saved before 6.2 were checked against it) or GPT-6.2 Sol + (`high`). Efforts are `low`, `medium` or `high`: requests are not streamed and stop after two minutes, so Fable 5.1 and `xhigh`/`max` are not offered. Haiku 5.5 bills prompts over 100K tokens at 5x and has no server-side refusal @@ -93,6 +95,7 @@ indexing costs no AI tokens. | Model | Input per 1M tokens | Output per 1M tokens | Quota weight | | ----------------- | ------------------- | -------------------- | ------------ | | Claude Opus 5.5 | $4.00 | $20.00 | 2 | +| GPT-6.2 Sol | $2.00 | $10.00 | 1 | | GPT-6.1 Sol | $2.00 | $10.00 | 1 | | Claude Sonnet 5.5 | $2.00 | $10.00 | 1 (own keys) | | Claude Haiku 5.5 | $0.10 | $0.50 | own keys | @@ -129,10 +132,12 @@ the serving model as `servedModel`, and records its cost at that model's price. Sol prompts above 272K input tokens use 2x input and 1.5x output pricing. -Prompt caching is disabled, so recorded token counts map directly to the listed -uncached prices. Thinking tokens are included in the provider's output usage. +OpenAI prompt caching is turned off (explicit mode with no breakpoint), since +its automatic mode writes the whole prompt again whenever its end changes. If +OpenAI still reports cache usage, it is recorded like Claude's: a write at +1.25x and a read at 0.05x on GPT-6.2 Sol (0.1x on 6.1). Thinking tokens are included in the provider's output usage. See [Claude pricing](https://platform.claude.com/docs/en/about-claude/pricing) -and [Sol pricing](https://developers.openai.com/api/docs/models/gpt-6.1-sol). +and [Sol pricing](https://developers.openai.com/api/docs/models/gpt-6.2-sol). ## Plans and token packs diff --git a/e2e/runPrReview.ts b/e2e/runPrReview.ts index c152126..d8a5d60 100644 --- a/e2e/runPrReview.ts +++ b/e2e/runPrReview.ts @@ -14,6 +14,7 @@ import { import { tmpdir } from "node:os"; import path from "node:path"; import assert from "node:assert/strict"; +import { GENERATION_MODELS } from "../convex/_ai/config"; const deployment = "fortunate-chihuahua-679"; const root = path.resolve(import.meta.dirname, ".."); const logRoot = path.resolve( @@ -171,7 +172,9 @@ try { assert(["anthropic", "openai"].includes(row.provider)); assert.equal( row.model, - row.provider === "anthropic" ? "claude-opus-5-5" : "gpt-6.1-sol", + row.provider === "anthropic" + ? GENERATION_MODELS.anthropic.modelId + : GENERATION_MODELS.openai.modelId, ); // Opus 5.5 counts twice against quota on Gitdog's key. assert.equal( @@ -183,6 +186,7 @@ try { "claude-opus-5-5": [4, 20], "claude-opus-5": [5, 25], "claude-opus-4-8": [5, 25], + "gpt-6.2-sol": [2, 10], "gpt-6.1-sol": [2, 10], }; const [inputPer1M, outputPer1M] = diff --git a/public/llms-full.txt b/public/llms-full.txt index 70c1aa5..61743b5 100644 --- a/public/llms-full.txt +++ b/public/llms-full.txt @@ -64,7 +64,7 @@ The `gitdog` npm CLI (`npx gitdog@latest`) covers the same workflows as the web ### Free Plan - $0/month - 100,000 one-time trial tokens on first sign-in -- Then use your own Anthropic or OpenAI API key (that usage never uses Gitdog tokens), with the model and effort you choose: Claude Opus 5.5, Sonnet 5.5 or Haiku 5.5, or GPT-6.1 Sol +- Then use your own Anthropic or OpenAI API key (that usage never uses Gitdog tokens), with the model and effort you choose: Claude Opus 5.5, Sonnet 5.5 or Haiku 5.5, or GPT-6.1 or 6.2 Sol - Hard limit with no automatic overage charges - Prepaid token packs available for additional usage - All features included diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 0cf23a5..8b98505 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -773,7 +773,7 @@ "purchase": "Purchase" }, "tokenPricing": "Token Pricing", - "tokenPricingDescription": "Free starts with 100k one-time trial tokens and Pro includes 2.4M each month. Both stop at the available limit, which prepaid token packs can extend. Gitdog runs on Claude Opus 5.5, and each Opus token counts as 2 Gitdog tokens because it costs twice as much as the GPT-6.1 Sol fallback. Work that runs on your own API key never uses Gitdog tokens.", + "tokenPricingDescription": "Free starts with 100k one-time trial tokens and Pro includes 2.4M each month. Both stop at the available limit, which prepaid token packs can extend. Gitdog runs on Claude Opus 5.5, and each Opus token counts as 2 Gitdog tokens because it costs twice as much as the GPT-6.2 Sol fallback. Work that runs on your own API key never uses Gitdog tokens.", "freeTokensLabel": "Trial tokens (one-time)", "platformFeeLabel": "Prepaid token packs", "billingLabel": "Billing", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 783d905..6ee1a70 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -772,7 +772,7 @@ "purchase": "購入" }, "tokenPricing": "トークン価格", - "tokenPricingDescription": "Freeは1回限りの100k体験トークンから始まり、Proには毎月2.4Mトークンが含まれます。どちらも利用可能な上限で停止し、プリペイドトークンパックで追加できます。GitdogはClaude Opus 5.5で動作し、OpusのトークンはフォールバックのGPT-6.1 Solの2倍のコストがかかるため、1トークンをGitdogトークン2つとして数えます。自分のAPIキーで実行される処理はGitdogのトークンを使いません。", + "tokenPricingDescription": "Freeは1回限りの100k体験トークンから始まり、Proには毎月2.4Mトークンが含まれます。どちらも利用可能な上限で停止し、プリペイドトークンパックで追加できます。GitdogはClaude Opus 5.5で動作し、OpusのトークンはフォールバックのGPT-6.2 Solの2倍のコストがかかるため、1トークンをGitdogトークン2つとして数えます。自分のAPIキーで実行される処理はGitdogのトークンを使いません。", "freeTokensLabel": "体験トークン(1回限り)", "platformFeeLabel": "プリペイドトークンパック", "billingLabel": "課金", diff --git a/src/i18n/locales/ko.json b/src/i18n/locales/ko.json index efc1698..e23d09e 100644 --- a/src/i18n/locales/ko.json +++ b/src/i18n/locales/ko.json @@ -772,7 +772,7 @@ "purchase": "구매" }, "tokenPricing": "토큰 가격", - "tokenPricingDescription": "Free는 1회 100k 체험 토큰으로 시작하고, Pro는 매월 2.4M 토큰을 포함합니다. 두 플랜 모두 사용 가능한 한도에서 중지되며 선불 토큰 팩으로 늘릴 수 있습니다. Gitdog은 Claude Opus 5.5로 실행되며, Opus 토큰은 GPT-6.1 Sol 대체 모델보다 비용이 두 배라 1개당 Gitdog 토큰 2개로 계산됩니다. 내 API 키로 실행되는 작업은 Gitdog 토큰을 쓰지 않습니다.", + "tokenPricingDescription": "Free는 1회 100k 체험 토큰으로 시작하고, Pro는 매월 2.4M 토큰을 포함합니다. 두 플랜 모두 사용 가능한 한도에서 중지되며 선불 토큰 팩으로 늘릴 수 있습니다. Gitdog은 Claude Opus 5.5로 실행되며, Opus 토큰은 GPT-6.2 Sol 대체 모델보다 비용이 두 배라 1개당 Gitdog 토큰 2개로 계산됩니다. 내 API 키로 실행되는 작업은 Gitdog 토큰을 쓰지 않습니다.", "freeTokensLabel": "체험 토큰 (1회)", "platformFeeLabel": "선불 토큰 팩", "billingLabel": "결제", diff --git a/test/convex/ai/providerFallback.test.ts b/test/convex/ai/providerFallback.test.ts index 0be43fd..a817fb5 100644 --- a/test/convex/ai/providerFallback.test.ts +++ b/test/convex/ai/providerFallback.test.ts @@ -183,7 +183,7 @@ describe("credit fallback and exclusive Claude deadline", () => { expect(provider.providerId).toBe("openai"); const body = JSON.parse(fetch.mock.calls[1][1]!.body as string); expect(body).toMatchObject({ - model: "gpt-6.1-sol", + model: "gpt-6.2-sol", store: false, reasoning: { effort: "high" }, include: ["reasoning.encrypted_content"], @@ -538,16 +538,16 @@ it.each([ input_tokens: 11, output_tokens: 3, total_tokens: 14, - input_tokens_details: { cached_tokens: 2 }, + input_tokens_details: { cached_tokens: 8, cache_write_tokens: 4 }, }, { input_tokens: 11, output_tokens: 3, total_tokens: 14, - input_tokens_details: { cache_write_tokens: 2 }, + input_tokens_details: { cached_tokens: -1 }, }, ])( - "holds inconsistent or unexpected cached usage instead of charging the wrong amount", + "holds inconsistent cached usage instead of charging the wrong amount", async (counts) => { vi.spyOn(globalThis, "fetch").mockResolvedValue(openai({ usage: counts })); await expect( @@ -556,6 +556,60 @@ it.each([ }, ); +it("waits as long as a request asks before giving up", async () => { + const timeout = vi.spyOn(AbortSignal, "timeout"); + vi.spyOn(globalThis, "fetch") + .mockResolvedValueOnce(openai()) + .mockResolvedValueOnce(openai()) + .mockResolvedValueOnce(claude()); + await new OpenAIProvider("test").chat(messages); + await new OpenAIProvider("test").chat(messages, { timeoutMs: 240_000 }); + await new ClaudeProvider("fixture-key").chat(messages, { + timeoutMs: 240_000, + }); + expect(timeout.mock.calls.map(([ms]) => ms)).toEqual([ + 120_000, 240_000, 240_000, + ]); +}); + +it("bills OpenAI cache usage as the input it costs", async () => { + vi.spyOn(globalThis, "fetch").mockResolvedValue( + openai({ + usage: { + input_tokens: 3_000, + output_tokens: 10, + total_tokens: 3_010, + input_tokens_details: { + cache_write_tokens: 1_000, + cached_tokens: 1_000, + }, + }, + }), + ); + // 1,000 uncached, 1,000 written at 1.25x and 1,000 read at 0.05x. + expect(await new OpenAIProvider("test").chat(messages)).toMatchObject({ + usage: { promptTokens: 2_300, completionTokens: 10, totalTokens: 2_310 }, + }); + // A prompt that is all cache writes and reads, with null details elsewhere. + vi.mocked(globalThis.fetch).mockResolvedValue( + openai({ + usage: { + input_tokens: 2_000, + output_tokens: 1, + total_tokens: 2_001, + input_tokens_details: { + cache_write_tokens: 1_000, + cached_tokens: 1_000, + }, + output_tokens_details: null, + }, + }), + ); + expect(await new OpenAIProvider("test").chat(messages)).toMatchObject({ + usage: { promptTokens: 1_300 }, + }); +}); + it("counts reasoning-effort reasoning inside output usage exactly once", async () => { const fetch = vi.spyOn(globalThis, "fetch").mockResolvedValue( openai({ diff --git a/test/convex/pullRequests/lifecycle.test.ts b/test/convex/pullRequests/lifecycle.test.ts index e44f803..00a0df3 100644 --- a/test/convex/pullRequests/lifecycle.test.ts +++ b/test/convex/pullRequests/lifecycle.test.ts @@ -3235,8 +3235,9 @@ describe("batched PR reviews", () => { expect(record).toMatchObject({ kind: "full", outcome: "proposed", - providerId: "anthropic", - modelId: "claude-opus-5-5", + // The provider that answered, as the metered route reports it. + providerId: "openai", + modelId: "fixture", page: 1, group: 0, keySource: "gitdog", diff --git a/test/convex/pullRequests/recovery.test.ts b/test/convex/pullRequests/recovery.test.ts index 34a837a..5d64c3b 100644 --- a/test/convex/pullRequests/recovery.test.ts +++ b/test/convex/pullRequests/recovery.test.ts @@ -515,6 +515,10 @@ describe("uncertain review candidates", () => { ); expect((await promise).findings).toEqual([confident]); expect(requestOptions[8].billingLabel).toBe("pr-review/final"); + // The closing synthesis may run past the usual two minutes. + expect(requestOptions[8].timeoutMs).toBeGreaterThan(120_000); + expect(requestOptions[8].timeoutMs).toBeLessThanOrEqual(300_000); + expect(requestOptions[7]).not.toHaveProperty("timeoutMs"); expect(requests[8][0].content).toContain("Commit suggestions are disabled"); }); diff --git a/test/convex/tokenUsage/providerPricing.test.ts b/test/convex/tokenUsage/providerPricing.test.ts index 04b8626..3bdf156 100644 --- a/test/convex/tokenUsage/providerPricing.test.ts +++ b/test/convex/tokenUsage/providerPricing.test.ts @@ -73,6 +73,7 @@ describe("Claude and OpenAI generation pricing", () => { it("weighs Opus twice and reserves at the highest routed weight", () => { expect(getChatModel("claude-opus-5-5", "anthropic").quotaWeight).toBe(2); expect(getChatModel("gpt-6.1-sol", "openai").quotaWeight).toBe(1); + expect(getChatModel("gpt-6.2-sol", "openai").quotaWeight).toBe(1); expect(RESERVATION_QUOTA_WEIGHT).toBe(2); }); it("does not apply long-context pricing to Claude", () => { @@ -88,5 +89,12 @@ describe("Claude and OpenAI generation pricing", () => { expect( calculateChatCost(272_001, 100, 0, "gpt-6.1-sol", "openai").baseCostCents, ).toBeCloseTo(108.9504); + for (const [input, cents] of [ + [272_000, 54.5], + [272_001, 108.9504], + ] as const) + expect( + calculateChatCost(input, 100, 0, "gpt-6.2-sol", "openai").baseCostCents, + ).toBeCloseTo(cents); }); });