forked from Zoo-Code-Org/Zoo-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.ts
More file actions
166 lines (140 loc) · 6.02 KB
/
Copy pathmodel.ts
File metadata and controls
166 lines (140 loc) · 6.02 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import { z } from "zod"
import { DynamicProvider, LocalProvider } from "./provider-settings.js"
/**
* ReasoningEffort
*/
export const reasoningEfforts = ["low", "medium", "high"] as const
export const reasoningEffortsSchema = z.enum(reasoningEfforts)
export type ReasoningEffort = z.infer<typeof reasoningEffortsSchema>
/**
* ReasoningEffortWithMinimal
*/
export const reasoningEffortWithMinimalSchema = z.union([reasoningEffortsSchema, z.literal("minimal")])
export type ReasoningEffortWithMinimal = z.infer<typeof reasoningEffortWithMinimalSchema>
/**
* Extended Reasoning Effort (includes "none" and "minimal")
* Note: "disable" is a UI/control value, not a value sent as effort
*/
export const reasoningEffortsExtended = ["none", "minimal", "low", "medium", "high", "xhigh", "max"] as const
export const reasoningEffortExtendedSchema = z.enum(reasoningEffortsExtended)
export type ReasoningEffortExtended = z.infer<typeof reasoningEffortExtendedSchema>
/**
* Reasoning Effort user setting (includes "disable")
*/
export const reasoningEffortSettingValues = [
"disable",
"none",
"minimal",
"low",
"medium",
"high",
"xhigh",
"max",
] as const
export const reasoningEffortSettingSchema = z.enum(reasoningEffortSettingValues)
/**
* Verbosity
*/
export const verbosityLevels = ["low", "medium", "high"] as const
export const verbosityLevelsSchema = z.enum(verbosityLevels)
export type VerbosityLevel = z.infer<typeof verbosityLevelsSchema>
/**
* Service tiers (OpenAI Responses API)
*/
export const serviceTiers = ["default", "flex", "priority"] as const
export const serviceTierSchema = z.enum(serviceTiers)
export type ServiceTier = z.infer<typeof serviceTierSchema>
/**
* ModelParameter
*/
export const modelParameters = ["max_tokens", "temperature", "reasoning", "include_reasoning"] as const
export const modelParametersSchema = z.enum(modelParameters)
export type ModelParameter = z.infer<typeof modelParametersSchema>
export const isModelParameter = (value: string): value is ModelParameter =>
modelParameters.includes(value as ModelParameter)
/**
* ModelInfo
*/
export const modelInfoSchema = z.object({
maxTokens: z.number().nullish(),
maxThinkingTokens: z.number().nullish(),
contextWindow: z.number(),
supportsImages: z.boolean().optional(),
supportsPromptCache: z.boolean(),
// Optional default prompt cache retention policy for providers that support it.
// When set to "24h", extended prompt caching will be requested; when omitted
// or set to "in_memory", the default in‑memory cache is used.
promptCacheRetention: z.enum(["in_memory", "24h"]).optional(),
// Capability flag to indicate whether the model supports an output verbosity parameter
supportsVerbosity: z.boolean().optional(),
// Capability flag to indicate whether the model exposes a user-configurable max output
// tokens control in settings. When set, the settings UI surfaces a slider that persists
// `modelMaxTokens`; when the user leaves it unset, the default output clamp is used.
supportsMaxTokens: z.boolean().optional(),
supportsReasoningBudget: z.boolean().optional(),
// Capability flag to indicate whether the model supports simple on/off binary reasoning
supportsReasoningBinary: z.boolean().optional(),
// Capability flag to indicate whether the model supports temperature parameter
supportsTemperature: z.boolean().optional(),
defaultTemperature: z.number().optional(),
requiredReasoningBudget: z.boolean().optional(),
supportsReasoningEffort: z
.union([z.boolean(), z.array(z.enum(["disable", "none", "minimal", "low", "medium", "high", "xhigh", "max"]))])
.optional(),
requiredReasoningEffort: z.boolean().optional(),
preserveReasoning: z.boolean().optional(),
supportedParameters: z.array(modelParametersSchema).optional(),
inputPrice: z.number().optional(),
outputPrice: z.number().optional(),
cacheWritesPrice: z.number().optional(),
cacheReadsPrice: z.number().optional(),
longContextPricing: z
.object({
thresholdTokens: z.number(),
inputPriceMultiplier: z.number().optional(),
outputPriceMultiplier: z.number().optional(),
cacheWritesPriceMultiplier: z.number().optional(),
cacheReadsPriceMultiplier: z.number().optional(),
appliesToServiceTiers: z.array(serviceTierSchema).optional(),
})
.optional(),
description: z.string().optional(),
// Default effort value for models that support reasoning effort
reasoningEffort: reasoningEffortExtendedSchema.optional(),
minTokensPerCachePoint: z.number().optional(),
maxCachePoints: z.number().optional(),
cachableFields: z.array(z.string()).optional(),
// Flag to indicate if the model is deprecated and should not be used
deprecated: z.boolean().optional(),
// Flag to indicate if the model should hide vendor/company identity in responses
isStealthModel: z.boolean().optional(),
// Flag to indicate if the model is free (no cost)
isFree: z.boolean().optional(),
// Exclude specific native tools from being available (only applies to native protocol)
// These tools will be removed from the set of tools available to the model
excludedTools: z.array(z.string()).optional(),
// Include specific native tools (only applies to native protocol)
// These tools will be added if they belong to an allowed group in the current mode
// Cannot force-add tools from groups the mode doesn't allow
includedTools: z.array(z.string()).optional(),
/**
* Service tiers with pricing information.
* Each tier can have a name (for OpenAI service tiers) and pricing overrides.
* The top-level input/output/cache* fields represent the default/standard tier.
*/
tiers: z
.array(
z.object({
name: serviceTierSchema.optional(), // Service tier name (flex, priority, etc.)
contextWindow: z.number(),
inputPrice: z.number().optional(),
outputPrice: z.number().optional(),
cacheWritesPrice: z.number().optional(),
cacheReadsPrice: z.number().optional(),
}),
)
.optional(),
})
export type ModelInfo = z.infer<typeof modelInfoSchema>
export type ModelRecord = Record<string, ModelInfo>
export type RouterModels = Record<DynamicProvider | LocalProvider, ModelRecord>