forked from QuantumNous/new-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.ts
More file actions
145 lines (118 loc) · 3.9 KB
/
Copy pathconstants.ts
File metadata and controls
145 lines (118 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
Copyright (C) 2023-2026 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { type TFunction } from 'i18next'
import type { TokenUnit } from './types'
// ----------------------------------------------------------------------------
// Pricing Constants
// ----------------------------------------------------------------------------
/** Sort options for pricing models */
export const SORT_OPTIONS = {
NAME: 'name',
PRICE_LOW: 'price-low',
PRICE_HIGH: 'price-high',
} as const
export type SortOption = (typeof SORT_OPTIONS)[keyof typeof SORT_OPTIONS]
export function getSortLabels(t: TFunction): Record<SortOption, string> {
return {
[SORT_OPTIONS.NAME]: t('Name'),
[SORT_OPTIONS.PRICE_LOW]: t('Price: Low to High'),
[SORT_OPTIONS.PRICE_HIGH]: t('Price: High to Low'),
}
}
/** Filter values */
export const FILTER_ALL = 'all'
/** Quota type options */
export const QUOTA_TYPES = {
ALL: 'all',
TOKEN: 'token',
REQUEST: 'request',
} as const
export type QuotaTypeOption = (typeof QUOTA_TYPES)[keyof typeof QUOTA_TYPES]
/** Quota type labels */
export function getQuotaTypeLabels(
t: TFunction
): Record<QuotaTypeOption, string> {
return {
[QUOTA_TYPES.ALL]: t('All Models'),
[QUOTA_TYPES.TOKEN]: t('Token-based'),
[QUOTA_TYPES.REQUEST]: t('Per Request'),
}
}
/** Endpoint type options */
export const ENDPOINT_TYPES = {
ALL: 'all',
OPENAI: 'openai',
OPENAI_RESPONSE: 'openai-response',
ANTHROPIC: 'anthropic',
GEMINI: 'gemini',
JINA_RERANK: 'jina-rerank',
IMAGE_GENERATION: 'image-generation',
EMBEDDINGS: 'embeddings',
OPENAI_VIDEO: 'openai-video',
} as const
export type EndpointTypeOption =
(typeof ENDPOINT_TYPES)[keyof typeof ENDPOINT_TYPES]
/** Endpoint type labels */
export function getEndpointTypeLabels(
t: TFunction
): Record<EndpointTypeOption, string> {
return {
[ENDPOINT_TYPES.ALL]: t('All Types'),
[ENDPOINT_TYPES.OPENAI]: 'Chat',
[ENDPOINT_TYPES.OPENAI_RESPONSE]: 'Response',
[ENDPOINT_TYPES.ANTHROPIC]: 'Anthropic',
[ENDPOINT_TYPES.GEMINI]: 'Gemini',
[ENDPOINT_TYPES.JINA_RERANK]: 'Rerank',
[ENDPOINT_TYPES.IMAGE_GENERATION]: t('Image'),
[ENDPOINT_TYPES.EMBEDDINGS]: t('Embeddings'),
[ENDPOINT_TYPES.OPENAI_VIDEO]: t('Video'),
}
}
/** Filter section keys */
export const FILTER_SECTIONS = {
PRICING_TYPE: 'pricingType',
ENDPOINT_TYPE: 'endpointType',
VENDOR: 'vendor',
GROUP: 'group',
TAG: 'tag',
} as const
/** Maximum number of tags to display in model row */
export const MAX_TAGS_DISPLAY = 5
/** Maximum number of filter items to display before showing "More..." */
export const MAX_FILTER_ITEMS = 5
/** Sidebar width */
export const SIDEBAR_WIDTH = 'w-64'
/** Excluded groups */
export const EXCLUDED_GROUPS = ['', 'auto']
/** Quota type values */
export const QUOTA_TYPE_VALUES = {
TOKEN: 0,
REQUEST: 1,
} as const
/** Token unit divisors */
export const TOKEN_UNIT_DIVISORS = {
M: 1,
K: 1000,
} as const
/** Default token unit for pricing display */
export const DEFAULT_TOKEN_UNIT: TokenUnit = 'M'
/** View mode options */
export const VIEW_MODES = {
CARD: 'card',
TABLE: 'table',
} as const
export type ViewMode = (typeof VIEW_MODES)[keyof typeof VIEW_MODES]
/** Default page size for pricing table */
export const DEFAULT_PRICING_PAGE_SIZE = 20