- Add Kiro quota types (KiroFreeTrialInfo, KiroUsageBreakdown, KiroQuotaPayload, KiroQuotaState) - Add Kiro API constants and request headers - Add isKiroFile validator and parseKiroQuotaPayload parser - Add KIRO_CONFIG with fetchKiroQuota and renderKiroItems - Add kiroQuota state to useQuotaStore - Add Kiro QuotaSection to QuotaPage - Add Kiro styles (.kiroGrid, .kiroControls, .kiroControl, .kiroCard) - Add i18n translations for kiro_quota (zh-CN and en) Features: - Separate display for base credits and bonus credits (freeTrialInfo) - Total credits summary - Correct parsing of seconds timestamp (scientific notation like 1.769904E9) - Reset time display - Subscription type display
168 lines
4.7 KiB
TypeScript
168 lines
4.7 KiB
TypeScript
/**
|
|
* Quota constants for API URLs, headers, and theme colors.
|
|
*/
|
|
|
|
import type {
|
|
AntigravityQuotaGroupDefinition,
|
|
GeminiCliQuotaGroupDefinition,
|
|
TypeColorSet,
|
|
} from '@/types';
|
|
|
|
// Theme colors for type badges
|
|
export const TYPE_COLORS: Record<string, TypeColorSet> = {
|
|
qwen: {
|
|
light: { bg: '#e8f5e9', text: '#2e7d32' },
|
|
dark: { bg: '#1b5e20', text: '#81c784' },
|
|
},
|
|
gemini: {
|
|
light: { bg: '#e3f2fd', text: '#1565c0' },
|
|
dark: { bg: '#0d47a1', text: '#64b5f6' },
|
|
},
|
|
'gemini-cli': {
|
|
light: { bg: '#e7efff', text: '#1e4fa3' },
|
|
dark: { bg: '#1c3f73', text: '#a8c7ff' },
|
|
},
|
|
aistudio: {
|
|
light: { bg: '#f0f2f5', text: '#2f343c' },
|
|
dark: { bg: '#373c42', text: '#cfd3db' },
|
|
},
|
|
claude: {
|
|
light: { bg: '#fce4ec', text: '#c2185b' },
|
|
dark: { bg: '#880e4f', text: '#f48fb1' },
|
|
},
|
|
codex: {
|
|
light: { bg: '#fff3e0', text: '#ef6c00' },
|
|
dark: { bg: '#e65100', text: '#ffb74d' },
|
|
},
|
|
antigravity: {
|
|
light: { bg: '#e0f7fa', text: '#006064' },
|
|
dark: { bg: '#004d40', text: '#80deea' },
|
|
},
|
|
kiro: {
|
|
light: { bg: '#fff8e1', text: '#ff8f00' },
|
|
dark: { bg: '#ff6f00', text: '#ffe082' },
|
|
},
|
|
iflow: {
|
|
light: { bg: '#f3e5f5', text: '#7b1fa2' },
|
|
dark: { bg: '#4a148c', text: '#ce93d8' },
|
|
},
|
|
empty: {
|
|
light: { bg: '#f5f5f5', text: '#616161' },
|
|
dark: { bg: '#424242', text: '#bdbdbd' },
|
|
},
|
|
unknown: {
|
|
light: { bg: '#f0f0f0', text: '#666666', border: '1px dashed #999999' },
|
|
dark: { bg: '#3a3a3a', text: '#aaaaaa', border: '1px dashed #666666' },
|
|
},
|
|
};
|
|
|
|
// Antigravity API configuration
|
|
export const ANTIGRAVITY_QUOTA_URLS = [
|
|
'https://daily-cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels',
|
|
'https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:fetchAvailableModels',
|
|
'https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels',
|
|
];
|
|
|
|
export const ANTIGRAVITY_REQUEST_HEADERS = {
|
|
Authorization: 'Bearer $TOKEN$',
|
|
'Content-Type': 'application/json',
|
|
'User-Agent': 'antigravity/1.11.5 windows/amd64',
|
|
};
|
|
|
|
export const ANTIGRAVITY_QUOTA_GROUPS: AntigravityQuotaGroupDefinition[] = [
|
|
{
|
|
id: 'claude-gpt',
|
|
label: 'Claude/GPT',
|
|
identifiers: [
|
|
'claude-sonnet-4-5-thinking',
|
|
'claude-opus-4-5-thinking',
|
|
'claude-sonnet-4-5',
|
|
'gpt-oss-120b-medium',
|
|
],
|
|
},
|
|
{
|
|
id: 'gemini-3-pro',
|
|
label: 'Gemini 3 Pro',
|
|
identifiers: ['gemini-3-pro-high', 'gemini-3-pro-low'],
|
|
},
|
|
{
|
|
id: 'gemini-2-5-flash',
|
|
label: 'Gemini 2.5 Flash',
|
|
identifiers: ['gemini-2.5-flash', 'gemini-2.5-flash-thinking'],
|
|
},
|
|
{
|
|
id: 'gemini-2-5-flash-lite',
|
|
label: 'Gemini 2.5 Flash Lite',
|
|
identifiers: ['gemini-2.5-flash-lite'],
|
|
},
|
|
{
|
|
id: 'gemini-2-5-cu',
|
|
label: 'Gemini 2.5 CU',
|
|
identifiers: ['rev19-uic3-1p'],
|
|
},
|
|
{
|
|
id: 'gemini-3-flash',
|
|
label: 'Gemini 3 Flash',
|
|
identifiers: ['gemini-3-flash'],
|
|
},
|
|
{
|
|
id: 'gemini-image',
|
|
label: 'gemini-3-pro-image',
|
|
identifiers: ['gemini-3-pro-image'],
|
|
labelFromModel: true,
|
|
},
|
|
];
|
|
|
|
// Gemini CLI API configuration
|
|
export const GEMINI_CLI_QUOTA_URL =
|
|
'https://cloudcode-pa.googleapis.com/v1internal:retrieveUserQuota';
|
|
|
|
export const GEMINI_CLI_REQUEST_HEADERS = {
|
|
Authorization: 'Bearer $TOKEN$',
|
|
'Content-Type': 'application/json',
|
|
};
|
|
|
|
export const GEMINI_CLI_QUOTA_GROUPS: GeminiCliQuotaGroupDefinition[] = [
|
|
{
|
|
id: 'gemini-flash-series',
|
|
label: 'Gemini Flash Series',
|
|
preferredModelId: 'gemini-3-flash-preview',
|
|
modelIds: ['gemini-3-flash-preview', 'gemini-2.5-flash', 'gemini-2.5-flash-lite'],
|
|
},
|
|
{
|
|
id: 'gemini-pro-series',
|
|
label: 'Gemini Pro Series',
|
|
preferredModelId: 'gemini-3-pro-preview',
|
|
modelIds: ['gemini-3-pro-preview', 'gemini-2.5-pro'],
|
|
},
|
|
];
|
|
|
|
export const GEMINI_CLI_GROUP_LOOKUP = new Map(
|
|
GEMINI_CLI_QUOTA_GROUPS.flatMap((group) =>
|
|
group.modelIds.map((modelId) => [modelId, group] as const)
|
|
)
|
|
);
|
|
|
|
export const GEMINI_CLI_IGNORED_MODEL_PREFIXES = ['gemini-2.0-flash'];
|
|
|
|
// Codex API configuration
|
|
export const CODEX_USAGE_URL = 'https://chatgpt.com/backend-api/wham/usage';
|
|
|
|
export const CODEX_REQUEST_HEADERS = {
|
|
Authorization: 'Bearer $TOKEN$',
|
|
'Content-Type': 'application/json',
|
|
'User-Agent': 'codex_cli_rs/0.76.0 (Debian 13.0.0; x86_64) WindowsTerminal',
|
|
};
|
|
|
|
// Kiro (AWS CodeWhisperer) API configuration
|
|
export const KIRO_QUOTA_URL =
|
|
'https://codewhisperer.us-east-1.amazonaws.com/getUsageLimits?isEmailRequired=true&origin=AI_EDITOR&resourceType=AGENTIC_REQUEST';
|
|
|
|
export const KIRO_REQUEST_HEADERS = {
|
|
Authorization: 'Bearer $TOKEN$',
|
|
'x-amz-user-agent': 'aws-sdk-js/1.0.0 KiroIDE-0.6.18-cpamc',
|
|
'User-Agent': 'aws-sdk-js/1.0.0 ua/2.1 os/windows lang/js md/nodejs#20.16.0 api/codewhispererruntime#1.0.0 m/E KiroIDE-0.6.18-cpamc',
|
|
'amz-sdk-request': 'attempt=1; max=1',
|
|
Connection: 'close',
|
|
};
|