@better-i18n/schemas 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Shared AI Model Configuration
3
+ * Single source of truth for all AI model definitions used across frontend and backend.
4
+ */
5
+ export type ModelProvider = "better-ai" | "openai" | "gemini" | "claude" | "openrouter";
6
+ export type ModelCategory = "flagship" | "reasoning" | "performance" | "specialized" | "legacy";
7
+ export type ModelIcon = "OpenAI" | "Gemini" | "Claude" | "BetterAI";
8
+ export interface ModelColors {
9
+ /** Background color for UI elements */
10
+ background: string;
11
+ /** Hover background color */
12
+ hover: string;
13
+ /** Icon/text color */
14
+ icon: string;
15
+ }
16
+ export interface AIModelConfig {
17
+ /** UI display ID (e.g., "gpt-5.2", "gemini-3-flash") */
18
+ id: string;
19
+ /** Display name for UI (e.g., "ChatGPT 5.2", "Gemini 3 Flash") */
20
+ name: string;
21
+ /** Provider identifier */
22
+ provider: ModelProvider;
23
+ /** Icon to display for this model (from lucide-react or custom) */
24
+ icon: "OpenAI" | "Gemini" | "Claude" | "BetterAI";
25
+ /** Colors for UI elements */
26
+ colors: ModelColors;
27
+ /** Actual API model ID to send to provider SDK (e.g., "gpt-5.2", "gemini-2.5-flash") */
28
+ apiModelId: string;
29
+ /** Max context window in tokens */
30
+ contextSize: number;
31
+ /** Max output tokens */
32
+ maxOutput: number;
33
+ /** Model description */
34
+ description: string;
35
+ /** Optional badge (e.g., "New", "Fast", "Default") */
36
+ badge?: string;
37
+ /** Is this the default model? */
38
+ isDefault?: boolean;
39
+ /** Release date info */
40
+ releaseDate?: string;
41
+ /** Training data cutoff */
42
+ trainingData?: string;
43
+ /** Speed score 0-100 */
44
+ speed?: number;
45
+ /** Model category */
46
+ category?: ModelCategory;
47
+ /** Whether this model requires user's own API key (not platform key) */
48
+ requiresUserKey?: boolean;
49
+ }
50
+ export interface ProviderInfo {
51
+ id: ModelProvider;
52
+ name: string;
53
+ brandColor: string;
54
+ }
55
+ /**
56
+ * All available AI models - Single Source of Truth
57
+ *
58
+ * Important: `apiModelId` is the actual model ID sent to the provider's SDK.
59
+ * This may differ from `id` which is used for UI/selection purposes.
60
+ *
61
+ * We keep only the best/flagship models from each provider to avoid clutter.
62
+ */
63
+ export declare const AI_MODELS: AIModelConfig[];
64
+ /**
65
+ * Get model config by ID
66
+ */
67
+ export declare function getModelById(modelId: string): AIModelConfig | undefined;
68
+ /**
69
+ * Get the actual API model ID for a given UI model ID
70
+ */
71
+ export declare function getApiModelId(modelId: string): string;
72
+ /**
73
+ * Get provider for a model ID
74
+ */
75
+ export declare function getModelProvider(modelId: string): ModelProvider;
76
+ /**
77
+ * Get default model
78
+ */
79
+ export declare function getDefaultModel(): AIModelConfig;
80
+ /**
81
+ * Get models by provider
82
+ */
83
+ export declare function getModelsByProvider(provider: ModelProvider): AIModelConfig[];
84
+ /**
85
+ * Get models that don't require user API key (platform-provided)
86
+ */
87
+ export declare function getPlatformModels(): AIModelConfig[];
88
+ /**
89
+ * Check if a model requires user's own API key
90
+ */
91
+ export declare function modelRequiresUserKey(modelId: string): boolean;
92
+ /**
93
+ * Format context size for display (e.g., "128K", "2M")
94
+ */
95
+ export declare function formatContextSize(tokens: number): string;
96
+ //# sourceMappingURL=ai-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-models.d.ts","sourceRoot":"","sources":["../src/ai-models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;AAGjB,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,WAAW,GACX,aAAa,GACb,aAAa,GACb,QAAQ,CAAC;AAGb,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAGpE,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,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;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAG/D;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,aAAa,CAE/C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,EAAE,CAE5E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKxD"}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Shared AI Model Configuration
3
+ * Single source of truth for all AI model definitions used across frontend and backend.
4
+ */
5
+ /**
6
+ * All available AI models - Single Source of Truth
7
+ *
8
+ * Important: `apiModelId` is the actual model ID sent to the provider's SDK.
9
+ * This may differ from `id` which is used for UI/selection purposes.
10
+ *
11
+ * We keep only the best/flagship models from each provider to avoid clutter.
12
+ */
13
+ export const AI_MODELS = [
14
+ // ============================================
15
+ // Better AI - Platform Default (Powered by Gemini 3 Flash)
16
+ // ============================================
17
+ {
18
+ id: "better-ai",
19
+ name: "Better AI",
20
+ provider: "better-ai",
21
+ icon: "BetterAI",
22
+ colors: {
23
+ background: "bg-gray-50 dark:bg-neutral-700",
24
+ hover: "hover:bg-gray-100 dark:hover:bg-neutral-600",
25
+ icon: "text-gray-700 dark:text-white",
26
+ },
27
+ apiModelId: "gemini-3-pro-preview",
28
+ contextSize: 1_048_576, // 1M tokens (verified from Google docs)
29
+ maxOutput: 65_536,
30
+ description: "Most capable AI model powered by Gemini 3 Pro. Best for complex translations.",
31
+ isDefault: true,
32
+ badge: "Default",
33
+ releaseDate: "Jan 2025",
34
+ trainingData: "Jan 2025",
35
+ speed: 95,
36
+ category: "flagship",
37
+ requiresUserKey: false,
38
+ },
39
+ // ============================================
40
+ // OpenAI Models (via OpenRouter)
41
+ // ============================================
42
+ {
43
+ id: "gpt-5.2",
44
+ name: "GPT 5.2",
45
+ provider: "openrouter",
46
+ icon: "OpenAI",
47
+ colors: {
48
+ background: "bg-gray-200 dark:bg-neutral-700",
49
+ hover: "hover:bg-gray-300 dark:hover:bg-neutral-600",
50
+ icon: "text-gray-600 dark:text-white",
51
+ },
52
+ apiModelId: "openai/gpt-5.2",
53
+ contextSize: 400_000, // 400K tokens (GPT-5 series standard)
54
+ maxOutput: 128_000,
55
+ description: "OpenAI's latest flagship model via OpenRouter.",
56
+ badge: "New",
57
+ releaseDate: "2025",
58
+ trainingData: "2025",
59
+ speed: 95,
60
+ category: "flagship",
61
+ requiresUserKey: false,
62
+ },
63
+ {
64
+ id: "gpt-5.1",
65
+ name: "GPT 5.1",
66
+ provider: "openrouter",
67
+ icon: "OpenAI",
68
+ colors: {
69
+ background: "bg-gray-200 dark:bg-neutral-700",
70
+ hover: "hover:bg-gray-300 dark:hover:bg-neutral-600",
71
+ icon: "text-gray-600 dark:text-white",
72
+ },
73
+ apiModelId: "openai/gpt-5.1",
74
+ contextSize: 400_000, // 400K tokens (GPT-5 series standard)
75
+ maxOutput: 128_000,
76
+ description: "OpenAI's capable model via OpenRouter.",
77
+ badge: "Fast",
78
+ releaseDate: "2025",
79
+ trainingData: "2025",
80
+ speed: 93,
81
+ category: "flagship",
82
+ requiresUserKey: false,
83
+ },
84
+ // ============================================
85
+ // Google Gemini Models
86
+ // ============================================
87
+ {
88
+ id: "gemini-3-pro",
89
+ name: "Gemini 3 Pro",
90
+ provider: "gemini",
91
+ icon: "Gemini",
92
+ colors: {
93
+ background: "bg-blue-50 dark:bg-blue-700",
94
+ hover: "hover:bg-blue-100 dark:hover:bg-blue-600",
95
+ icon: "text-blue-400 dark:text-blue-400",
96
+ },
97
+ apiModelId: "gemini-3-pro-preview",
98
+ contextSize: 1_048_576, // 1M tokens (verified from Google docs)
99
+ maxOutput: 65_536,
100
+ description: "Google's most capable model. Best for complex tasks.",
101
+ badge: "Pro",
102
+ releaseDate: "Jan 2025",
103
+ trainingData: "Jan 2025",
104
+ speed: 90,
105
+ category: "flagship",
106
+ requiresUserKey: false,
107
+ },
108
+ // ============================================
109
+ // Anthropic Claude (via OpenRouter) - Moved to bottom
110
+ // ============================================
111
+ {
112
+ id: "claude-4-sonnet",
113
+ name: "Claude Sonnet 4",
114
+ provider: "openrouter",
115
+ icon: "Claude",
116
+ colors: {
117
+ background: "bg-orange-50 dark:bg-orange-700",
118
+ hover: "hover:bg-orange-100 dark:hover:bg-orange-600",
119
+ icon: "text-orange-400 dark:text-orange-400",
120
+ },
121
+ apiModelId: "anthropic/claude-sonnet-4.5",
122
+ contextSize: 200_000,
123
+ maxOutput: 8_192,
124
+ description: "Anthropic's flagship. Excellent reasoning and writing via OpenRouter.",
125
+ badge: "New",
126
+ releaseDate: "2025",
127
+ speed: 90,
128
+ category: "flagship",
129
+ requiresUserKey: false,
130
+ },
131
+ ];
132
+ // ============================================
133
+ // Helper Functions
134
+ // ============================================
135
+ /**
136
+ * Get model config by ID
137
+ */
138
+ export function getModelById(modelId) {
139
+ return AI_MODELS.find((m) => m.id === modelId);
140
+ }
141
+ /**
142
+ * Get the actual API model ID for a given UI model ID
143
+ */
144
+ export function getApiModelId(modelId) {
145
+ const model = getModelById(modelId);
146
+ return model?.apiModelId ?? modelId;
147
+ }
148
+ /**
149
+ * Get provider for a model ID
150
+ */
151
+ export function getModelProvider(modelId) {
152
+ const model = getModelById(modelId);
153
+ return model?.provider ?? "better-ai";
154
+ }
155
+ /**
156
+ * Get default model
157
+ */
158
+ export function getDefaultModel() {
159
+ return AI_MODELS.find((m) => m.isDefault) ?? AI_MODELS[0];
160
+ }
161
+ /**
162
+ * Get models by provider
163
+ */
164
+ export function getModelsByProvider(provider) {
165
+ return AI_MODELS.filter((m) => m.provider === provider);
166
+ }
167
+ /**
168
+ * Get models that don't require user API key (platform-provided)
169
+ */
170
+ export function getPlatformModels() {
171
+ return AI_MODELS.filter((m) => !m.requiresUserKey);
172
+ }
173
+ /**
174
+ * Check if a model requires user's own API key
175
+ */
176
+ export function modelRequiresUserKey(modelId) {
177
+ const model = getModelById(modelId);
178
+ return model?.requiresUserKey ?? false;
179
+ }
180
+ /**
181
+ * Format context size for display (e.g., "128K", "2M")
182
+ */
183
+ export function formatContextSize(tokens) {
184
+ if (tokens >= 1_000_000) {
185
+ return `${(tokens / 1_000_000).toFixed(0)}M`;
186
+ }
187
+ return `${(tokens / 1_000).toFixed(0)}K`;
188
+ }
189
+ //# sourceMappingURL=ai-models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-models.js","sourceRoot":"","sources":["../src/ai-models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0EH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAoB;IACxC,+CAA+C;IAC/C,2DAA2D;IAC3D,+CAA+C;IAC/C;QACE,EAAE,EAAE,WAAW;QACf,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE;YACN,UAAU,EAAE,gCAAgC;YAC5C,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE,+BAA+B;SACtC;QACD,UAAU,EAAE,sBAAsB;QAClC,WAAW,EAAE,SAAS,EAAE,wCAAwC;QAChE,SAAS,EAAE,MAAM;QACjB,WAAW,EACT,+EAA+E;QACjF,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,UAAU;QACvB,YAAY,EAAE,UAAU;QACxB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,KAAK;KACvB;IAED,+CAA+C;IAC/C,iCAAiC;IACjC,+CAA+C;IAC/C;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,QAAQ,EA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B,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAuB;IACzD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,KAAK,EAAE,eAAe,IAAI,KAAK,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,IAAI,MAAM,IAAI,SAAS,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/C,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Better i18n Public Schemas
3
+ *
4
+ * This package contains public-facing types and schemas for:
5
+ * - AI model configurations (used by landing demo and SDKs)
6
+ * - MCP tool input/output types (future)
7
+ *
8
+ * Internal tRPC validation schemas are in the platform repo.
9
+ */
10
+ export * from "./ai-models.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Better i18n Public Schemas
3
+ *
4
+ * This package contains public-facing types and schemas for:
5
+ * - AI model configurations (used by landing demo and SDKs)
6
+ * - MCP tool input/output types (future)
7
+ *
8
+ * Internal tRPC validation schemas are in the platform repo.
9
+ */
10
+ export * from "./ai-models.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,26 +1,30 @@
1
1
  {
2
2
  "name": "@better-i18n/schemas",
3
- "version": "0.1.1",
4
- "description": "Shared validation schemas for API and frontend",
3
+ "version": "0.2.1",
4
+ "description": "Public schemas and types for Better i18n SDK and MCP",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "exports": {
9
- ".": "./src/index.ts",
10
- "./projects": "./src/projects/index.ts",
11
- "./organizations": "./src/organizations/index.ts",
12
- "./languages": "./src/languages/index.ts",
13
- "./github": "./src/github.ts",
14
- "./translations": "./src/translations.ts"
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "bun": "./src/index.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./ai-models": {
15
+ "types": "./dist/ai-models.d.ts",
16
+ "bun": "./src/ai-models.ts",
17
+ "default": "./dist/ai-models.js"
18
+ }
15
19
  },
16
20
  "files": [
17
- "src"
21
+ "dist"
18
22
  ],
19
23
  "scripts": {
20
- "type-check": "tsc --noEmit"
21
- },
22
- "dependencies": {
23
- "zod": "^3.25.76"
24
+ "build": "tsc",
25
+ "typecheck": "tsc --noEmit",
26
+ "clean": "rm -rf dist",
27
+ "prepublishOnly": "bun run build"
24
28
  },
25
29
  "devDependencies": {
26
30
  "typescript": "~5.9.2"
package/src/ai-models.ts DELETED
@@ -1,275 +0,0 @@
1
- /**
2
- * Shared AI Model Configuration
3
- * Single source of truth for all AI model definitions used across frontend and backend.
4
- */
5
-
6
- // Provider types
7
- export type ModelProvider =
8
- | "better-ai"
9
- | "openai"
10
- | "gemini"
11
- | "claude"
12
- | "openrouter";
13
-
14
- // Model categories
15
- export type ModelCategory =
16
- | "flagship"
17
- | "reasoning"
18
- | "performance"
19
- | "specialized"
20
- | "legacy";
21
-
22
- // Icon types for models
23
- export type ModelIcon = "OpenAI" | "Gemini" | "Claude" | "BetterAI";
24
-
25
- // Model color configuration
26
- export interface ModelColors {
27
- /** Background color for UI elements */
28
- background: string;
29
- /** Hover background color */
30
- hover: string;
31
- /** Icon/text color */
32
- icon: string;
33
- }
34
-
35
- // Complete model configuration
36
- export interface AIModelConfig {
37
- /** UI display ID (e.g., "gpt-5.2", "gemini-3-flash") */
38
- id: string;
39
- /** Display name for UI (e.g., "ChatGPT 5.2", "Gemini 3 Flash") */
40
- name: string;
41
- /** Provider identifier */
42
- provider: ModelProvider;
43
- /** Icon to display for this model (from lucide-react or custom) */
44
- icon: "OpenAI" | "Gemini" | "Claude" | "BetterAI";
45
- /** Colors for UI elements */
46
- colors: ModelColors;
47
- /** Actual API model ID to send to provider SDK (e.g., "gpt-5.2", "gemini-2.5-flash") */
48
- apiModelId: string;
49
- /** Max context window in tokens */
50
- contextSize: number;
51
- /** Max output tokens */
52
- maxOutput: number;
53
- /** Model description */
54
- description: string;
55
- /** Optional badge (e.g., "New", "Fast", "Default") */
56
- badge?: string;
57
- /** Is this the default model? */
58
- isDefault?: boolean;
59
- /** Release date info */
60
- releaseDate?: string;
61
- /** Training data cutoff */
62
- trainingData?: string;
63
- /** Speed score 0-100 */
64
- speed?: number;
65
- /** Model category */
66
- category?: ModelCategory;
67
- /** Whether this model requires user's own API key (not platform key) */
68
- requiresUserKey?: boolean;
69
- }
70
-
71
- // Provider configuration (for UI)
72
- export interface ProviderInfo {
73
- id: ModelProvider;
74
- name: string;
75
- brandColor: string;
76
- }
77
-
78
- /**
79
- * All available AI models - Single Source of Truth
80
- *
81
- * Important: `apiModelId` is the actual model ID sent to the provider's SDK.
82
- * This may differ from `id` which is used for UI/selection purposes.
83
- *
84
- * We keep only the best/flagship models from each provider to avoid clutter.
85
- */
86
- export const AI_MODELS: AIModelConfig[] = [
87
- // ============================================
88
- // Better AI - Platform Default (Powered by Gemini 3 Flash)
89
- // ============================================
90
- {
91
- id: "better-ai",
92
- name: "Better AI",
93
- provider: "better-ai",
94
- icon: "BetterAI",
95
- colors: {
96
- background: "bg-gray-50 dark:bg-neutral-700",
97
- hover: "hover:bg-gray-100 dark:hover:bg-neutral-600",
98
- icon: "text-gray-700 dark:text-white",
99
- },
100
- apiModelId: "gemini-3-pro-preview",
101
- contextSize: 1_048_576, // 1M tokens (verified from Google docs)
102
- maxOutput: 65_536,
103
- description:
104
- "Most capable AI model powered by Gemini 3 Pro. Best for complex translations.",
105
- isDefault: true,
106
- badge: "Default",
107
- releaseDate: "Jan 2025",
108
- trainingData: "Jan 2025",
109
- speed: 95,
110
- category: "flagship",
111
- requiresUserKey: false,
112
- },
113
-
114
- // ============================================
115
- // OpenAI Models (via OpenRouter)
116
- // ============================================
117
- {
118
- id: "gpt-5.2",
119
- name: "GPT 5.2",
120
- provider: "openrouter",
121
- icon: "OpenAI",
122
- colors: {
123
- background: "bg-gray-200 dark:bg-neutral-700",
124
- hover: "hover:bg-gray-300 dark:hover:bg-neutral-600",
125
- icon: "text-gray-600 dark:text-white",
126
- },
127
- apiModelId: "openai/gpt-5.2",
128
- contextSize: 400_000, // 400K tokens (GPT-5 series standard)
129
- maxOutput: 128_000,
130
- description: "OpenAI's latest flagship model via OpenRouter.",
131
- badge: "New",
132
- releaseDate: "2025",
133
- trainingData: "2025",
134
- speed: 95,
135
- category: "flagship",
136
- requiresUserKey: false,
137
- },
138
- {
139
- id: "gpt-5.1",
140
- name: "GPT 5.1",
141
- provider: "openrouter",
142
- icon: "OpenAI",
143
- colors: {
144
- background: "bg-gray-200 dark:bg-neutral-700",
145
- hover: "hover:bg-gray-300 dark:hover:bg-neutral-600",
146
- icon: "text-gray-600 dark:text-white",
147
- },
148
- apiModelId: "openai/gpt-5.1",
149
- contextSize: 400_000, // 400K tokens (GPT-5 series standard)
150
- maxOutput: 128_000,
151
- description: "OpenAI's capable model via OpenRouter.",
152
- badge: "Fast",
153
- releaseDate: "2025",
154
- trainingData: "2025",
155
- speed: 93,
156
- category: "flagship",
157
- requiresUserKey: false,
158
- },
159
-
160
- // ============================================
161
- // Google Gemini Models
162
- // ============================================
163
- {
164
- id: "gemini-3-pro",
165
- name: "Gemini 3 Pro",
166
- provider: "gemini",
167
- icon: "Gemini",
168
- colors: {
169
- background: "bg-blue-50 dark:bg-blue-700",
170
- hover: "hover:bg-blue-100 dark:hover:bg-blue-600",
171
- icon: "text-blue-400 dark:text-blue-400",
172
- },
173
- apiModelId: "gemini-3-pro-preview",
174
- contextSize: 1_048_576, // 1M tokens (verified from Google docs)
175
- maxOutput: 65_536,
176
- description: "Google's most capable model. Best for complex tasks.",
177
- badge: "Pro",
178
- releaseDate: "Jan 2025",
179
- trainingData: "Jan 2025",
180
- speed: 90,
181
- category: "flagship",
182
- requiresUserKey: false,
183
- },
184
-
185
- // ============================================
186
- // Anthropic Claude (via OpenRouter) - Moved to bottom
187
- // ============================================
188
- {
189
- id: "claude-4-sonnet",
190
- name: "Claude Sonnet 4",
191
- provider: "openrouter",
192
- icon: "Claude",
193
- colors: {
194
- background: "bg-orange-50 dark:bg-orange-700",
195
- hover: "hover:bg-orange-100 dark:hover:bg-orange-600",
196
- icon: "text-orange-400 dark:text-orange-400",
197
- },
198
- apiModelId: "anthropic/claude-sonnet-4.5",
199
- contextSize: 200_000,
200
- maxOutput: 8_192,
201
- description:
202
- "Anthropic's flagship. Excellent reasoning and writing via OpenRouter.",
203
- badge: "New",
204
- releaseDate: "2025",
205
- speed: 90,
206
- category: "flagship",
207
- requiresUserKey: false,
208
- },
209
- ];
210
-
211
- // ============================================
212
- // Helper Functions
213
- // ============================================
214
-
215
- /**
216
- * Get model config by ID
217
- */
218
- export function getModelById(modelId: string): AIModelConfig | undefined {
219
- return AI_MODELS.find((m) => m.id === modelId);
220
- }
221
-
222
- /**
223
- * Get the actual API model ID for a given UI model ID
224
- */
225
- export function getApiModelId(modelId: string): string {
226
- const model = getModelById(modelId);
227
- return model?.apiModelId ?? modelId;
228
- }
229
-
230
- /**
231
- * Get provider for a model ID
232
- */
233
- export function getModelProvider(modelId: string): ModelProvider {
234
- const model = getModelById(modelId);
235
- return model?.provider ?? "better-ai";
236
- }
237
-
238
- /**
239
- * Get default model
240
- */
241
- export function getDefaultModel(): AIModelConfig {
242
- return AI_MODELS.find((m) => m.isDefault) ?? AI_MODELS[0];
243
- }
244
-
245
- /**
246
- * Get models by provider
247
- */
248
- export function getModelsByProvider(provider: ModelProvider): AIModelConfig[] {
249
- return AI_MODELS.filter((m) => m.provider === provider);
250
- }
251
-
252
- /**
253
- * Get models that don't require user API key (platform-provided)
254
- */
255
- export function getPlatformModels(): AIModelConfig[] {
256
- return AI_MODELS.filter((m) => !m.requiresUserKey);
257
- }
258
-
259
- /**
260
- * Check if a model requires user's own API key
261
- */
262
- export function modelRequiresUserKey(modelId: string): boolean {
263
- const model = getModelById(modelId);
264
- return model?.requiresUserKey ?? false;
265
- }
266
-
267
- /**
268
- * Format context size for display (e.g., "128K", "2M")
269
- */
270
- export function formatContextSize(tokens: number): string {
271
- if (tokens >= 1_000_000) {
272
- return `${(tokens / 1_000_000).toFixed(0)}M`;
273
- }
274
- return `${(tokens / 1_000).toFixed(0)}K`;
275
- }