update: add Pro 3.1

This commit is contained in:
Gaurav Ghosh
2026-02-25 22:26:18 -08:00
parent 6836f0e1b2
commit 5cc9644a16
8 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -835,7 +835,7 @@ const SETTINGS_SCHEMA = {
requiresRestart: false, requiresRestart: false,
default: {}, default: {},
description: 'Billing and AI credits settings.', description: 'Billing and AI credits settings.',
showInDialog: true, showInDialog: false,
properties: { properties: {
overageStrategy: { overageStrategy: {
type: 'enum', type: 'enum',
@@ -62,7 +62,7 @@ describe('statsCommand', () => {
tier: undefined, tier: undefined,
userEmail: 'mock@example.com', userEmail: 'mock@example.com',
currentModel: undefined, currentModel: undefined,
creditBalance: null, creditBalance: undefined,
}); });
}); });
+1 -1
View File
@@ -31,7 +31,7 @@ function getUserIdentity(context: CommandContext) {
const tier = context.services.config?.getUserTierName(); const tier = context.services.config?.getUserTierName();
const paidTier = context.services.config?.getUserPaidTier(); const paidTier = context.services.config?.getUserPaidTier();
const creditBalance = getG1CreditBalance(paidTier); const creditBalance = getG1CreditBalance(paidTier) ?? undefined;
return { selectedAuthType, userEmail, tier, creditBalance }; return { selectedAuthType, userEmail, tier, creditBalance };
} }
@@ -395,8 +395,7 @@ interface StatsDisplayProps {
tier?: string; tier?: string;
currentModel?: string; currentModel?: string;
quotaStats?: QuotaStats; quotaStats?: QuotaStats;
/** G1 AI Credits balance, null if not eligible */ creditBalance?: number;
creditBalance?: number | null;
} }
export const StatsDisplay: React.FC<StatsDisplayProps> = ({ export const StatsDisplay: React.FC<StatsDisplayProps> = ({
@@ -74,8 +74,8 @@ export async function handleCreditsFlow(
const { overageStrategy } = args; const { overageStrategy } = args;
// If credits are already auto-enabled (strategy='always'), the request // If credits are already auto-enabled (strategy='always'), the request
// that just failed already included credits — they didn't help. // that just failed already included enabledCreditTypes — credits didn't
// Fall through to ProQuotaDialog which offers the Flash downgrade. // help. Fall through to ProQuotaDialog which offers the Flash downgrade.
if (shouldAutoUseCredits(overageStrategy, creditBalance)) { if (shouldAutoUseCredits(overageStrategy, creditBalance)) {
return null; return null;
} }
+1 -2
View File
@@ -201,8 +201,7 @@ export type HistoryItemStats = HistoryItemQuotaBase & {
type: 'stats'; type: 'stats';
duration: string; duration: string;
quotas?: RetrieveUserQuotaResponse; quotas?: RetrieveUserQuotaResponse;
/** G1 AI Credits balance, null if not eligible */ creditBalance?: number;
creditBalance?: number | null;
}; };
export type HistoryItemModelStats = HistoryItemQuotaBase & { export type HistoryItemModelStats = HistoryItemQuotaBase & {
+1 -1
View File
@@ -226,7 +226,7 @@ describe('billing', () => {
}); });
it('should return true for gemini-3.1-pro-preview', () => { it('should return true for gemini-3.1-pro-preview', () => {
expect(isOverageEligibleModel('gemini-3.1-pro-preview')).toBe(false); expect(isOverageEligibleModel('gemini-3.1-pro-preview')).toBe(true);
}); });
it('should return true for gemini-3.1-pro-preview-customtools', () => { it('should return true for gemini-3.1-pro-preview-customtools', () => {
+8 -2
View File
@@ -9,7 +9,10 @@ import type {
CreditType, CreditType,
GeminiUserTier, GeminiUserTier,
} from '../code_assist/types.js'; } from '../code_assist/types.js';
import { PREVIEW_GEMINI_MODEL } from '../config/models.js'; import {
PREVIEW_GEMINI_MODEL,
PREVIEW_GEMINI_3_1_MODEL,
} from '../config/models.js';
/** /**
* Strategy for handling quota exhaustion when AI credits are available. * Strategy for handling quota exhaustion when AI credits are available.
@@ -26,7 +29,10 @@ export const G1_CREDIT_TYPE: CreditType = 'GOOGLE_ONE_AI';
* The set of models that support AI credits overage billing. * The set of models that support AI credits overage billing.
* Only these models are eligible for the credits-based retry flow. * Only these models are eligible for the credits-based retry flow.
*/ */
export const OVERAGE_ELIGIBLE_MODELS = new Set([PREVIEW_GEMINI_MODEL]); export const OVERAGE_ELIGIBLE_MODELS = new Set([
PREVIEW_GEMINI_MODEL,
PREVIEW_GEMINI_3_1_MODEL,
]);
/** /**
* Checks if a model is eligible for AI credits overage billing. * Checks if a model is eligible for AI credits overage billing.