-
Notifications
You must be signed in to change notification settings - Fork 767
Expand file tree
/
Copy pathproxy-presets.ts
More file actions
94 lines (88 loc) · 2.26 KB
/
Copy pathproxy-presets.ts
File metadata and controls
94 lines (88 loc) · 2.26 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
import { z } from 'zod';
export const PROXY_PRESET_SCHEMA_VERSION = 1 as const;
export const PROXY_PRESETS = [
{
id: 'official-openai',
label: 'OpenAI Official',
provider: 'openai',
baseUrl: 'https://api.openai.com/v1',
notes: '',
},
{
id: 'official-anthropic',
label: 'Anthropic Official',
provider: 'anthropic',
baseUrl: 'https://api.anthropic.com',
notes: '',
},
{
id: 'official-google',
label: 'Google AI Studio',
provider: 'openai',
baseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai',
notes: 'OpenAI-compatible endpoint',
},
{
id: 'duckcoding',
label: 'DuckCoding',
provider: 'openai',
baseUrl: 'https://api.duckcoding.ai/v1',
notes: 'OpenAI compatible relay',
},
{
id: 'openrouter',
label: 'OpenRouter',
provider: 'openai',
baseUrl: 'https://openrouter.ai/api/v1',
notes: 'Multi-model relay',
},
{
id: 'siliconflow',
label: 'SiliconFlow',
provider: 'openai',
baseUrl: 'https://api.siliconflow.cn/v1',
notes: 'CN-friendly relay',
},
{
id: 'one-api',
label: 'one-api (self-hosted)',
provider: 'openai',
baseUrl: 'http://localhost:3000/v1',
notes: 'Edit URL to your deployment',
},
{
id: 'cli-proxy-api',
label: 'CLIProxyAPI',
provider: 'anthropic',
baseUrl: 'http://127.0.0.1:8317',
notes: '',
},
{
id: 'zai-glm',
label: 'Z.ai GLM Coding Plan',
provider: 'anthropic',
baseUrl: 'https://api.z.ai/api/anthropic',
notes: 'GLM-5.1, GLM-5-Turbo, GLM-4.7, GLM-4.5-Air',
},
{
id: 'custom',
label: 'Custom...',
provider: 'openai',
baseUrl: '',
notes: 'Enter your own base URL',
},
] as const;
export type ProxyPresetId = (typeof PROXY_PRESETS)[number]['id'];
const presetIds = PROXY_PRESETS.map((p) => p.id) as [ProxyPresetId, ...ProxyPresetId[]];
export const ProxyPresetIdSchema = z.enum(presetIds);
export const ProxyPreset = z.object({
id: ProxyPresetIdSchema,
label: z.string(),
provider: z.string(),
baseUrl: z.string(),
notes: z.string(),
});
export type ProxyPreset = z.infer<typeof ProxyPreset>;
export function getPresetById(id: ProxyPresetId): (typeof PROXY_PRESETS)[number] | undefined {
return PROXY_PRESETS.find((p) => p.id === id);
}