@earendil-works/pi-ai 1.2.0 → 1.4.0
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.
- package/README.md +83 -37
- package/dist/api/anthropic-messages.d.ts.map +1 -1
- package/dist/api/anthropic-messages.js +66 -64
- package/dist/api/anthropic-messages.js.map +1 -1
- package/dist/api/azure-openai-responses.d.ts.map +1 -1
- package/dist/api/azure-openai-responses.js +8 -4
- package/dist/api/azure-openai-responses.js.map +1 -1
- package/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/dist/api/bedrock-converse-stream.js +28 -18
- package/dist/api/bedrock-converse-stream.js.map +1 -1
- package/dist/api/classifier-shared.d.ts.map +1 -1
- package/dist/api/classifier-shared.js +4 -3
- package/dist/api/classifier-shared.js.map +1 -1
- package/dist/api/cloudflare-workers-ai-system-one.d.ts.map +1 -1
- package/dist/api/cloudflare-workers-ai-system-one.js +8 -0
- package/dist/api/cloudflare-workers-ai-system-one.js.map +1 -1
- package/dist/api/google-generative-ai.js +4 -4
- package/dist/api/google-generative-ai.js.map +1 -1
- package/dist/api/google-shared.d.ts.map +1 -1
- package/dist/api/google-shared.js +3 -1
- package/dist/api/google-shared.js.map +1 -1
- package/dist/api/google-vertex.d.ts.map +1 -1
- package/dist/api/google-vertex.js +9 -9
- package/dist/api/google-vertex.js.map +1 -1
- package/dist/api/lazy.d.ts +7 -2
- package/dist/api/lazy.d.ts.map +1 -1
- package/dist/api/lazy.js +24 -5
- package/dist/api/lazy.js.map +1 -1
- package/dist/api/llama-cpp-classify.d.ts.map +1 -1
- package/dist/api/llama-cpp-classify.js +2 -1
- package/dist/api/llama-cpp-classify.js.map +1 -1
- package/dist/api/mistral-conversations.js +4 -4
- package/dist/api/mistral-conversations.js.map +1 -1
- package/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/dist/api/openai-codex-responses.js +17 -11
- package/dist/api/openai-codex-responses.js.map +1 -1
- package/dist/api/openai-completions.d.ts.map +1 -1
- package/dist/api/openai-completions.js +43 -35
- package/dist/api/openai-completions.js.map +1 -1
- package/dist/api/openai-responses-shared.d.ts +26 -0
- package/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/dist/api/openai-responses-shared.js +76 -11
- package/dist/api/openai-responses-shared.js.map +1 -1
- package/dist/api/openai-responses.d.ts.map +1 -1
- package/dist/api/openai-responses.js +38 -13
- package/dist/api/openai-responses.js.map +1 -1
- package/dist/api/openrouter-images.d.ts.map +1 -1
- package/dist/api/openrouter-images.js +4 -3
- package/dist/api/openrouter-images.js.map +1 -1
- package/dist/api/pi-messages.d.ts.map +1 -1
- package/dist/api/pi-messages.js +3 -3
- package/dist/api/pi-messages.js.map +1 -1
- package/dist/api/simple-options.d.ts.map +1 -1
- package/dist/api/simple-options.js +2 -1
- package/dist/api/simple-options.js.map +1 -1
- package/dist/api/system-one-shared.d.ts +29 -2
- package/dist/api/system-one-shared.d.ts.map +1 -1
- package/dist/api/system-one-shared.js +55 -3
- package/dist/api/system-one-shared.js.map +1 -1
- package/dist/api/transform-messages.d.ts +16 -1
- package/dist/api/transform-messages.d.ts.map +1 -1
- package/dist/api/transform-messages.js +28 -15
- package/dist/api/transform-messages.js.map +1 -1
- package/dist/api/typesafe-system-one.d.ts.map +1 -1
- package/dist/api/typesafe-system-one.js +10 -0
- package/dist/api/typesafe-system-one.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +4 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +19 -6
- package/dist/models.js.map +1 -1
- package/dist/providers/compat-schema.d.ts +171 -0
- package/dist/providers/compat-schema.d.ts.map +1 -1
- package/dist/providers/compat-schema.js +23 -2
- package/dist/providers/compat-schema.js.map +1 -1
- package/dist/providers/data/.manifest.json +1 -1
- package/dist/providers/data/amazon-bedrock.json +1 -1
- package/dist/providers/data/anthropic.json +1 -1
- package/dist/providers/data/azure.json +1 -1
- package/dist/providers/data/baseten.json +1 -1
- package/dist/providers/data/cerebras.json +1 -1
- package/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/dist/providers/data/fireworks.json +1 -1
- package/dist/providers/data/github-copilot.json +1 -1
- package/dist/providers/data/google-vertex.json +1 -1
- package/dist/providers/data/google.json +1 -1
- package/dist/providers/data/groq.json +1 -1
- package/dist/providers/data/huggingface.json +1 -1
- package/dist/providers/data/kimi-coding.json +1 -1
- package/dist/providers/data/meta.json +1 -1
- package/dist/providers/data/minimax-cn.json +1 -1
- package/dist/providers/data/minimax.json +1 -1
- package/dist/providers/data/mistral.json +1 -1
- package/dist/providers/data/moonshotai-cn.json +1 -1
- package/dist/providers/data/nvidia.json +1 -1
- package/dist/providers/data/openai-codex.json +1 -1
- package/dist/providers/data/openai.json +1 -1
- package/dist/providers/data/opencode-go.json +1 -1
- package/dist/providers/data/opencode.json +1 -1
- package/dist/providers/data/openrouter.json +1 -1
- package/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/dist/providers/data/qwen-token-plan.json +1 -1
- package/dist/providers/data/radius.json +1 -1
- package/dist/providers/data/together.json +1 -1
- package/dist/providers/data/typesafe.json +1 -1
- package/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/providers/data/xai.json +1 -1
- package/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/dist/providers/data/xiaomi.json +1 -1
- package/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/providers/kimi-coding.d.ts +1 -1
- package/dist/providers/kimi-coding.js +3 -3
- package/dist/providers/kimi-coding.js.map +1 -1
- package/dist/providers/model-schema.d.ts.map +1 -1
- package/dist/providers/model-schema.js +4 -2
- package/dist/providers/model-schema.js.map +1 -1
- package/dist/providers/opencode-go.d.ts +3 -1
- package/dist/providers/opencode-go.d.ts.map +1 -1
- package/dist/providers/opencode-go.js +2 -0
- package/dist/providers/opencode-go.js.map +1 -1
- package/dist/telemetry.d.ts +288 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +191 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/types.d.ts +18 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/identity.d.ts +65 -0
- package/dist/utils/identity.d.ts.map +1 -0
- package/dist/utils/identity.js +141 -0
- package/dist/utils/identity.js.map +1 -0
- package/dist/utils/json-parse.d.ts +10 -0
- package/dist/utils/json-parse.d.ts.map +1 -1
- package/dist/utils/json-parse.js +26 -1
- package/dist/utils/json-parse.js.map +1 -1
- package/dist/utils/overflow.d.ts +1 -0
- package/dist/utils/overflow.d.ts.map +1 -1
- package/dist/utils/overflow.js +6 -1
- package/dist/utils/overflow.js.map +1 -1
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +21 -8
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/transcript.d.ts +22 -8
- package/dist/utils/transcript.d.ts.map +1 -1
- package/dist/utils/transcript.js +29 -18
- package/dist/utils/transcript.js.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +3 -0
- package/dist/utils/validation.js.map +1 -1
- package/dist/utils/version.d.ts +2 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +3 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +2 -2
- package/dist/utils/assistant-message-frame.d.ts +0 -77
- package/dist/utils/assistant-message-frame.d.ts.map +0 -1
- package/dist/utils/assistant-message-frame.js +0 -425
- package/dist/utils/assistant-message-frame.js.map +0 -1
- package/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js +0 -12
- package/dist/utils/pi-user-agent.js.map +0 -1
|
@@ -141,6 +141,7 @@ export declare const OpenAIResponsesCompatSchema: Type.TObject<{
|
|
|
141
141
|
supportsAdditionalTools: Type.TOptional<Type.TBoolean>;
|
|
142
142
|
supportsToolSearch: Type.TOptional<Type.TBoolean>;
|
|
143
143
|
supportsExplicitPromptCacheMode: Type.TOptional<Type.TBoolean>;
|
|
144
|
+
supportsMidConvoEffort: Type.TOptional<Type.TBoolean>;
|
|
144
145
|
supportsMaxOutputTokens: Type.TOptional<Type.TBoolean>;
|
|
145
146
|
}>;
|
|
146
147
|
export declare const AnthropicMessagesCompatSchema: Type.TObject<{
|
|
@@ -180,8 +181,170 @@ export declare const BedrockCompatSchema: Type.TObject<{
|
|
|
180
181
|
export declare const MistralConversationsCompatSchema: Type.TObject<{
|
|
181
182
|
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
182
183
|
}>;
|
|
184
|
+
export declare const SystemOneCompatSchema: Type.TObject<{
|
|
185
|
+
imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
|
|
186
|
+
sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
|
|
187
|
+
}>;
|
|
183
188
|
type UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends (value: infer Intersection) => void ? Intersection : never;
|
|
184
189
|
type MergedCompatProperties<PropertyGroups extends readonly TProperties[], Overrides extends TProperties> = Omit<UnionToIntersection<PropertyGroups[number]>, keyof Overrides> & Overrides;
|
|
190
|
+
/** Compatibility schema for each API whose models accept compat. Mirrors the compat type of Model. */
|
|
191
|
+
export declare const CompatSchemasByApi: {
|
|
192
|
+
readonly "openai-completions": Type.TObject<{
|
|
193
|
+
supportsStore: Type.TOptional<Type.TBoolean>;
|
|
194
|
+
supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
|
|
195
|
+
supportsReasoningEffort: Type.TOptional<Type.TBoolean>;
|
|
196
|
+
supportsUsageInStreaming: Type.TOptional<Type.TBoolean>;
|
|
197
|
+
supportsFinishReason: Type.TOptional<Type.TBoolean>;
|
|
198
|
+
maxTokensField: Type.TOptional<Type.TUnion<[Type.TLiteral<"max_completion_tokens">, Type.TLiteral<"max_tokens">]>>;
|
|
199
|
+
requiresToolResultName: Type.TOptional<Type.TBoolean>;
|
|
200
|
+
requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;
|
|
201
|
+
requiresThinkingAsText: Type.TOptional<Type.TBoolean>;
|
|
202
|
+
requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;
|
|
203
|
+
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"deepseek">, Type.TLiteral<"together">, Type.TLiteral<"baseten">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;
|
|
204
|
+
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull, Type.TObject<{
|
|
205
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">, Type.TLiteral<"thinking.budget">]>;
|
|
206
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
207
|
+
}>]>>>;
|
|
208
|
+
chatTemplateArgs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull, Type.TObject<{
|
|
209
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">, Type.TLiteral<"thinking.budget">]>;
|
|
210
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
211
|
+
}>]>>>;
|
|
212
|
+
openRouterRouting: Type.TOptional<Type.TObject<{
|
|
213
|
+
allow_fallbacks: Type.TOptional<Type.TBoolean>;
|
|
214
|
+
require_parameters: Type.TOptional<Type.TBoolean>;
|
|
215
|
+
data_collection: Type.TOptional<Type.TUnion<[Type.TLiteral<"deny">, Type.TLiteral<"allow">]>>;
|
|
216
|
+
zdr: Type.TOptional<Type.TBoolean>;
|
|
217
|
+
enforce_distillable_text: Type.TOptional<Type.TBoolean>;
|
|
218
|
+
order: Type.TOptional<Type.TArray<Type.TString>>;
|
|
219
|
+
only: Type.TOptional<Type.TArray<Type.TString>>;
|
|
220
|
+
ignore: Type.TOptional<Type.TArray<Type.TString>>;
|
|
221
|
+
quantizations: Type.TOptional<Type.TArray<Type.TString>>;
|
|
222
|
+
sort: Type.TOptional<Type.TUnion<[Type.TString, Type.TObject<{
|
|
223
|
+
by: Type.TOptional<Type.TString>;
|
|
224
|
+
partition: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
225
|
+
}>]>>;
|
|
226
|
+
max_price: Type.TOptional<Type.TObject<{
|
|
227
|
+
prompt: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TString]>>;
|
|
228
|
+
completion: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TString]>>;
|
|
229
|
+
image: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TString]>>;
|
|
230
|
+
audio: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TString]>>;
|
|
231
|
+
request: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TString]>>;
|
|
232
|
+
}>>;
|
|
233
|
+
preferred_min_throughput: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TObject<{
|
|
234
|
+
p50: Type.TOptional<Type.TNumber>;
|
|
235
|
+
p75: Type.TOptional<Type.TNumber>;
|
|
236
|
+
p90: Type.TOptional<Type.TNumber>;
|
|
237
|
+
p99: Type.TOptional<Type.TNumber>;
|
|
238
|
+
}>]>>;
|
|
239
|
+
preferred_max_latency: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TObject<{
|
|
240
|
+
p50: Type.TOptional<Type.TNumber>;
|
|
241
|
+
p75: Type.TOptional<Type.TNumber>;
|
|
242
|
+
p90: Type.TOptional<Type.TNumber>;
|
|
243
|
+
p99: Type.TOptional<Type.TNumber>;
|
|
244
|
+
}>]>>;
|
|
245
|
+
}>>;
|
|
246
|
+
vercelGatewayRouting: Type.TOptional<Type.TObject<{
|
|
247
|
+
only: Type.TOptional<Type.TArray<Type.TString>>;
|
|
248
|
+
order: Type.TOptional<Type.TArray<Type.TString>>;
|
|
249
|
+
}>>;
|
|
250
|
+
zaiToolStream: Type.TOptional<Type.TBoolean>;
|
|
251
|
+
thinkingTokenBudgetField: Type.TOptional<Type.TUnion<[Type.TLiteral<"thinking_token_budget">, Type.TLiteral<"thinking_budget">, Type.TLiteral<"thinking_budget_tokens">]>>;
|
|
252
|
+
supportsThinkingTokenBudget: Type.TOptional<Type.TBoolean>;
|
|
253
|
+
supportsOpenAIGrammarTools: Type.TOptional<Type.TBoolean>;
|
|
254
|
+
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
255
|
+
supportsMidConvoToolAdditions: Type.TOptional<Type.TBoolean>;
|
|
256
|
+
supportsStrictMode: Type.TOptional<Type.TBoolean>;
|
|
257
|
+
cacheControlFormat: Type.TOptional<Type.TLiteral<"anthropic">>;
|
|
258
|
+
sendSessionAffinityHeaders: Type.TOptional<Type.TBoolean>;
|
|
259
|
+
sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
|
|
260
|
+
supportsLongCacheRetention: Type.TOptional<Type.TBoolean>;
|
|
261
|
+
vllmPriority: Type.TOptional<Type.TNumber>;
|
|
262
|
+
}>;
|
|
263
|
+
readonly "openai-responses": Type.TObject<{
|
|
264
|
+
supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
|
|
265
|
+
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
266
|
+
sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
|
|
267
|
+
supportsLongCacheRetention: Type.TOptional<Type.TBoolean>;
|
|
268
|
+
supportsStrictMode: Type.TOptional<Type.TBoolean>;
|
|
269
|
+
supportsOpenAIGrammarTools: Type.TOptional<Type.TBoolean>;
|
|
270
|
+
supportsAdditionalTools: Type.TOptional<Type.TBoolean>;
|
|
271
|
+
supportsToolSearch: Type.TOptional<Type.TBoolean>;
|
|
272
|
+
supportsExplicitPromptCacheMode: Type.TOptional<Type.TBoolean>;
|
|
273
|
+
supportsMidConvoEffort: Type.TOptional<Type.TBoolean>;
|
|
274
|
+
supportsMaxOutputTokens: Type.TOptional<Type.TBoolean>;
|
|
275
|
+
}>;
|
|
276
|
+
readonly "azure-openai-responses": Type.TObject<{
|
|
277
|
+
supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
|
|
278
|
+
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
279
|
+
sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
|
|
280
|
+
supportsLongCacheRetention: Type.TOptional<Type.TBoolean>;
|
|
281
|
+
supportsStrictMode: Type.TOptional<Type.TBoolean>;
|
|
282
|
+
supportsOpenAIGrammarTools: Type.TOptional<Type.TBoolean>;
|
|
283
|
+
supportsAdditionalTools: Type.TOptional<Type.TBoolean>;
|
|
284
|
+
supportsToolSearch: Type.TOptional<Type.TBoolean>;
|
|
285
|
+
supportsExplicitPromptCacheMode: Type.TOptional<Type.TBoolean>;
|
|
286
|
+
supportsMidConvoEffort: Type.TOptional<Type.TBoolean>;
|
|
287
|
+
supportsMaxOutputTokens: Type.TOptional<Type.TBoolean>;
|
|
288
|
+
}>;
|
|
289
|
+
readonly "openai-codex-responses": Type.TObject<{
|
|
290
|
+
supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
|
|
291
|
+
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
292
|
+
sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
|
|
293
|
+
supportsLongCacheRetention: Type.TOptional<Type.TBoolean>;
|
|
294
|
+
supportsStrictMode: Type.TOptional<Type.TBoolean>;
|
|
295
|
+
supportsOpenAIGrammarTools: Type.TOptional<Type.TBoolean>;
|
|
296
|
+
supportsAdditionalTools: Type.TOptional<Type.TBoolean>;
|
|
297
|
+
supportsToolSearch: Type.TOptional<Type.TBoolean>;
|
|
298
|
+
supportsExplicitPromptCacheMode: Type.TOptional<Type.TBoolean>;
|
|
299
|
+
supportsMidConvoEffort: Type.TOptional<Type.TBoolean>;
|
|
300
|
+
supportsMaxOutputTokens: Type.TOptional<Type.TBoolean>;
|
|
301
|
+
}>;
|
|
302
|
+
readonly "anthropic-messages": Type.TObject<{
|
|
303
|
+
supportsEagerToolInputStreaming: Type.TOptional<Type.TBoolean>;
|
|
304
|
+
supportsLongCacheRetention: Type.TOptional<Type.TBoolean>;
|
|
305
|
+
sendSessionAffinityHeaders: Type.TOptional<Type.TBoolean>;
|
|
306
|
+
sessionAffinityFormat: Type.TOptional<Type.TLiteral<"openrouter">>;
|
|
307
|
+
supportsCacheControlOnTools: Type.TOptional<Type.TBoolean>;
|
|
308
|
+
supportsTemperature: Type.TOptional<Type.TBoolean>;
|
|
309
|
+
forceAdaptiveThinking: Type.TOptional<Type.TBoolean>;
|
|
310
|
+
allowEmptySignature: Type.TOptional<Type.TBoolean>;
|
|
311
|
+
supportsStrictTools: Type.TOptional<Type.TBoolean>;
|
|
312
|
+
supportsMidConvoEffort: Type.TOptional<Type.TBoolean>;
|
|
313
|
+
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
314
|
+
supportsMidConvoToolChanges: Type.TOptional<Type.TBoolean>;
|
|
315
|
+
allowedFallbackModels: Type.TOptional<Type.TArray<Type.TObject<{
|
|
316
|
+
provider: Type.TString;
|
|
317
|
+
model: Type.TString;
|
|
318
|
+
cost: Type.TObject<{
|
|
319
|
+
input: Type.TNumber;
|
|
320
|
+
output: Type.TNumber;
|
|
321
|
+
cacheRead: Type.TNumber;
|
|
322
|
+
cacheWrite: Type.TNumber;
|
|
323
|
+
tiers: Type.TOptional<Type.TArray<Type.TObject<{
|
|
324
|
+
input: Type.TNumber;
|
|
325
|
+
output: Type.TNumber;
|
|
326
|
+
cacheRead: Type.TNumber;
|
|
327
|
+
cacheWrite: Type.TNumber;
|
|
328
|
+
inputTokensAbove: Type.TNumber;
|
|
329
|
+
}>>>;
|
|
330
|
+
}>;
|
|
331
|
+
}>>>;
|
|
332
|
+
}>;
|
|
333
|
+
readonly "bedrock-converse-stream": Type.TObject<{
|
|
334
|
+
supportsStrictMode: Type.TOptional<Type.TBoolean>;
|
|
335
|
+
}>;
|
|
336
|
+
readonly "mistral-conversations": Type.TObject<{
|
|
337
|
+
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
338
|
+
}>;
|
|
339
|
+
readonly "typesafe-system-one": Type.TObject<{
|
|
340
|
+
imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
|
|
341
|
+
sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
|
|
342
|
+
}>;
|
|
343
|
+
readonly "cloudflare-workers-ai-system-one": Type.TObject<{
|
|
344
|
+
imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
|
|
345
|
+
sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
|
|
346
|
+
}>;
|
|
347
|
+
};
|
|
185
348
|
export declare const ProviderCompatSchema: Type.TObject<MergedCompatProperties<({
|
|
186
349
|
supportsStore: Type.TOptional<Type.TBoolean>;
|
|
187
350
|
supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
|
|
@@ -262,6 +425,7 @@ export declare const ProviderCompatSchema: Type.TObject<MergedCompatProperties<(
|
|
|
262
425
|
supportsAdditionalTools: Type.TOptional<Type.TBoolean>;
|
|
263
426
|
supportsToolSearch: Type.TOptional<Type.TBoolean>;
|
|
264
427
|
supportsExplicitPromptCacheMode: Type.TOptional<Type.TBoolean>;
|
|
428
|
+
supportsMidConvoEffort: Type.TOptional<Type.TBoolean>;
|
|
265
429
|
supportsMaxOutputTokens: Type.TOptional<Type.TBoolean>;
|
|
266
430
|
} | {
|
|
267
431
|
supportsEagerToolInputStreaming: Type.TOptional<Type.TBoolean>;
|
|
@@ -297,10 +461,14 @@ export declare const ProviderCompatSchema: Type.TObject<MergedCompatProperties<(
|
|
|
297
461
|
supportsStrictMode: Type.TOptional<Type.TBoolean>;
|
|
298
462
|
} | {
|
|
299
463
|
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
464
|
+
} | {
|
|
465
|
+
imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
|
|
466
|
+
sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
|
|
300
467
|
})[], {
|
|
301
468
|
supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
|
|
302
469
|
supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
|
|
303
470
|
sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
|
|
471
|
+
supportsMidConvoEffort: Type.TOptional<Type.TBoolean>;
|
|
304
472
|
supportsLongCacheRetention: Type.TOptional<Type.TBoolean>;
|
|
305
473
|
supportsStrictMode: Type.TOptional<Type.TBoolean>;
|
|
306
474
|
supportsOpenAIGrammarTools: Type.TOptional<Type.TBoolean>;
|
|
@@ -334,5 +502,8 @@ export interface BedrockCompat extends Static<typeof BedrockCompatSchema> {
|
|
|
334
502
|
/** Compatibility settings for the Mistral chat API. */
|
|
335
503
|
export interface MistralConversationsCompat extends Static<typeof MistralConversationsCompatSchema> {
|
|
336
504
|
}
|
|
505
|
+
/** Compatibility settings for System One classifier APIs. */
|
|
506
|
+
export interface SystemOneCompat extends Static<typeof SystemOneCompatSchema> {
|
|
507
|
+
}
|
|
337
508
|
export {};
|
|
338
509
|
//# sourceMappingURL=compat-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-schema.d.ts","sourceRoot":"","sources":["../../src/providers/compat-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAuB,IAAI,EAAE,MAAM,SAAS,CAAC;AAOnF,eAAO,MAAM,2BAA2B,wGAEtC,CAAC;AASH,eAAO,MAAM,8BAA8B,kIAGzC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;IAavC,CAAC;AAWH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqGnC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;EAkBtC,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;EAO/C,CAAC;AAUF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkKzC,CAAC;AAEF,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"compat-schema.d.ts","sourceRoot":"","sources":["../../src/providers/compat-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAuB,IAAI,EAAE,MAAM,SAAS,CAAC;AAOnF,eAAO,MAAM,2BAA2B,wGAEtC,CAAC;AASH,eAAO,MAAM,8BAA8B,kIAGzC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;IAavC,CAAC;AAWH,eAAO,MAAM,uBAAuB;;;;;;;;;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AAC;CAAG"}
|
|
@@ -240,6 +240,10 @@ export const OpenAIResponsesCompatSchema = Type.Object({
|
|
|
240
240
|
description: "Whether the model accepts prompt_cache_options. Older OpenAI models reject the parameter.",
|
|
241
241
|
default: false,
|
|
242
242
|
})),
|
|
243
|
+
supportsMidConvoEffort: Type.Optional(Type.Boolean({
|
|
244
|
+
description: "Whether thinking level changes are sent as configuration_update input items instead of changing reasoning.effort, so a change keeps the prompt cache. Only used by the openai-responses API, and ignored with Sign in with ChatGPT on the openai provider.",
|
|
245
|
+
default: false,
|
|
246
|
+
})),
|
|
243
247
|
supportsMaxOutputTokens: Type.Optional(Type.Boolean({
|
|
244
248
|
description: "Whether the provider accepts max_output_tokens. Some Codex-protocol gateways reject it.",
|
|
245
249
|
default: true,
|
|
@@ -309,6 +313,14 @@ export const MistralConversationsCompatSchema = Type.Object({
|
|
|
309
313
|
default: false,
|
|
310
314
|
}),
|
|
311
315
|
}, { description: "Compatibility settings for the Mistral chat API.", additionalProperties: true });
|
|
316
|
+
export const SystemOneCompatSchema = Type.Object({
|
|
317
|
+
imageInput: Type.Optional(Type.Union([Type.Literal("assets"), Type.Literal("images"), Type.Literal("state-image-urls")], {
|
|
318
|
+
description: 'How the service takes classifier images. "assets" sends TypeSafe\'s assets map (PNG and JPEG) and references the images from the state, as TypeSafe and Jev on Workers AI expect. "images" sends Clef\'s images list of data URLs (PNG, JPEG, and WebP, at most four), as Clef on Workers AI expects. "state-image-urls" places image_url parts before the state, as OpenRouter expects; OpenRouter drops assets without an error. Auto-detected from the provider, baseUrl, and model ID. Classifier models read it from the provider-level compat; models and modelOverrides entries apply to chat models only.',
|
|
319
|
+
})),
|
|
320
|
+
sendImageOptInHeader: optionalCompatBoolean({
|
|
321
|
+
description: "Whether requests with images send the TypeSafe-Danger-Zone-Images: true header, which TypeSafe's own API requires for its experimental image input. Defaults to true for the typesafe-system-one API unless the model is detected as OpenRouter.",
|
|
322
|
+
}),
|
|
323
|
+
}, { description: "Compatibility settings for System One classifier APIs.", additionalProperties: true });
|
|
312
324
|
const ProviderCompatPropertyOverrides = {
|
|
313
325
|
supportsDeveloperRole: optionalCompatBoolean({
|
|
314
326
|
description: "Whether the provider supports the developer role instead of system. Defaults are API-specific.",
|
|
@@ -320,6 +332,10 @@ const ProviderCompatPropertyOverrides = {
|
|
|
320
332
|
sessionAffinityFormat: optionalSessionAffinityFormat({
|
|
321
333
|
description: "Session-affinity header format. Defaults are API-specific or auto-detected.",
|
|
322
334
|
}),
|
|
335
|
+
supportsMidConvoEffort: optionalCompatBoolean({
|
|
336
|
+
description: "Whether thinking level changes are sent inside the conversation instead of changing the request's effort, so a change keeps the prompt cache. Used by the anthropic-messages and openai-responses APIs.",
|
|
337
|
+
default: false,
|
|
338
|
+
}),
|
|
323
339
|
supportsLongCacheRetention: optionalCompatBoolean({
|
|
324
340
|
description: "Whether the provider supports long prompt cache retention. Defaults are API-specific or auto-detected.",
|
|
325
341
|
}),
|
|
@@ -360,14 +376,19 @@ function mergeCompatProperties(propertyGroups, overrides) {
|
|
|
360
376
|
}
|
|
361
377
|
return { ...merged, ...overrides };
|
|
362
378
|
}
|
|
363
|
-
|
|
379
|
+
/** Compatibility schema for each API whose models accept compat. Mirrors the compat type of Model. */
|
|
380
|
+
export const CompatSchemasByApi = {
|
|
364
381
|
"openai-completions": OpenAICompletionsCompatSchema,
|
|
365
382
|
"openai-responses": OpenAIResponsesCompatSchema,
|
|
383
|
+
"azure-openai-responses": OpenAIResponsesCompatSchema,
|
|
384
|
+
"openai-codex-responses": OpenAIResponsesCompatSchema,
|
|
366
385
|
"anthropic-messages": AnthropicMessagesCompatSchema,
|
|
367
386
|
"bedrock-converse-stream": BedrockCompatSchema,
|
|
368
387
|
"mistral-conversations": MistralConversationsCompatSchema,
|
|
388
|
+
"typesafe-system-one": SystemOneCompatSchema,
|
|
389
|
+
"cloudflare-workers-ai-system-one": SystemOneCompatSchema,
|
|
369
390
|
};
|
|
370
|
-
const ProviderCompatProperties = mergeCompatProperties(Object.values(CompatSchemasByApi).map((schema) => schema.properties), ProviderCompatPropertyOverrides);
|
|
391
|
+
const ProviderCompatProperties = mergeCompatProperties([...new Set(Object.values(CompatSchemasByApi))].map((schema) => schema.properties), ProviderCompatPropertyOverrides);
|
|
371
392
|
export const ProviderCompatSchema = Type.Object(ProviderCompatProperties, {
|
|
372
393
|
description: "Provider and model compatibility overrides.",
|
|
373
394
|
additionalProperties: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-schema.js","sourceRoot":"","sources":["../../src/providers/compat-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,IAAI,EAAE,MAAM,SAAS,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,SAAS,qBAAqB,CAAC,OAAwB;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACpH,CAAC;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;IAChE,WAAW,EAAE,6EAA6E;CAC1F,CAAC,CAAC;AAEH,SAAS,wBAAwB,CAAC,OAAwB;IACzD,OAAO,IAAI,CAAC,KAAK,CAChB,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,EAChH,OAAO,CACP,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,wBAAwB,CAAC;IACtE,WAAW,EACV,gOAAgO;CACjO,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC,KAAK,CAAC;IACtD,IAAI,CAAC,MAAM,E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AAC;IACF,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,wEAAwE,IAAI,EAAE,CAAC,CAAC;QACjG,CAAC;IACF,CAAC;IAED,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,EAAuD,CAAC;AACzF,CAAC;AAED,MAAM,kBAAkB,GAAG;IAC1B,oBAAoB,EAAE,6BAA6B;IACnD,kBAAkB,EAAE,2BAA2B;IAC/C,oBAAoB,EAAE,6BAA6B;IACnD,yBAAyB,EAAE,mBAAmB;IAC9C,uBAAuB,EAAE,gCAAgC;CAChD,CAAC;AAEX,MAAM,wBAAwB,GAAG,qBAAqB,CACrD,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EACpE,+BAA+B,CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,wBAAwB,EAAE;IACzE,WAAW,EAAE,6CAA6C;IAC1D,oBAAoB,EAAE,IAAI;CAC1B,CAAC,CAAC","sourcesContent":["import { type Static, type TProperties, type TSchemaOptions, Type } from \"typebox\";\nimport { ModelCostSchema } from \"./model-schema.ts\";\n\nfunction sessionAffinityFormat(options?: TSchemaOptions) {\n\treturn Type.Union([Type.Literal(\"openai\"), Type.Literal(\"openai-nosession\"), Type.Literal(\"openrouter\")], options);\n}\n\nexport const SessionAffinityFormatSchema = sessionAffinityFormat({\n\tdescription: \"Session-affinity header format used to route related requests consistently.\",\n});\n\nfunction thinkingTokenBudgetField(options?: TSchemaOptions) {\n\treturn Type.Union(\n\t\t[Type.Literal(\"thinking_token_budget\"), Type.Literal(\"thinking_budget\"), Type.Literal(\"thinking_budget_tokens\")],\n\t\toptions,\n\t);\n}\n\nexport const ThinkingTokenBudgetFieldSchema = thinkingTokenBudgetField({\n\tdescription:\n\t\t'Top-level request field name used by OpenAI-compatible endpoints to cap reasoning tokens. \"thinking_token_budget\" is used by vLLM, \"thinking_budget\" by Qwen, DashScope, or SGLang, and \"thinking_budget_tokens\" by llama.cpp.',\n});\n\nexport const ChatTemplateKwargValueSchema = Type.Union([\n\tType.String(),\n\tType.Number(),\n\tType.Boolean(),\n\tType.Null(),\n\tType.Object({\n\t\t$var: Type.Union([\n\t\t\tType.Literal(\"thinking.enabled\"),\n\t\t\tType.Literal(\"thinking.effort\"),\n\t\t\tType.Literal(\"thinking.budget\"),\n\t\t]),\n\t\tomitWhenOff: Type.Optional(Type.Boolean()),\n\t}),\n]);\n\nfunction percentileCutoffs(metric: string) {\n\treturn Type.Object({\n\t\tp50: Type.Optional(Type.Number({ description: `${metric} at the 50th percentile.` })),\n\t\tp75: Type.Optional(Type.Number({ description: `${metric} at the 75th percentile.` })),\n\t\tp90: Type.Optional(Type.Number({ description: `${metric} at the 90th percentile.` })),\n\t\tp99: Type.Optional(Type.Number({ description: `${metric} at the 99th percentile.` })),\n\t});\n}\n\nexport const OpenRouterRoutingSchema = Type.Object(\n\t{\n\t\tallow_fallbacks: Type.Optional(\n\t\t\tType.Boolean({ description: \"Whether to allow backup providers to serve requests.\", default: true }),\n\t\t),\n\t\trequire_parameters: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether to filter providers to only those that support all parameters in the request.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tdata_collection: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t'Data collection setting. \"allow\": allow providers that may store or train on data. \"deny\": only use providers that do not collect user data.',\n\t\t\t\tdefault: \"allow\",\n\t\t\t}),\n\t\t),\n\t\tzdr: Type.Optional(\n\t\t\tType.Boolean({ description: \"Whether to restrict routing to only ZDR (Zero Data Retention) endpoints.\" }),\n\t\t),\n\t\tenforce_distillable_text: Type.Optional(\n\t\t\tType.Boolean({ description: \"Whether to restrict routing to only models that allow text distillation.\" }),\n\t\t),\n\t\torder: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"An ordered list of provider names or slugs to try in sequence, falling back to the next if unavailable.\",\n\t\t\t}),\n\t\t),\n\t\tonly: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"List of provider names or slugs to exclusively allow for this request.\",\n\t\t\t}),\n\t\t),\n\t\tignore: Type.Optional(\n\t\t\tType.Array(Type.String(), { description: \"List of provider names or slugs to skip for this request.\" }),\n\t\t),\n\t\tquantizations: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'A list of quantization levels to filter providers by, for example [\"fp16\", \"bf16\", \"fp8\", \"fp6\", \"int8\", \"int4\", \"fp4\", \"fp32\"].',\n\t\t\t}),\n\t\t),\n\t\tsort: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.String(),\n\t\t\t\t\tType.Object({\n\t\t\t\t\t\tby: Type.Optional(\n\t\t\t\t\t\t\tType.String({ description: 'The sorting metric, such as \"price\", \"throughput\", or \"latency\".' }),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpartition: Type.Optional(\n\t\t\t\t\t\t\tType.Union([Type.String(), Type.Null()], {\n\t\t\t\t\t\t\t\tdescription: 'Partitioning strategy: \"model\" or \"none\".',\n\t\t\t\t\t\t\t\tdefault: \"model\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Sorting strategy. Can be a string such as \"price\", \"throughput\", or \"latency\", or an object.',\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tmax_price: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tprompt: Type.Optional(\n\t\t\t\t\t\tType.Union([Type.Number(), Type.String()], { description: \"Price per million prompt tokens.\" }),\n\t\t\t\t\t),\n\t\t\t\t\tcompletion: Type.Optional(\n\t\t\t\t\t\tType.Union([Type.Number(), Type.String()], { description: \"Price per million completion tokens.\" }),\n\t\t\t\t\t),\n\t\t\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()], { description: \"Price per image.\" })),\n\t\t\t\t\taudio: Type.Optional(\n\t\t\t\t\t\tType.Union([Type.Number(), Type.String()], { description: \"Price per audio unit.\" }),\n\t\t\t\t\t),\n\t\t\t\t\trequest: Type.Optional(\n\t\t\t\t\t\tType.Union([Type.Number(), Type.String()], { description: \"Price per request.\" }),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{ description: \"Maximum price per million tokens in USD.\" },\n\t\t\t),\n\t\t),\n\t\tpreferred_min_throughput: Type.Optional(\n\t\t\tType.Union([Type.Number(), percentileCutoffs(\"Minimum tokens per second\")], {\n\t\t\t\tdescription: \"Preferred minimum throughput in tokens per second. A number applies to p50.\",\n\t\t\t}),\n\t\t),\n\t\tpreferred_max_latency: Type.Optional(\n\t\t\tType.Union([Type.Number(), percentileCutoffs(\"Maximum latency in seconds\")], {\n\t\t\t\tdescription: \"Preferred maximum latency in seconds. A number applies to p50.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"OpenRouter provider routing preferences. Controls which upstream providers OpenRouter routes requests to. Sent as the provider field in the OpenRouter API request body. See https://openrouter.ai/docs/guides/routing/provider-selection.\",\n\t},\n);\n\nexport const VercelGatewayRoutingSchema = Type.Object(\n\t{\n\t\tonly: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'List of provider slugs to exclusively use for this request, for example [\"bedrock\", \"anthropic\"].',\n\t\t\t}),\n\t\t),\n\t\torder: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: 'List of provider slugs to try in order, for example [\"anthropic\", \"openai\"].',\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Vercel AI Gateway routing preferences. Controls which upstream providers the gateway routes requests to. See https://vercel.com/docs/ai-gateway/models-and-providers/provider-options.\",\n\t},\n);\n\nexport const AnthropicAllowedFallbackModelSchema = Type.Object(\n\t{\n\t\tprovider: Type.String({ minLength: 1 }),\n\t\tmodel: Type.String({ minLength: 1 }),\n\t\tcost: ModelCostSchema,\n\t},\n\t{ description: \"An Anthropic server-side refusal fallback model with local pricing metadata.\" },\n);\n\nfunction optionalCompatBoolean(options?: TSchemaOptions) {\n\treturn Type.Optional(Type.Boolean(options));\n}\n\nfunction optionalSessionAffinityFormat(options?: TSchemaOptions) {\n\treturn Type.Optional(sessionAffinityFormat(options));\n}\n\nexport const OpenAICompletionsCompatSchema = Type.Object(\n\t{\n\t\tsupportsStore: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the provider supports the store field. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\tsupportsDeveloperRole: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the provider supports the developer role instead of system. Default: auto-detected from URL.\",\n\t\t}),\n\t\tsupportsReasoningEffort: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the provider supports reasoning_effort. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\tsupportsUsageInStreaming: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the provider supports stream_options.include_usage for token usage in streaming responses.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tsupportsFinishReason: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether streamed responses include finish_reason. When false, pi infers stop or toolUse when the stream ends.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tmaxTokensField: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")], {\n\t\t\t\tdescription: \"Which field to use for max tokens. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\trequiresToolResultName: Type.Optional(\n\t\t\tType.Boolean({ description: \"Whether tool results require the name field. Default: auto-detected from URL.\" }),\n\t\t),\n\t\trequiresAssistantAfterToolResult: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\trequiresThinkingAsText: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\trequiresReasoningContentOnAssistantMessages: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\tthinkingFormat: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.Literal(\"openai\"),\n\t\t\t\t\tType.Literal(\"openrouter\"),\n\t\t\t\t\tType.Literal(\"deepseek\"),\n\t\t\t\t\tType.Literal(\"together\"),\n\t\t\t\t\tType.Literal(\"baseten\"),\n\t\t\t\t\tType.Literal(\"zai\"),\n\t\t\t\t\tType.Literal(\"qwen\"),\n\t\t\t\t\tType.Literal(\"chat-template\"),\n\t\t\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t\t\t\tType.Literal(\"string-thinking\"),\n\t\t\t\t\tType.Literal(\"ant-ling\"),\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Format for reasoning or thinking parameters. When omitted, Pi auto-detects the format from the provider URL. \"openai\" uses reasoning_effort, \"openrouter\" uses reasoning.effort, \"deepseek\" uses thinking.type plus reasoning_effort when supported, \"together\" uses reasoning.enabled plus reasoning_effort when supported, \"baseten\" uses configurable chat_template_args plus reasoning_effort when supported, \"zai\" uses thinking.type, \"qwen\" uses top-level enable_thinking, \"qwen-chat-template\" uses chat_template_kwargs.enable_thinking and preserve_thinking, \"chat-template\" uses configurable chat_template_kwargs, \"string-thinking\" uses top-level thinking, and \"ant-ling\" uses reasoning.effort only when the mapped effort is non-null.',\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tchatTemplateKwargs: Type.Optional(\n\t\t\tType.Record(Type.String(), ChatTemplateKwargValueSchema, {\n\t\t\t\tdescription:\n\t\t\t\t\t'Kwargs sent as chat_template_kwargs when thinkingFormat is \"chat-template\". Use $var with \"thinking.enabled\", \"thinking.effort\", or \"thinking.budget\" for pi-controlled values.',\n\t\t\t}),\n\t\t),\n\t\tchatTemplateArgs: Type.Optional(\n\t\t\tType.Record(Type.String(), ChatTemplateKwargValueSchema, {\n\t\t\t\tdescription:\n\t\t\t\t\t'Arguments sent as chat_template_args when thinkingFormat is \"baseten\". Use $var with \"thinking.enabled\", \"thinking.effort\", or \"thinking.budget\" for pi-controlled values.',\n\t\t\t}),\n\t\t),\n\t\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\t\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\t\tzaiToolStream: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether z.ai supports top-level tool_stream for streaming tool call deltas.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tthinkingTokenBudgetField: Type.Optional(\n\t\t\tthinkingTokenBudgetField({\n\t\t\t\tdescription:\n\t\t\t\t\t'Top-level request field used to cap reasoning tokens from thinkingBudgets. Reasoning and the answer share max_tokens on these endpoints. \"thinking_token_budget\" is vLLM, \"thinking_budget\" is Qwen, DashScope, or SGLang, and \"thinking_budget_tokens\" is llama.cpp. Off by default and not set on the generated catalog.',\n\t\t\t}),\n\t\t),\n\t\tsupportsThinkingTokenBudget: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t'Alias for thinkingTokenBudgetField: \"thinking_token_budget\" (vLLM). Prefer thinkingTokenBudgetField.',\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsOpenAIGrammarTools: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the provider supports OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsupportsMidConvoToolAdditions: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether system messages can introduce additional tools mid-conversation. Requires supportsMidConvoSystemMessages. The generated catalog enables this for capable models.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsStrictMode: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the provider supports the strict field in tool definitions. Generated capable models enable it explicitly.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tcacheControlFormat: Type.Optional(\n\t\t\tType.Literal(\"anthropic\", {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Cache control convention for prompt caching. Anthropic applies cache_control markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content.\",\n\t\t\t}),\n\t\t),\n\t\tsendSessionAffinityHeaders: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether to send session-affinity data from options.sessionId. Default: true for OpenRouter endpoints, false otherwise.\",\n\t\t}),\n\t\tsessionAffinityFormat: optionalSessionAffinityFormat({\n\t\t\tdescription:\n\t\t\t\t\"Session-affinity header format. openai sends session_id, x-client-request-id, and x-session-affinity; openai-nosession sends x-client-request-id and x-session-affinity; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected.\",\n\t\t}),\n\t\tsupportsLongCacheRetention: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t'Whether the provider supports long prompt cache retention (prompt_cache_retention: \"24h\" or Anthropic-style cache_control.ttl: \"1h\", depending on format). Default: auto-detected from provider and URL.',\n\t\t}),\n\t\tvllmPriority: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription:\n\t\t\t\t\t\"vLLM scheduler priority sent as the top-level priority request field. Lower values are handled earlier and the server default is 0. Only meaningful with --scheduling-policy priority. Off by default and not set on the generated catalog.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Compatibility settings for OpenAI-compatible completions APIs. Use this to override URL-based auto-detection for custom providers.\",\n\t\tadditionalProperties: true,\n\t},\n);\n\nexport const OpenAIResponsesCompatSchema = Type.Object(\n\t{\n\t\tsupportsDeveloperRole: optionalCompatBoolean({\n\t\t\tdescription: \"Whether the provider supports the developer role instead of system.\",\n\t\t\tdefault: true,\n\t\t}),\n\t\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the exact model accepts developer or system messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsessionAffinityFormat: optionalSessionAffinityFormat({\n\t\t\tdescription:\n\t\t\t\t\"Session-affinity header format. openai sends session_id and x-client-request-id; openai-nosession sends x-client-request-id; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected.\",\n\t\t}),\n\t\tsupportsLongCacheRetention: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t'Whether the provider supports long prompt cache retention. This uses prompt_cache_options.ttl: \"30m\" on GPT-5.6+ and prompt_cache_retention: \"24h\" on earlier models.',\n\t\t\tdefault: true,\n\t\t}),\n\t\tsupportsStrictMode: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly.\",\n\t\t}),\n\t\tsupportsOpenAIGrammarTools: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether to emit OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsupportsAdditionalTools: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the model supports message-anchored additional_tools input items.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsToolSearch: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the model supports client-executed tool search for transcript-anchored additions.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsExplicitPromptCacheMode: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the model accepts prompt_cache_options. Older OpenAI models reject the parameter.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsMaxOutputTokens: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the provider accepts max_output_tokens. Some Codex-protocol gateways reject it.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t},\n\t{ description: \"Compatibility settings for OpenAI Responses APIs.\", additionalProperties: true },\n);\n\nexport const AnthropicMessagesCompatSchema = Type.Object(\n\t{\n\t\tsupportsEagerToolInputStreaming: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the provider accepts per-tool eager_input_streaming. When false, the Anthropic provider omits tools[].eager_input_streaming and sends the legacy fine-grained-tool-streaming-2025-05-14 beta header for tool-enabled requests.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tsupportsLongCacheRetention: optionalCompatBoolean({\n\t\t\tdescription: \"Whether the provider supports Anthropic long cache retention through cache_control.ttl.\",\n\t\t\tdefault: true,\n\t\t}),\n\t\tsendSessionAffinityHeaders: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether to send x-session-affinity from options.sessionId when caching is enabled. Required for providers like Fireworks that use session affinity for prompt cache routing; requests to the same replica maximize cache hits. Default: true for OpenRouter endpoints, false otherwise.\",\n\t\t}),\n\t\tsessionAffinityFormat: Type.Optional(\n\t\t\tType.Literal(\"openrouter\", {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Session-affinity format. openrouter sends x-session-id; when unset, sends x-session-affinity.\",\n\t\t\t}),\n\t\t),\n\t\tsupportsCacheControlOnTools: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the provider supports Anthropic-style cache_control markers on tool definitions. When false, cache_control is omitted from tool parameters. Some Anthropic-compatible providers, such as Fireworks, do not support this field on tools and may reject or ignore it.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tsupportsTemperature: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the model accepts the Anthropic temperature request field. Claude Opus 4.7+ rejects non-default values.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tforceAdaptiveThinking: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether to force adaptive thinking (thinking.type: adaptive plus output_config.effort) regardless of model ID. Built-in models that require adaptive thinking set this in generated metadata. Custom Anthropic-compatible providers can set this to true for any model whose upstream requires the adaptive format. Set false to opt out on overridden built-in models.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tallowEmptySignature: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether to replay empty thinking signatures instead of converting thinking to text.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsStrictTools: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the provider supports Anthropic strict tool schemas. Generated Anthropic models enable it explicitly.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsMidConvoEffort: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the exact model transport supports effort-only system messages and thinking binding controls.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsupportsMidConvoToolChanges: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the exact model accepts mid-conversation tool_addition and tool_removal blocks. Requires supportsMidConvoSystemMessages.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tallowedFallbackModels: Type.Optional(\n\t\t\tType.Array(AnthropicAllowedFallbackModelSchema, {\n\t\t\t\tmaxItems: 3,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Models Anthropic accepts for server-side refusal fallback, with local pricing metadata for returned fallback responses. When absent or empty, callers must omit fallbacks; Anthropic rejects the field for models with no permitted fallback targets.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ description: \"Compatibility settings for Anthropic Messages-compatible APIs.\", additionalProperties: true },\n);\n\nexport const BedrockCompatSchema = Type.Object(\n\t{\n\t\tsupportsStrictMode: optionalCompatBoolean({\n\t\t\tdescription: \"Whether the model supports Bedrock strict tool schemas.\",\n\t\t\tdefault: false,\n\t\t}),\n\t},\n\t{ description: \"Compatibility settings for Amazon Bedrock models.\", additionalProperties: true },\n);\n\nexport const MistralConversationsCompatSchema = Type.Object(\n\t{\n\t\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the exact model accepts system messages after the conversation has started. When false, later system messages are folded into the leading system message.\",\n\t\t\tdefault: false,\n\t\t}),\n\t},\n\t{ description: \"Compatibility settings for the Mistral chat API.\", additionalProperties: true },\n);\n\nconst ProviderCompatPropertyOverrides = {\n\tsupportsDeveloperRole: optionalCompatBoolean({\n\t\tdescription: \"Whether the provider supports the developer role instead of system. Defaults are API-specific.\",\n\t}),\n\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\tdescription:\n\t\t\t\"Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message.\",\n\t\tdefault: false,\n\t}),\n\tsessionAffinityFormat: optionalSessionAffinityFormat({\n\t\tdescription: \"Session-affinity header format. Defaults are API-specific or auto-detected.\",\n\t}),\n\tsupportsLongCacheRetention: optionalCompatBoolean({\n\t\tdescription:\n\t\t\t\"Whether the provider supports long prompt cache retention. Defaults are API-specific or auto-detected.\",\n\t}),\n\tsupportsStrictMode: optionalCompatBoolean({\n\t\tdescription: \"Whether the provider supports strict tool schemas. Defaults are API-specific.\",\n\t}),\n\tsupportsOpenAIGrammarTools: optionalCompatBoolean({\n\t\tdescription:\n\t\t\t\"Whether the provider supports OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools.\",\n\t\tdefault: false,\n\t}),\n\tsendSessionAffinityHeaders: optionalCompatBoolean({\n\t\tdescription: \"Whether to send session-affinity data from options.sessionId. Defaults are API-specific.\",\n\t}),\n} satisfies TProperties;\n\ntype UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends (\n\tvalue: infer Intersection,\n) => void\n\t? Intersection\n\t: never;\n\ntype MergedCompatProperties<PropertyGroups extends readonly TProperties[], Overrides extends TProperties> = Omit<\n\tUnionToIntersection<PropertyGroups[number]>,\n\tkeyof Overrides\n> &\n\tOverrides;\n\n/**\n * Provider-level models.json compatibility is API-agnostic, so it needs one superset. Every\n * duplicate property requires explicit generic metadata, while API-specific schemas retain their\n * own defaults and descriptions.\n */\nfunction mergeCompatProperties<\n\tconst PropertyGroups extends readonly TProperties[],\n\tconst Overrides extends TProperties,\n>(propertyGroups: PropertyGroups, overrides: Overrides): MergedCompatProperties<PropertyGroups, Overrides> {\n\tconst merged: TProperties = {};\n\tconst duplicateNames = new Set<string>();\n\n\tfor (const properties of propertyGroups) {\n\t\tfor (const [name, schema] of Object.entries(properties)) {\n\t\t\tif (merged[name] !== undefined) {\n\t\t\t\tduplicateNames.add(name);\n\t\t\t\tif (!(name in overrides)) {\n\t\t\t\t\tthrow new Error(`Duplicate compatibility schema property requires an override: ${name}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmerged[name] = schema;\n\t\t}\n\t}\n\n\tfor (const name of Object.keys(overrides)) {\n\t\tif (!duplicateNames.has(name)) {\n\t\t\tthrow new Error(`Compatibility schema override does not resolve a duplicate property: ${name}`);\n\t\t}\n\t}\n\n\treturn { ...merged, ...overrides } as MergedCompatProperties<PropertyGroups, Overrides>;\n}\n\nconst CompatSchemasByApi = {\n\t\"openai-completions\": OpenAICompletionsCompatSchema,\n\t\"openai-responses\": OpenAIResponsesCompatSchema,\n\t\"anthropic-messages\": AnthropicMessagesCompatSchema,\n\t\"bedrock-converse-stream\": BedrockCompatSchema,\n\t\"mistral-conversations\": MistralConversationsCompatSchema,\n} as const;\n\nconst ProviderCompatProperties = mergeCompatProperties(\n\tObject.values(CompatSchemasByApi).map((schema) => schema.properties),\n\tProviderCompatPropertyOverrides,\n);\n\nexport const ProviderCompatSchema = Type.Object(ProviderCompatProperties, {\n\tdescription: \"Provider and model compatibility overrides.\",\n\tadditionalProperties: true,\n});\n\nexport type ChatTemplateKwargValue = Static<typeof ChatTemplateKwargValueSchema>;\n/** Top-level request field used to cap reasoning tokens on OpenAI-compatible servers. */\nexport type ThinkingTokenBudgetField = Static<typeof ThinkingTokenBudgetFieldSchema>;\nexport type SessionAffinityFormat = Static<typeof SessionAffinityFormatSchema>;\n/** OpenRouter provider routing preferences. */\nexport interface OpenRouterRouting extends Static<typeof OpenRouterRoutingSchema> {}\n/** Vercel AI Gateway routing preferences. */\nexport interface VercelGatewayRouting extends Static<typeof VercelGatewayRoutingSchema> {}\n/** An Anthropic server-side refusal fallback model with local pricing metadata. */\nexport interface AnthropicAllowedFallbackModel extends Static<typeof AnthropicAllowedFallbackModelSchema> {}\n\n/** Compatibility settings for OpenAI-compatible completions APIs. */\nexport interface OpenAICompletionsCompat extends Static<typeof OpenAICompletionsCompatSchema> {}\n/** Compatibility settings for OpenAI Responses APIs. */\nexport interface OpenAIResponsesCompat extends Static<typeof OpenAIResponsesCompatSchema> {}\n/** Compatibility settings for Anthropic Messages-compatible APIs. */\nexport interface AnthropicMessagesCompat extends Static<typeof AnthropicMessagesCompatSchema> {}\n/** Compatibility settings for Amazon Bedrock models. */\nexport interface BedrockCompat extends Static<typeof BedrockCompatSchema> {}\n/** Compatibility settings for the Mistral chat API. */\nexport interface MistralConversationsCompat extends Static<typeof MistralConversationsCompatSchema> {}\n"]}
|
|
1
|
+
{"version":3,"file":"compat-schema.js","sourceRoot":"","sources":["../../src/providers/compat-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,IAAI,EAAE,MAAM,SAAS,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,SAAS,qBAAqB,CAAC,OAAwB;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACpH,CAAC;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;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AAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,wEAAwE,IAAI,EAAE,CAAC,CAAC;QACjG,CAAC;IACF,CAAC;IAED,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,EAAuD,CAAC;AACzF,CAAC;AAED,sGAAsG;AACtG,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,oBAAoB,EAAE,6BAA6B;IACnD,kBAAkB,EAAE,2BAA2B;IAC/C,wBAAwB,EAAE,2BAA2B;IACrD,wBAAwB,EAAE,2BAA2B;IACrD,oBAAoB,EAAE,6BAA6B;IACnD,yBAAyB,EAAE,mBAAmB;IAC9C,uBAAuB,EAAE,gCAAgC;IACzD,qBAAqB,EAAE,qBAAqB;IAC5C,kCAAkC,EAAE,qBAAqB;CAChD,CAAC;AAEX,MAAM,wBAAwB,GAAG,qBAAqB,CACrD,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAClF,+BAA+B,CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,wBAAwB,EAAE;IACzE,WAAW,EAAE,6CAA6C;IAC1D,oBAAoB,EAAE,IAAI;CAC1B,CAAC,CAAC","sourcesContent":["import { type Static, type TProperties, type TSchemaOptions, Type } from \"typebox\";\nimport { ModelCostSchema } from \"./model-schema.ts\";\n\nfunction sessionAffinityFormat(options?: TSchemaOptions) {\n\treturn Type.Union([Type.Literal(\"openai\"), Type.Literal(\"openai-nosession\"), Type.Literal(\"openrouter\")], options);\n}\n\nexport const SessionAffinityFormatSchema = sessionAffinityFormat({\n\tdescription: \"Session-affinity header format used to route related requests consistently.\",\n});\n\nfunction thinkingTokenBudgetField(options?: TSchemaOptions) {\n\treturn Type.Union(\n\t\t[Type.Literal(\"thinking_token_budget\"), Type.Literal(\"thinking_budget\"), Type.Literal(\"thinking_budget_tokens\")],\n\t\toptions,\n\t);\n}\n\nexport const ThinkingTokenBudgetFieldSchema = thinkingTokenBudgetField({\n\tdescription:\n\t\t'Top-level request field name used by OpenAI-compatible endpoints to cap reasoning tokens. \"thinking_token_budget\" is used by vLLM, \"thinking_budget\" by Qwen, DashScope, or SGLang, and \"thinking_budget_tokens\" by llama.cpp.',\n});\n\nexport const ChatTemplateKwargValueSchema = Type.Union([\n\tType.String(),\n\tType.Number(),\n\tType.Boolean(),\n\tType.Null(),\n\tType.Object({\n\t\t$var: Type.Union([\n\t\t\tType.Literal(\"thinking.enabled\"),\n\t\t\tType.Literal(\"thinking.effort\"),\n\t\t\tType.Literal(\"thinking.budget\"),\n\t\t]),\n\t\tomitWhenOff: Type.Optional(Type.Boolean()),\n\t}),\n]);\n\nfunction percentileCutoffs(metric: string) {\n\treturn Type.Object({\n\t\tp50: Type.Optional(Type.Number({ description: `${metric} at the 50th percentile.` })),\n\t\tp75: Type.Optional(Type.Number({ description: `${metric} at the 75th percentile.` })),\n\t\tp90: Type.Optional(Type.Number({ description: `${metric} at the 90th percentile.` })),\n\t\tp99: Type.Optional(Type.Number({ description: `${metric} at the 99th percentile.` })),\n\t});\n}\n\nexport const OpenRouterRoutingSchema = Type.Object(\n\t{\n\t\tallow_fallbacks: Type.Optional(\n\t\t\tType.Boolean({ description: \"Whether to allow backup providers to serve requests.\", default: true }),\n\t\t),\n\t\trequire_parameters: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether to filter providers to only those that support all parameters in the request.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tdata_collection: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t'Data collection setting. \"allow\": allow providers that may store or train on data. \"deny\": only use providers that do not collect user data.',\n\t\t\t\tdefault: \"allow\",\n\t\t\t}),\n\t\t),\n\t\tzdr: Type.Optional(\n\t\t\tType.Boolean({ description: \"Whether to restrict routing to only ZDR (Zero Data Retention) endpoints.\" }),\n\t\t),\n\t\tenforce_distillable_text: Type.Optional(\n\t\t\tType.Boolean({ description: \"Whether to restrict routing to only models that allow text distillation.\" }),\n\t\t),\n\t\torder: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"An ordered list of provider names or slugs to try in sequence, falling back to the next if unavailable.\",\n\t\t\t}),\n\t\t),\n\t\tonly: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"List of provider names or slugs to exclusively allow for this request.\",\n\t\t\t}),\n\t\t),\n\t\tignore: Type.Optional(\n\t\t\tType.Array(Type.String(), { description: \"List of provider names or slugs to skip for this request.\" }),\n\t\t),\n\t\tquantizations: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'A list of quantization levels to filter providers by, for example [\"fp16\", \"bf16\", \"fp8\", \"fp6\", \"int8\", \"int4\", \"fp4\", \"fp32\"].',\n\t\t\t}),\n\t\t),\n\t\tsort: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.String(),\n\t\t\t\t\tType.Object({\n\t\t\t\t\t\tby: Type.Optional(\n\t\t\t\t\t\t\tType.String({ description: 'The sorting metric, such as \"price\", \"throughput\", or \"latency\".' }),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpartition: Type.Optional(\n\t\t\t\t\t\t\tType.Union([Type.String(), Type.Null()], {\n\t\t\t\t\t\t\t\tdescription: 'Partitioning strategy: \"model\" or \"none\".',\n\t\t\t\t\t\t\t\tdefault: \"model\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Sorting strategy. Can be a string such as \"price\", \"throughput\", or \"latency\", or an object.',\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tmax_price: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tprompt: Type.Optional(\n\t\t\t\t\t\tType.Union([Type.Number(), Type.String()], { description: \"Price per million prompt tokens.\" }),\n\t\t\t\t\t),\n\t\t\t\t\tcompletion: Type.Optional(\n\t\t\t\t\t\tType.Union([Type.Number(), Type.String()], { description: \"Price per million completion tokens.\" }),\n\t\t\t\t\t),\n\t\t\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()], { description: \"Price per image.\" })),\n\t\t\t\t\taudio: Type.Optional(\n\t\t\t\t\t\tType.Union([Type.Number(), Type.String()], { description: \"Price per audio unit.\" }),\n\t\t\t\t\t),\n\t\t\t\t\trequest: Type.Optional(\n\t\t\t\t\t\tType.Union([Type.Number(), Type.String()], { description: \"Price per request.\" }),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{ description: \"Maximum price per million tokens in USD.\" },\n\t\t\t),\n\t\t),\n\t\tpreferred_min_throughput: Type.Optional(\n\t\t\tType.Union([Type.Number(), percentileCutoffs(\"Minimum tokens per second\")], {\n\t\t\t\tdescription: \"Preferred minimum throughput in tokens per second. A number applies to p50.\",\n\t\t\t}),\n\t\t),\n\t\tpreferred_max_latency: Type.Optional(\n\t\t\tType.Union([Type.Number(), percentileCutoffs(\"Maximum latency in seconds\")], {\n\t\t\t\tdescription: \"Preferred maximum latency in seconds. A number applies to p50.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"OpenRouter provider routing preferences. Controls which upstream providers OpenRouter routes requests to. Sent as the provider field in the OpenRouter API request body. See https://openrouter.ai/docs/guides/routing/provider-selection.\",\n\t},\n);\n\nexport const VercelGatewayRoutingSchema = Type.Object(\n\t{\n\t\tonly: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'List of provider slugs to exclusively use for this request, for example [\"bedrock\", \"anthropic\"].',\n\t\t\t}),\n\t\t),\n\t\torder: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: 'List of provider slugs to try in order, for example [\"anthropic\", \"openai\"].',\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Vercel AI Gateway routing preferences. Controls which upstream providers the gateway routes requests to. See https://vercel.com/docs/ai-gateway/models-and-providers/provider-options.\",\n\t},\n);\n\nexport const AnthropicAllowedFallbackModelSchema = Type.Object(\n\t{\n\t\tprovider: Type.String({ minLength: 1 }),\n\t\tmodel: Type.String({ minLength: 1 }),\n\t\tcost: ModelCostSchema,\n\t},\n\t{ description: \"An Anthropic server-side refusal fallback model with local pricing metadata.\" },\n);\n\nfunction optionalCompatBoolean(options?: TSchemaOptions) {\n\treturn Type.Optional(Type.Boolean(options));\n}\n\nfunction optionalSessionAffinityFormat(options?: TSchemaOptions) {\n\treturn Type.Optional(sessionAffinityFormat(options));\n}\n\nexport const OpenAICompletionsCompatSchema = Type.Object(\n\t{\n\t\tsupportsStore: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the provider supports the store field. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\tsupportsDeveloperRole: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the provider supports the developer role instead of system. Default: auto-detected from URL.\",\n\t\t}),\n\t\tsupportsReasoningEffort: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the provider supports reasoning_effort. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\tsupportsUsageInStreaming: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the provider supports stream_options.include_usage for token usage in streaming responses.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tsupportsFinishReason: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether streamed responses include finish_reason. When false, pi infers stop or toolUse when the stream ends.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tmaxTokensField: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")], {\n\t\t\t\tdescription: \"Which field to use for max tokens. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\trequiresToolResultName: Type.Optional(\n\t\t\tType.Boolean({ description: \"Whether tool results require the name field. Default: auto-detected from URL.\" }),\n\t\t),\n\t\trequiresAssistantAfterToolResult: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\trequiresThinkingAsText: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\trequiresReasoningContentOnAssistantMessages: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL.\",\n\t\t\t}),\n\t\t),\n\t\tthinkingFormat: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.Literal(\"openai\"),\n\t\t\t\t\tType.Literal(\"openrouter\"),\n\t\t\t\t\tType.Literal(\"deepseek\"),\n\t\t\t\t\tType.Literal(\"together\"),\n\t\t\t\t\tType.Literal(\"baseten\"),\n\t\t\t\t\tType.Literal(\"zai\"),\n\t\t\t\t\tType.Literal(\"qwen\"),\n\t\t\t\t\tType.Literal(\"chat-template\"),\n\t\t\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t\t\t\tType.Literal(\"string-thinking\"),\n\t\t\t\t\tType.Literal(\"ant-ling\"),\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Format for reasoning or thinking parameters. When omitted, Pi auto-detects the format from the provider URL. \"openai\" uses reasoning_effort, \"openrouter\" uses reasoning.effort, \"deepseek\" uses thinking.type plus reasoning_effort when supported, \"together\" uses reasoning.enabled plus reasoning_effort when supported, \"baseten\" uses configurable chat_template_args plus reasoning_effort when supported, \"zai\" uses thinking.type, \"qwen\" uses top-level enable_thinking, \"qwen-chat-template\" uses chat_template_kwargs.enable_thinking and preserve_thinking, \"chat-template\" uses configurable chat_template_kwargs, \"string-thinking\" uses top-level thinking, and \"ant-ling\" uses reasoning.effort only when the mapped effort is non-null.',\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tchatTemplateKwargs: Type.Optional(\n\t\t\tType.Record(Type.String(), ChatTemplateKwargValueSchema, {\n\t\t\t\tdescription:\n\t\t\t\t\t'Kwargs sent as chat_template_kwargs when thinkingFormat is \"chat-template\". Use $var with \"thinking.enabled\", \"thinking.effort\", or \"thinking.budget\" for pi-controlled values.',\n\t\t\t}),\n\t\t),\n\t\tchatTemplateArgs: Type.Optional(\n\t\t\tType.Record(Type.String(), ChatTemplateKwargValueSchema, {\n\t\t\t\tdescription:\n\t\t\t\t\t'Arguments sent as chat_template_args when thinkingFormat is \"baseten\". Use $var with \"thinking.enabled\", \"thinking.effort\", or \"thinking.budget\" for pi-controlled values.',\n\t\t\t}),\n\t\t),\n\t\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\t\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\t\tzaiToolStream: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether z.ai supports top-level tool_stream for streaming tool call deltas.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tthinkingTokenBudgetField: Type.Optional(\n\t\t\tthinkingTokenBudgetField({\n\t\t\t\tdescription:\n\t\t\t\t\t'Top-level request field used to cap reasoning tokens from thinkingBudgets. Reasoning and the answer share max_tokens on these endpoints. \"thinking_token_budget\" is vLLM, \"thinking_budget\" is Qwen, DashScope, or SGLang, and \"thinking_budget_tokens\" is llama.cpp. Off by default and not set on the generated catalog.',\n\t\t\t}),\n\t\t),\n\t\tsupportsThinkingTokenBudget: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t'Alias for thinkingTokenBudgetField: \"thinking_token_budget\" (vLLM). Prefer thinkingTokenBudgetField.',\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsOpenAIGrammarTools: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the provider supports OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsupportsMidConvoToolAdditions: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether system messages can introduce additional tools mid-conversation. Requires supportsMidConvoSystemMessages. The generated catalog enables this for capable models.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsStrictMode: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the provider supports the strict field in tool definitions. Generated capable models enable it explicitly.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tcacheControlFormat: Type.Optional(\n\t\t\tType.Literal(\"anthropic\", {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Cache control convention for prompt caching. Anthropic applies cache_control markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content.\",\n\t\t\t}),\n\t\t),\n\t\tsendSessionAffinityHeaders: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether to send session-affinity data from options.sessionId. Default: true for OpenRouter endpoints, false otherwise.\",\n\t\t}),\n\t\tsessionAffinityFormat: optionalSessionAffinityFormat({\n\t\t\tdescription:\n\t\t\t\t\"Session-affinity header format. openai sends session_id, x-client-request-id, and x-session-affinity; openai-nosession sends x-client-request-id and x-session-affinity; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected.\",\n\t\t}),\n\t\tsupportsLongCacheRetention: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t'Whether the provider supports long prompt cache retention (prompt_cache_retention: \"24h\" or Anthropic-style cache_control.ttl: \"1h\", depending on format). Default: auto-detected from provider and URL.',\n\t\t}),\n\t\tvllmPriority: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription:\n\t\t\t\t\t\"vLLM scheduler priority sent as the top-level priority request field. Lower values are handled earlier and the server default is 0. Only meaningful with --scheduling-policy priority. Off by default and not set on the generated catalog.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Compatibility settings for OpenAI-compatible completions APIs. Use this to override URL-based auto-detection for custom providers.\",\n\t\tadditionalProperties: true,\n\t},\n);\n\nexport const OpenAIResponsesCompatSchema = Type.Object(\n\t{\n\t\tsupportsDeveloperRole: optionalCompatBoolean({\n\t\t\tdescription: \"Whether the provider supports the developer role instead of system.\",\n\t\t\tdefault: true,\n\t\t}),\n\t\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the exact model accepts developer or system messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsessionAffinityFormat: optionalSessionAffinityFormat({\n\t\t\tdescription:\n\t\t\t\t\"Session-affinity header format. openai sends session_id and x-client-request-id; openai-nosession sends x-client-request-id; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected.\",\n\t\t}),\n\t\tsupportsLongCacheRetention: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t'Whether the provider supports long prompt cache retention. This uses prompt_cache_options.ttl: \"30m\" on GPT-5.6+ and prompt_cache_retention: \"24h\" on earlier models.',\n\t\t\tdefault: true,\n\t\t}),\n\t\tsupportsStrictMode: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly.\",\n\t\t}),\n\t\tsupportsOpenAIGrammarTools: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether to emit OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsupportsAdditionalTools: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the model supports message-anchored additional_tools input items.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsToolSearch: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the model supports client-executed tool search for transcript-anchored additions.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsExplicitPromptCacheMode: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the model accepts prompt_cache_options. Older OpenAI models reject the parameter.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsMidConvoEffort: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether thinking level changes are sent as configuration_update input items instead of changing reasoning.effort, so a change keeps the prompt cache. Only used by the openai-responses API, and ignored with Sign in with ChatGPT on the openai provider.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsMaxOutputTokens: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether the provider accepts max_output_tokens. Some Codex-protocol gateways reject it.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t},\n\t{ description: \"Compatibility settings for OpenAI Responses APIs.\", additionalProperties: true },\n);\n\nexport const AnthropicMessagesCompatSchema = Type.Object(\n\t{\n\t\tsupportsEagerToolInputStreaming: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the provider accepts per-tool eager_input_streaming. When false, the Anthropic provider omits tools[].eager_input_streaming and sends the legacy fine-grained-tool-streaming-2025-05-14 beta header for tool-enabled requests.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tsupportsLongCacheRetention: optionalCompatBoolean({\n\t\t\tdescription: \"Whether the provider supports Anthropic long cache retention through cache_control.ttl.\",\n\t\t\tdefault: true,\n\t\t}),\n\t\tsendSessionAffinityHeaders: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether to send x-session-affinity from options.sessionId when caching is enabled. Required for providers like Fireworks that use session affinity for prompt cache routing; requests to the same replica maximize cache hits. Default: true for OpenRouter endpoints, false otherwise.\",\n\t\t}),\n\t\tsessionAffinityFormat: Type.Optional(\n\t\t\tType.Literal(\"openrouter\", {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Session-affinity format. openrouter sends x-session-id; when unset, sends x-session-affinity.\",\n\t\t\t}),\n\t\t),\n\t\tsupportsCacheControlOnTools: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the provider supports Anthropic-style cache_control markers on tool definitions. When false, cache_control is omitted from tool parameters. Some Anthropic-compatible providers, such as Fireworks, do not support this field on tools and may reject or ignore it.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tsupportsTemperature: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the model accepts the Anthropic temperature request field. Claude Opus 4.7+ rejects non-default values.\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\tforceAdaptiveThinking: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether to force adaptive thinking (thinking.type: adaptive plus output_config.effort) regardless of model ID. Built-in models that require adaptive thinking set this in generated metadata. Custom Anthropic-compatible providers can set this to true for any model whose upstream requires the adaptive format. Set false to opt out on overridden built-in models.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tallowEmptySignature: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Whether to replay empty thinking signatures instead of converting thinking to text.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsStrictTools: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the provider supports Anthropic strict tool schemas. Generated Anthropic models enable it explicitly.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsMidConvoEffort: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the exact model transport supports effort-only system messages and thinking binding controls.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt.\",\n\t\t\tdefault: false,\n\t\t}),\n\t\tsupportsMidConvoToolChanges: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Whether the exact model accepts mid-conversation tool_addition and tool_removal blocks. Requires supportsMidConvoSystemMessages.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tallowedFallbackModels: Type.Optional(\n\t\t\tType.Array(AnthropicAllowedFallbackModelSchema, {\n\t\t\t\tmaxItems: 3,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Models Anthropic accepts for server-side refusal fallback, with local pricing metadata for returned fallback responses. When absent or empty, callers must omit fallbacks; Anthropic rejects the field for models with no permitted fallback targets.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ description: \"Compatibility settings for Anthropic Messages-compatible APIs.\", additionalProperties: true },\n);\n\nexport const BedrockCompatSchema = Type.Object(\n\t{\n\t\tsupportsStrictMode: optionalCompatBoolean({\n\t\t\tdescription: \"Whether the model supports Bedrock strict tool schemas.\",\n\t\t\tdefault: false,\n\t\t}),\n\t},\n\t{ description: \"Compatibility settings for Amazon Bedrock models.\", additionalProperties: true },\n);\n\nexport const MistralConversationsCompatSchema = Type.Object(\n\t{\n\t\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether the exact model accepts system messages after the conversation has started. When false, later system messages are folded into the leading system message.\",\n\t\t\tdefault: false,\n\t\t}),\n\t},\n\t{ description: \"Compatibility settings for the Mistral chat API.\", additionalProperties: true },\n);\n\nexport const SystemOneCompatSchema = Type.Object(\n\t{\n\t\timageInput: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"assets\"), Type.Literal(\"images\"), Type.Literal(\"state-image-urls\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t'How the service takes classifier images. \"assets\" sends TypeSafe\\'s assets map (PNG and JPEG) and references the images from the state, as TypeSafe and Jev on Workers AI expect. \"images\" sends Clef\\'s images list of data URLs (PNG, JPEG, and WebP, at most four), as Clef on Workers AI expects. \"state-image-urls\" places image_url parts before the state, as OpenRouter expects; OpenRouter drops assets without an error. Auto-detected from the provider, baseUrl, and model ID. Classifier models read it from the provider-level compat; models and modelOverrides entries apply to chat models only.',\n\t\t\t}),\n\t\t),\n\t\tsendImageOptInHeader: optionalCompatBoolean({\n\t\t\tdescription:\n\t\t\t\t\"Whether requests with images send the TypeSafe-Danger-Zone-Images: true header, which TypeSafe's own API requires for its experimental image input. Defaults to true for the typesafe-system-one API unless the model is detected as OpenRouter.\",\n\t\t}),\n\t},\n\t{ description: \"Compatibility settings for System One classifier APIs.\", additionalProperties: true },\n);\n\nconst ProviderCompatPropertyOverrides = {\n\tsupportsDeveloperRole: optionalCompatBoolean({\n\t\tdescription: \"Whether the provider supports the developer role instead of system. Defaults are API-specific.\",\n\t}),\n\tsupportsMidConvoSystemMessages: optionalCompatBoolean({\n\t\tdescription:\n\t\t\t\"Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message.\",\n\t\tdefault: false,\n\t}),\n\tsessionAffinityFormat: optionalSessionAffinityFormat({\n\t\tdescription: \"Session-affinity header format. Defaults are API-specific or auto-detected.\",\n\t}),\n\tsupportsMidConvoEffort: optionalCompatBoolean({\n\t\tdescription:\n\t\t\t\"Whether thinking level changes are sent inside the conversation instead of changing the request's effort, so a change keeps the prompt cache. Used by the anthropic-messages and openai-responses APIs.\",\n\t\tdefault: false,\n\t}),\n\tsupportsLongCacheRetention: optionalCompatBoolean({\n\t\tdescription:\n\t\t\t\"Whether the provider supports long prompt cache retention. Defaults are API-specific or auto-detected.\",\n\t}),\n\tsupportsStrictMode: optionalCompatBoolean({\n\t\tdescription: \"Whether the provider supports strict tool schemas. Defaults are API-specific.\",\n\t}),\n\tsupportsOpenAIGrammarTools: optionalCompatBoolean({\n\t\tdescription:\n\t\t\t\"Whether the provider supports OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools.\",\n\t\tdefault: false,\n\t}),\n\tsendSessionAffinityHeaders: optionalCompatBoolean({\n\t\tdescription: \"Whether to send session-affinity data from options.sessionId. Defaults are API-specific.\",\n\t}),\n} satisfies TProperties;\n\ntype UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends (\n\tvalue: infer Intersection,\n) => void\n\t? Intersection\n\t: never;\n\ntype MergedCompatProperties<PropertyGroups extends readonly TProperties[], Overrides extends TProperties> = Omit<\n\tUnionToIntersection<PropertyGroups[number]>,\n\tkeyof Overrides\n> &\n\tOverrides;\n\n/**\n * Provider-level models.json compatibility is API-agnostic, so it needs one superset. Every\n * duplicate property requires explicit generic metadata, while API-specific schemas retain their\n * own defaults and descriptions.\n */\nfunction mergeCompatProperties<\n\tconst PropertyGroups extends readonly TProperties[],\n\tconst Overrides extends TProperties,\n>(propertyGroups: PropertyGroups, overrides: Overrides): MergedCompatProperties<PropertyGroups, Overrides> {\n\tconst merged: TProperties = {};\n\tconst duplicateNames = new Set<string>();\n\n\tfor (const properties of propertyGroups) {\n\t\tfor (const [name, schema] of Object.entries(properties)) {\n\t\t\tif (merged[name] !== undefined) {\n\t\t\t\tduplicateNames.add(name);\n\t\t\t\tif (!(name in overrides)) {\n\t\t\t\t\tthrow new Error(`Duplicate compatibility schema property requires an override: ${name}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmerged[name] = schema;\n\t\t}\n\t}\n\n\tfor (const name of Object.keys(overrides)) {\n\t\tif (!duplicateNames.has(name)) {\n\t\t\tthrow new Error(`Compatibility schema override does not resolve a duplicate property: ${name}`);\n\t\t}\n\t}\n\n\treturn { ...merged, ...overrides } as MergedCompatProperties<PropertyGroups, Overrides>;\n}\n\n/** Compatibility schema for each API whose models accept compat. Mirrors the compat type of Model. */\nexport const CompatSchemasByApi = {\n\t\"openai-completions\": OpenAICompletionsCompatSchema,\n\t\"openai-responses\": OpenAIResponsesCompatSchema,\n\t\"azure-openai-responses\": OpenAIResponsesCompatSchema,\n\t\"openai-codex-responses\": OpenAIResponsesCompatSchema,\n\t\"anthropic-messages\": AnthropicMessagesCompatSchema,\n\t\"bedrock-converse-stream\": BedrockCompatSchema,\n\t\"mistral-conversations\": MistralConversationsCompatSchema,\n\t\"typesafe-system-one\": SystemOneCompatSchema,\n\t\"cloudflare-workers-ai-system-one\": SystemOneCompatSchema,\n} as const;\n\nconst ProviderCompatProperties = mergeCompatProperties(\n\t[...new Set(Object.values(CompatSchemasByApi))].map((schema) => schema.properties),\n\tProviderCompatPropertyOverrides,\n);\n\nexport const ProviderCompatSchema = Type.Object(ProviderCompatProperties, {\n\tdescription: \"Provider and model compatibility overrides.\",\n\tadditionalProperties: true,\n});\n\nexport type ChatTemplateKwargValue = Static<typeof ChatTemplateKwargValueSchema>;\n/** Top-level request field used to cap reasoning tokens on OpenAI-compatible servers. */\nexport type ThinkingTokenBudgetField = Static<typeof ThinkingTokenBudgetFieldSchema>;\nexport type SessionAffinityFormat = Static<typeof SessionAffinityFormatSchema>;\n/** OpenRouter provider routing preferences. */\nexport interface OpenRouterRouting extends Static<typeof OpenRouterRoutingSchema> {}\n/** Vercel AI Gateway routing preferences. */\nexport interface VercelGatewayRouting extends Static<typeof VercelGatewayRoutingSchema> {}\n/** An Anthropic server-side refusal fallback model with local pricing metadata. */\nexport interface AnthropicAllowedFallbackModel extends Static<typeof AnthropicAllowedFallbackModelSchema> {}\n\n/** Compatibility settings for OpenAI-compatible completions APIs. */\nexport interface OpenAICompletionsCompat extends Static<typeof OpenAICompletionsCompatSchema> {}\n/** Compatibility settings for OpenAI Responses APIs. */\nexport interface OpenAIResponsesCompat extends Static<typeof OpenAIResponsesCompatSchema> {}\n/** Compatibility settings for Anthropic Messages-compatible APIs. */\nexport interface AnthropicMessagesCompat extends Static<typeof AnthropicMessagesCompatSchema> {}\n/** Compatibility settings for Amazon Bedrock models. */\nexport interface BedrockCompat extends Static<typeof BedrockCompatSchema> {}\n/** Compatibility settings for the Mistral chat API. */\nexport interface MistralConversationsCompat extends Static<typeof MistralConversationsCompatSchema> {}\n/** Compatibility settings for System One classifier APIs. */\nexport interface SystemOneCompat extends Static<typeof SystemOneCompatSchema> {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion":6,"generatedAt":"2026-10-
|
|
1
|
+
{"schemaVersion":6,"generatedAt":"2026-10-21T22:33:24.994Z","structureHash":"68fde21cda04641d6d0b956ad5f840a7fe4adc2ebff7577fb8ccaac4e2e48a3f","files":{"amazon-bedrock.json":"5c5a40b2ad4456a7f478aab32f10b2dad5a9dee93184eb38c98721c10fe49ba2","ant-ling.json":"628feab3ef6c7d80ce96f75999804e1d9f05fec3851e5302e30fff3b69db90f6","anthropic.json":"91f5da01452c7746645d3405bc91e09f849e4e4687c7c7ff22d8976eafe64b87","azure.json":"3b008f124eb5089ecf37b918545b5b4da1c842b982383d4b4b4b32383adcc6ca","baseten.json":"5bd3c98c61769388b3724368ef964d16b7a58e41a6edcf4ebceb9d4ac0a21d3b","cerebras.json":"2eb969b2956844f9a641d3de52c19f1791293c58f607282fb3b0ebfe85ff66f8","cloudflare-ai-gateway.json":"6c4f293c27f26a7b005fdd2ea3059668836a5c21097d7df1a03ec03ca540c091","cloudflare-workers-ai.json":"36c80c7d7606465001706d5b5d8612d825d8c501d20efb994599960693d37d43","deepseek.json":"10a296fb3e898f7715c80890c8af0af4f5fd58f22dbcd6612fdc5d762157ccdc","fireworks.json":"8e862806b0a69cefc6585c38b103de1baae782c51409748c6d16199daedcf1ca","github-copilot.json":"b6bf50b945113db1e6cd504b67a68670c4e29380c4e2bdf16ab091eb181be498","google-vertex.json":"564d692a4292ef12e98c8ec056a39948ea64e10851f5ddaaebcc37b585545231","google.json":"b61fb0e27da5be60e1112e46955c5923656cb4d62bb221f834a9463d764ef5de","groq.json":"087df37206e9eed8b10f1e558e4c496289bef60074b7e8afba4f20fb102b4ec2","huggingface.json":"a76d8fa3043d72c80a11c7ff4bcbba07ecb0c87913d8d38dc3cd1001d44b0706","kimi-coding.json":"728d5ddb63ef52130552022d5ae2fd138fdc131ff854ac8c3b10ccaad355ab39","meta.json":"563f5ec07973f52ab8c3eb26ef91a36ad8a79e950b37174935666cdcb624bf35","minimax-cn.json":"fa15d1f67a07046d38e191af9bd97ed922ba45a99a11af4ad281151cc6b762aa","minimax.json":"1e0459dda3858ea24151182106fc4179b95f43a0a8dffc1c3d2e7db4c2d9206e","mistral.json":"c15e0ec8fcbc16b58342242b159af6ad035e7472d06ef4ccfc17fafc947ef3dc","moonshotai-cn.json":"0dbd6b063a0abdbe55d5dc59dd4dade566c2ea817ad6184bc8d20655ecba1daf","moonshotai.json":"1da2c4e34f22aef17a07c974d85bdee8e1b68b6dc712e3769c935b3f1e7dadca","nvidia.json":"4a80c26d6ad935eb5954b5be23239c899e231cdf7a49bbe2d2b4130ffc74b15d","openai-codex.json":"533e0ddd7d212fa8433b974b19613301b093f171541e4f4e1fea1962e68928ad","openai.json":"cf5e119eb05f47bbf1dbad179de6a07b904bf7673e96691be72ab0b1fe40a781","opencode-go.json":"e3cb85944bdbc7fb369204dac3001c683e422ca44f305112e77fb1c5dbfbb79e","opencode.json":"8858aafc35dddc64e504a029413ad11b2f3657429acb96330532a5e042ce5f5e","openrouter.json":"601a908570175a93712f282030d331661fa49ff21139160186271d21445c798e","qwen-token-plan-cn.json":"64427a6adeb3e7dd1857d68bef9bb12097632b646ed151b740e209143e31341e","qwen-token-plan-individual.json":"0fb7cf64faf39d1a3b0a884210a86c87084b805eda15644f5f39293287b959dd","qwen-token-plan.json":"37b9a76c54090228d1026a8f0fcb4d304b00d64b1a3a94cb2ae6e677d2c52b13","radius.json":"49da11ea2e6881e72b3cc32b05f5326cf539332896b47751636f4c19a69911c4","together.json":"2a28fa1978c996ac0a7f0fc07f0c98a37dbf282afe77c0f141dab0c36791ef83","typesafe.json":"631b03f70597ad656e8f45a393ab46bd4137459b9b499708ac3d5d9d9decd3f2","vercel-ai-gateway.json":"6e44f86808a629ded1b9e26b30908d104ad94b7bd2168a3b35c2390069c66899","xai.json":"59f8a7bdf14e79ba1b0d0a37e56251bbf100420bdac7d6af5942508fdb990f11","xiaomi-token-plan-ams.json":"bfd33741da693bdb8e8ebd4e7b90c3e90820aa18432ad081a5a98db13c6bd296","xiaomi-token-plan-cn.json":"4b61d78feae3a926fda918c3fd3a9afaf2ca60c1bba0af8270a5398fb50a983e","xiaomi-token-plan-sgp.json":"b05a197ce24fd69fc9440f4ba929984ac7a0fefbe8083268734b422e721987ec","xiaomi.json":"495b5fddf3c3ec8904fecc15c4c19536f4961dce7b51512b6909d2df2e739824","zai-coding-cn.json":"cc9e0768e726ef55d2b7af853ac5f3585dc72575932cb38840a3877d18736b78","zai.json":"58e6642fdfb736f0b9a4a277c760c536a3cea66a030abbfb2615f7b2851d5c6f"}}
|