@earendil-works/pi-ai 1.4.0 → 1.5.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 +35 -35
- package/dist/api/anthropic-messages.d.ts.map +1 -1
- package/dist/api/anthropic-messages.js +59 -71
- 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 +0 -6
- 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 +125 -103
- package/dist/api/bedrock-converse-stream.js.map +1 -1
- package/dist/api/constrained-sampling.d.ts +15 -1
- package/dist/api/constrained-sampling.d.ts.map +1 -1
- package/dist/api/constrained-sampling.js +51 -18
- package/dist/api/constrained-sampling.js.map +1 -1
- package/dist/api/google-generative-ai.d.ts.map +1 -1
- package/dist/api/google-generative-ai.js +0 -6
- package/dist/api/google-generative-ai.js.map +1 -1
- package/dist/api/google-shared.d.ts +2 -1
- package/dist/api/google-shared.d.ts.map +1 -1
- package/dist/api/google-shared.js +57 -2
- 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 +0 -6
- package/dist/api/google-vertex.js.map +1 -1
- package/dist/api/mistral-conversations.d.ts.map +1 -1
- package/dist/api/mistral-conversations.js +17 -44
- 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 +0 -5
- 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 +42 -54
- package/dist/api/openai-completions.js.map +1 -1
- package/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/dist/api/openai-responses-shared.js +58 -57
- 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 +0 -6
- package/dist/api/openai-responses.js.map +1 -1
- package/dist/api/openrouter-images.js +1 -0
- package/dist/api/openrouter-images.js.map +1 -1
- package/dist/api/pi-messages.d.ts +2 -0
- package/dist/api/pi-messages.d.ts.map +1 -1
- package/dist/api/pi-messages.js +24 -9
- package/dist/api/pi-messages.js.map +1 -1
- package/dist/auth/oauth/github-copilot.d.ts.map +1 -1
- package/dist/auth/oauth/github-copilot.js +4 -11
- package/dist/auth/oauth/github-copilot.js.map +1 -1
- package/dist/auth/oauth/kimi-coding.d.ts.map +1 -1
- package/dist/auth/oauth/kimi-coding.js +4 -22
- package/dist/auth/oauth/kimi-coding.js.map +1 -1
- package/dist/auth/oauth/meta.d.ts.map +1 -1
- package/dist/auth/oauth/meta.js +1 -14
- package/dist/auth/oauth/meta.js.map +1 -1
- package/dist/auth/oauth/radius.d.ts.map +1 -1
- package/dist/auth/oauth/radius.js +9 -3
- package/dist/auth/oauth/radius.js.map +1 -1
- package/dist/auth/oauth/trusted-url.d.ts +7 -0
- package/dist/auth/oauth/trusted-url.d.ts.map +1 -0
- package/dist/auth/oauth/trusted-url.js +12 -0
- package/dist/auth/oauth/trusted-url.js.map +1 -0
- package/dist/auth/types.d.ts +4 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/cli.js +6 -2
- package/dist/cli.js.map +1 -1
- package/dist/compat/extension-oauth-types.d.ts +4 -0
- package/dist/compat/extension-oauth-types.d.ts.map +1 -1
- package/dist/compat/extension-oauth-types.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.generated.js +1 -1
- package/dist/models.generated.js.map +1 -1
- package/dist/models.js +1 -0
- package/dist/models.js.map +1 -1
- package/dist/providers/amazon-bedrock.models.js +1 -1
- package/dist/providers/amazon-bedrock.models.js.map +1 -1
- package/dist/providers/ant-ling.models.js +1 -1
- package/dist/providers/ant-ling.models.js.map +1 -1
- package/dist/providers/anthropic.models.js +1 -1
- package/dist/providers/anthropic.models.js.map +1 -1
- package/dist/providers/azure.models.js +1 -1
- package/dist/providers/azure.models.js.map +1 -1
- package/dist/providers/baseten.models.js +1 -1
- package/dist/providers/baseten.models.js.map +1 -1
- package/dist/providers/cerebras.models.js +1 -1
- package/dist/providers/cerebras.models.js.map +1 -1
- package/dist/providers/cloudflare-ai-gateway.models.js +1 -1
- package/dist/providers/cloudflare-ai-gateway.models.js.map +1 -1
- package/dist/providers/cloudflare-workers-ai.models.js +1 -1
- package/dist/providers/cloudflare-workers-ai.models.js.map +1 -1
- package/dist/providers/compat-schema.d.ts +428 -456
- package/dist/providers/compat-schema.d.ts.map +1 -1
- package/dist/providers/compat-schema.js +144 -111
- 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/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/huggingface.json +1 -1
- package/dist/providers/data/kimi-coding.json +1 -1
- package/dist/providers/data/mistral.json +1 -1
- package/dist/providers/data/moonshotai-cn.json +1 -1
- package/dist/providers/data/moonshotai.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-individual.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/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/data/zai.json +1 -1
- package/dist/providers/deepseek.models.js +1 -1
- package/dist/providers/deepseek.models.js.map +1 -1
- package/dist/providers/faux.d.ts.map +1 -1
- package/dist/providers/faux.js +7 -2
- package/dist/providers/faux.js.map +1 -1
- package/dist/providers/fireworks.models.js +1 -1
- package/dist/providers/fireworks.models.js.map +1 -1
- package/dist/providers/github-copilot.models.js +1 -1
- package/dist/providers/github-copilot.models.js.map +1 -1
- package/dist/providers/google-vertex.models.js +1 -1
- package/dist/providers/google-vertex.models.js.map +1 -1
- package/dist/providers/google.models.js +1 -1
- package/dist/providers/google.models.js.map +1 -1
- package/dist/providers/groq.models.js +1 -1
- package/dist/providers/groq.models.js.map +1 -1
- package/dist/providers/huggingface.models.js +1 -1
- package/dist/providers/huggingface.models.js.map +1 -1
- package/dist/providers/kimi-coding.models.js +1 -1
- package/dist/providers/kimi-coding.models.js.map +1 -1
- package/dist/providers/meta.models.js +1 -1
- package/dist/providers/meta.models.js.map +1 -1
- package/dist/providers/minimax-cn.models.js +1 -1
- package/dist/providers/minimax-cn.models.js.map +1 -1
- package/dist/providers/minimax.models.js +1 -1
- package/dist/providers/minimax.models.js.map +1 -1
- package/dist/providers/mistral.models.js +1 -1
- package/dist/providers/mistral.models.js.map +1 -1
- package/dist/providers/model-schema.d.ts +65 -65
- package/dist/providers/model-schema.d.ts.map +1 -1
- package/dist/providers/model-schema.js +41 -30
- package/dist/providers/model-schema.js.map +1 -1
- package/dist/providers/moonshotai-cn.models.js +1 -1
- package/dist/providers/moonshotai-cn.models.js.map +1 -1
- package/dist/providers/moonshotai.models.js +1 -1
- package/dist/providers/moonshotai.models.js.map +1 -1
- package/dist/providers/nvidia.models.js +1 -1
- package/dist/providers/nvidia.models.js.map +1 -1
- package/dist/providers/openai-codex.models.js +1 -1
- package/dist/providers/openai-codex.models.js.map +1 -1
- package/dist/providers/openai.models.js +1 -1
- package/dist/providers/openai.models.js.map +1 -1
- package/dist/providers/opencode-go.models.js +1 -1
- package/dist/providers/opencode-go.models.js.map +1 -1
- package/dist/providers/opencode.js +1 -1
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/opencode.models.js +1 -1
- package/dist/providers/opencode.models.js.map +1 -1
- package/dist/providers/openrouter.models.js +1 -1
- package/dist/providers/openrouter.models.js.map +1 -1
- package/dist/providers/qwen-token-plan-cn.models.js +1 -1
- package/dist/providers/qwen-token-plan-cn.models.js.map +1 -1
- package/dist/providers/qwen-token-plan-individual.models.js +1 -1
- package/dist/providers/qwen-token-plan-individual.models.js.map +1 -1
- package/dist/providers/qwen-token-plan.models.js +1 -1
- package/dist/providers/qwen-token-plan.models.js.map +1 -1
- package/dist/providers/radius-config.d.ts.map +1 -1
- package/dist/providers/radius-config.js +2 -1
- package/dist/providers/radius-config.js.map +1 -1
- package/dist/providers/radius.models.js +1 -1
- package/dist/providers/radius.models.js.map +1 -1
- package/dist/providers/schema-builders.d.ts +10 -0
- package/dist/providers/schema-builders.d.ts.map +1 -0
- package/dist/providers/schema-builders.js +18 -0
- package/dist/providers/schema-builders.js.map +1 -0
- package/dist/providers/together.models.js +1 -1
- package/dist/providers/together.models.js.map +1 -1
- package/dist/providers/typesafe.models.js +1 -1
- package/dist/providers/typesafe.models.js.map +1 -1
- package/dist/providers/vercel-ai-gateway.models.js +1 -1
- package/dist/providers/vercel-ai-gateway.models.js.map +1 -1
- package/dist/providers/xai.models.js +1 -1
- package/dist/providers/xai.models.js.map +1 -1
- package/dist/providers/xiaomi-token-plan-ams.models.js +1 -1
- package/dist/providers/xiaomi-token-plan-ams.models.js.map +1 -1
- package/dist/providers/xiaomi-token-plan-cn.models.js +1 -1
- package/dist/providers/xiaomi-token-plan-cn.models.js.map +1 -1
- package/dist/providers/xiaomi-token-plan-sgp.models.js +1 -1
- package/dist/providers/xiaomi-token-plan-sgp.models.js.map +1 -1
- package/dist/providers/xiaomi.models.js +1 -1
- package/dist/providers/xiaomi.models.js.map +1 -1
- package/dist/providers/zai-coding-cn.models.js +1 -1
- package/dist/providers/zai-coding-cn.models.js.map +1 -1
- package/dist/providers/zai.models.js +1 -1
- package/dist/providers/zai.models.js.map +1 -1
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +2 -1
- package/dist/telemetry.js.map +1 -1
- package/dist/types.d.ts +12 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/error-body.d.ts.map +1 -1
- package/dist/utils/error-body.js +2 -1
- package/dist/utils/error-body.js.map +1 -1
- package/dist/utils/openrouter-cost.d.ts +24 -0
- package/dist/utils/openrouter-cost.d.ts.map +1 -0
- package/dist/utils/openrouter-cost.js +34 -0
- package/dist/utils/openrouter-cost.js.map +1 -0
- package/dist/utils/overflow.d.ts.map +1 -1
- package/dist/utils/overflow.js +2 -0
- package/dist/utils/overflow.js.map +1 -1
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +3 -0
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/streaming-json.d.ts +84 -0
- package/dist/utils/streaming-json.d.ts.map +1 -0
- package/dist/utils/streaming-json.js +513 -0
- package/dist/utils/streaming-json.js.map +1 -0
- package/dist/utils/{typebox-helpers.d.ts → string-enum.d.ts} +5 -5
- package/dist/utils/string-enum.d.ts.map +1 -0
- package/dist/utils/{typebox-helpers.js → string-enum.js} +5 -6
- package/dist/utils/string-enum.js.map +1 -0
- package/dist/utils/text.d.ts +7 -0
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/transcript.d.ts +1 -1
- package/dist/utils/transcript.js +1 -1
- package/dist/utils/transcript.js.map +1 -1
- package/dist/utils/validation.d.ts +5 -3
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +27 -277
- package/dist/utils/validation.js.map +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/utils/version.js.map +1 -1
- package/package.json +11 -10
- package/dist/utils/typebox-helpers.d.ts.map +0 -1
- package/dist/utils/typebox-helpers.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-schema.d.ts","sourceRoot":"","sources":["../../src/providers/compat-schema.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"compat-schema.d.ts","sourceRoot":"","sources":["../../src/providers/compat-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,KAAK,MAAM,EAGX,MAAM,2BAA2B,CAAC;AAQnC,eAAO,MAAM,2BAA2B,0FAEtC,CAAC;AAeH,eAAO,MAAM,8BAA8B,oHAGzC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;SAavC,CAAC;AAWH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuFnC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;EAkBtC,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;EAO/C,CAAC;AAuKF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIxC,CAAC;AA+DH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EAGtC,CAAC;AAqFH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxC,CAAC;AASH,eAAO,MAAM,mBAAmB;;EAG9B,CAAC;AAUH,eAAO,MAAM,gCAAgC;;EAG3C,CAAC;AAeH,eAAO,MAAM,qBAAqB;;;EAGhC,CAAC;AAiFH,sGAAsG;AACtG,eAAO,MAAM,kBAAkB;aAC9B,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACpB,kBAAkB;;;;;;;;;;;;;aAClB,wBAAwB;;;;;;;;;;;;;aACxB,wBAAwB;;;;;;;;;;;;;aACxB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACpB,yBAAyB;;;aACzB,uBAAuB;;;aACvB,qBAAqB;;;;aACrB,kCAAkC;;;;CACzB,CAAC;AAcX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG/B,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAC;AACjF,4FAA4F;AAC5F,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACjE,yFAAyF;AACzF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACrF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,+CAA+C;AAC/C,MAAM,WAAW,iBAAkB,SAAQ,MAAM,CAAC,OAAO,uBAAuB,CAAC;CAAG;AACpF,6CAA6C;AAC7C,MAAM,WAAW,oBAAqB,SAAQ,MAAM,CAAC,OAAO,0BAA0B,CAAC;CAAG;AAC1F,mFAAmF;AACnF,MAAM,WAAW,6BAA8B,SAAQ,MAAM,CAAC,OAAO,mCAAmC,CAAC;CAAG;AAE5G,qEAAqE;AACrE,MAAM,WAAW,uBAAwB,SAAQ,MAAM,CAAC,OAAO,6BAA6B,CAAC;CAAG;AAChG,wDAAwD;AACxD,MAAM,WAAW,qBAAsB,SAAQ,MAAM,CAAC,OAAO,2BAA2B,CAAC;CAAG;AAC5F,qEAAqE;AACrE,MAAM,WAAW,uBAAwB,SAAQ,MAAM,CAAC,OAAO,6BAA6B,CAAC;CAAG;AAChG,wDAAwD;AACxD,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,OAAO,mBAAmB,CAAC;CAAG;AAC5E,uDAAuD;AACvD,MAAM,WAAW,0BAA2B,SAAQ,MAAM,CAAC,OAAO,gCAAgC,CAAC;CAAG;AACtG,6DAA6D;AAC7D,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,OAAO,qBAAqB,CAAC;CAAG"}
|
|
@@ -1,66 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { arr, bool, nul, num, opt, str, union, } from "@earendil-works/pi-schema";
|
|
2
2
|
import { ModelCostSchema } from "./model-schema.js";
|
|
3
|
+
import { openObject, stringLiteral, stringRecord } from "./schema-builders.js";
|
|
3
4
|
function sessionAffinityFormat(options) {
|
|
4
|
-
return
|
|
5
|
+
return union([stringLiteral("openai"), stringLiteral("openai-nosession"), stringLiteral("openrouter")], options);
|
|
5
6
|
}
|
|
6
7
|
export const SessionAffinityFormatSchema = sessionAffinityFormat({
|
|
7
8
|
description: "Session-affinity header format used to route related requests consistently.",
|
|
8
9
|
});
|
|
9
10
|
function thinkingTokenBudgetField(options) {
|
|
10
|
-
return
|
|
11
|
+
return union([
|
|
12
|
+
stringLiteral("thinking_token_budget"),
|
|
13
|
+
stringLiteral("thinking_budget"),
|
|
14
|
+
stringLiteral("thinking_budget_tokens"),
|
|
15
|
+
], options);
|
|
11
16
|
}
|
|
12
17
|
export const ThinkingTokenBudgetFieldSchema = thinkingTokenBudgetField({
|
|
13
18
|
description: '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.',
|
|
14
19
|
});
|
|
15
|
-
export const ChatTemplateKwargValueSchema =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
$var:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
export const ChatTemplateKwargValueSchema = union([
|
|
21
|
+
str(),
|
|
22
|
+
num(),
|
|
23
|
+
bool(),
|
|
24
|
+
nul(),
|
|
25
|
+
openObject({
|
|
26
|
+
$var: union([
|
|
27
|
+
stringLiteral("thinking.enabled"),
|
|
28
|
+
stringLiteral("thinking.effort"),
|
|
29
|
+
stringLiteral("thinking.budget"),
|
|
25
30
|
]),
|
|
26
|
-
omitWhenOff:
|
|
31
|
+
omitWhenOff: opt(bool()),
|
|
27
32
|
}),
|
|
28
33
|
]);
|
|
29
34
|
function percentileCutoffs(metric) {
|
|
30
|
-
return
|
|
31
|
-
p50:
|
|
32
|
-
p75:
|
|
33
|
-
p90:
|
|
34
|
-
p99:
|
|
35
|
+
return openObject({
|
|
36
|
+
p50: opt(num({ description: `${metric} at the 50th percentile.` })),
|
|
37
|
+
p75: opt(num({ description: `${metric} at the 75th percentile.` })),
|
|
38
|
+
p90: opt(num({ description: `${metric} at the 90th percentile.` })),
|
|
39
|
+
p99: opt(num({ description: `${metric} at the 99th percentile.` })),
|
|
35
40
|
});
|
|
36
41
|
}
|
|
37
|
-
export const OpenRouterRoutingSchema =
|
|
38
|
-
allow_fallbacks:
|
|
39
|
-
require_parameters:
|
|
42
|
+
export const OpenRouterRoutingSchema = openObject({
|
|
43
|
+
allow_fallbacks: opt(bool({ description: "Whether to allow backup providers to serve requests.", default: true })),
|
|
44
|
+
require_parameters: opt(bool({
|
|
40
45
|
description: "Whether to filter providers to only those that support all parameters in the request.",
|
|
41
46
|
default: false,
|
|
42
47
|
})),
|
|
43
|
-
data_collection:
|
|
48
|
+
data_collection: opt(union([stringLiteral("deny"), stringLiteral("allow")], {
|
|
44
49
|
description: 'Data collection setting. "allow": allow providers that may store or train on data. "deny": only use providers that do not collect user data.',
|
|
45
50
|
default: "allow",
|
|
46
51
|
})),
|
|
47
|
-
zdr:
|
|
48
|
-
enforce_distillable_text:
|
|
49
|
-
order:
|
|
52
|
+
zdr: opt(bool({ description: "Whether to restrict routing to only ZDR (Zero Data Retention) endpoints." })),
|
|
53
|
+
enforce_distillable_text: opt(bool({ description: "Whether to restrict routing to only models that allow text distillation." })),
|
|
54
|
+
order: opt(arr(str(), {
|
|
50
55
|
description: "An ordered list of provider names or slugs to try in sequence, falling back to the next if unavailable.",
|
|
51
56
|
})),
|
|
52
|
-
only:
|
|
57
|
+
only: opt(arr(str(), {
|
|
53
58
|
description: "List of provider names or slugs to exclusively allow for this request.",
|
|
54
59
|
})),
|
|
55
|
-
ignore:
|
|
56
|
-
quantizations:
|
|
60
|
+
ignore: opt(arr(str(), { description: "List of provider names or slugs to skip for this request." })),
|
|
61
|
+
quantizations: opt(arr(str(), {
|
|
57
62
|
description: 'A list of quantization levels to filter providers by, for example ["fp16", "bf16", "fp8", "fp6", "int8", "int4", "fp4", "fp32"].',
|
|
58
63
|
})),
|
|
59
|
-
sort:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
by:
|
|
63
|
-
partition:
|
|
64
|
+
sort: opt(union([
|
|
65
|
+
str(),
|
|
66
|
+
openObject({
|
|
67
|
+
by: opt(str({ description: 'The sorting metric, such as "price", "throughput", or "latency".' })),
|
|
68
|
+
partition: opt(union([str(), nul()], {
|
|
64
69
|
description: 'Partitioning strategy: "model" or "none".',
|
|
65
70
|
default: "model",
|
|
66
71
|
})),
|
|
@@ -68,105 +73,105 @@ export const OpenRouterRoutingSchema = Type.Object({
|
|
|
68
73
|
], {
|
|
69
74
|
description: 'Sorting strategy. Can be a string such as "price", "throughput", or "latency", or an object.',
|
|
70
75
|
})),
|
|
71
|
-
max_price:
|
|
72
|
-
prompt:
|
|
73
|
-
completion:
|
|
74
|
-
image:
|
|
75
|
-
audio:
|
|
76
|
-
request:
|
|
76
|
+
max_price: opt(openObject({
|
|
77
|
+
prompt: opt(union([num(), str()], { description: "Price per million prompt tokens." })),
|
|
78
|
+
completion: opt(union([num(), str()], { description: "Price per million completion tokens." })),
|
|
79
|
+
image: opt(union([num(), str()], { description: "Price per image." })),
|
|
80
|
+
audio: opt(union([num(), str()], { description: "Price per audio unit." })),
|
|
81
|
+
request: opt(union([num(), str()], { description: "Price per request." })),
|
|
77
82
|
}, { description: "Maximum price per million tokens in USD." })),
|
|
78
|
-
preferred_min_throughput:
|
|
83
|
+
preferred_min_throughput: opt(union([num(), percentileCutoffs("Minimum tokens per second")], {
|
|
79
84
|
description: "Preferred minimum throughput in tokens per second. A number applies to p50.",
|
|
80
85
|
})),
|
|
81
|
-
preferred_max_latency:
|
|
86
|
+
preferred_max_latency: opt(union([num(), percentileCutoffs("Maximum latency in seconds")], {
|
|
82
87
|
description: "Preferred maximum latency in seconds. A number applies to p50.",
|
|
83
88
|
})),
|
|
84
89
|
}, {
|
|
85
90
|
description: "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.",
|
|
86
91
|
});
|
|
87
|
-
export const VercelGatewayRoutingSchema =
|
|
88
|
-
only:
|
|
92
|
+
export const VercelGatewayRoutingSchema = openObject({
|
|
93
|
+
only: opt(arr(str(), {
|
|
89
94
|
description: 'List of provider slugs to exclusively use for this request, for example ["bedrock", "anthropic"].',
|
|
90
95
|
})),
|
|
91
|
-
order:
|
|
96
|
+
order: opt(arr(str(), {
|
|
92
97
|
description: 'List of provider slugs to try in order, for example ["anthropic", "openai"].',
|
|
93
98
|
})),
|
|
94
99
|
}, {
|
|
95
100
|
description: "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.",
|
|
96
101
|
});
|
|
97
|
-
export const AnthropicAllowedFallbackModelSchema =
|
|
98
|
-
provider:
|
|
99
|
-
model:
|
|
102
|
+
export const AnthropicAllowedFallbackModelSchema = openObject({
|
|
103
|
+
provider: str({ minLength: 1 }),
|
|
104
|
+
model: str({ minLength: 1 }),
|
|
100
105
|
cost: ModelCostSchema,
|
|
101
106
|
}, { description: "An Anthropic server-side refusal fallback model with local pricing metadata." });
|
|
102
107
|
function optionalCompatBoolean(options) {
|
|
103
|
-
return
|
|
108
|
+
return opt(bool(options));
|
|
104
109
|
}
|
|
105
110
|
function optionalSessionAffinityFormat(options) {
|
|
106
|
-
return
|
|
111
|
+
return opt(sessionAffinityFormat(options));
|
|
107
112
|
}
|
|
108
|
-
|
|
109
|
-
supportsStore:
|
|
113
|
+
const OpenAICompletionsCompatProperties = {
|
|
114
|
+
supportsStore: opt(bool({
|
|
110
115
|
description: "Whether the provider supports the store field. Default: auto-detected from URL.",
|
|
111
116
|
})),
|
|
112
117
|
supportsDeveloperRole: optionalCompatBoolean({
|
|
113
118
|
description: "Whether the provider supports the developer role instead of system. Default: auto-detected from URL.",
|
|
114
119
|
}),
|
|
115
|
-
supportsReasoningEffort:
|
|
120
|
+
supportsReasoningEffort: opt(bool({
|
|
116
121
|
description: "Whether the provider supports reasoning_effort. Default: auto-detected from URL.",
|
|
117
122
|
})),
|
|
118
|
-
supportsUsageInStreaming:
|
|
123
|
+
supportsUsageInStreaming: opt(bool({
|
|
119
124
|
description: "Whether the provider supports stream_options.include_usage for token usage in streaming responses.",
|
|
120
125
|
default: true,
|
|
121
126
|
})),
|
|
122
|
-
supportsFinishReason:
|
|
127
|
+
supportsFinishReason: opt(bool({
|
|
123
128
|
description: "Whether streamed responses include finish_reason. When false, pi infers stop or toolUse when the stream ends.",
|
|
124
129
|
default: true,
|
|
125
130
|
})),
|
|
126
|
-
maxTokensField:
|
|
131
|
+
maxTokensField: opt(union([stringLiteral("max_completion_tokens"), stringLiteral("max_tokens")], {
|
|
127
132
|
description: "Which field to use for max tokens. Default: auto-detected from URL.",
|
|
128
133
|
})),
|
|
129
|
-
requiresToolResultName:
|
|
130
|
-
requiresAssistantAfterToolResult:
|
|
134
|
+
requiresToolResultName: opt(bool({ description: "Whether tool results require the name field. Default: auto-detected from URL." })),
|
|
135
|
+
requiresAssistantAfterToolResult: opt(bool({
|
|
131
136
|
description: "Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL.",
|
|
132
137
|
})),
|
|
133
|
-
requiresThinkingAsText:
|
|
138
|
+
requiresThinkingAsText: opt(bool({
|
|
134
139
|
description: "Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL.",
|
|
135
140
|
})),
|
|
136
|
-
requiresReasoningContentOnAssistantMessages:
|
|
141
|
+
requiresReasoningContentOnAssistantMessages: opt(bool({
|
|
137
142
|
description: "Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL.",
|
|
138
143
|
})),
|
|
139
|
-
thinkingFormat:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
thinkingFormat: opt(union([
|
|
145
|
+
stringLiteral("openai"),
|
|
146
|
+
stringLiteral("openrouter"),
|
|
147
|
+
stringLiteral("deepseek"),
|
|
148
|
+
stringLiteral("together"),
|
|
149
|
+
stringLiteral("baseten"),
|
|
150
|
+
stringLiteral("zai"),
|
|
151
|
+
stringLiteral("qwen"),
|
|
152
|
+
stringLiteral("chat-template"),
|
|
153
|
+
stringLiteral("qwen-chat-template"),
|
|
154
|
+
stringLiteral("string-thinking"),
|
|
155
|
+
stringLiteral("ant-ling"),
|
|
151
156
|
], {
|
|
152
157
|
description: '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.',
|
|
153
158
|
})),
|
|
154
|
-
chatTemplateKwargs:
|
|
159
|
+
chatTemplateKwargs: opt(stringRecord(ChatTemplateKwargValueSchema, {
|
|
155
160
|
description: '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.',
|
|
156
161
|
})),
|
|
157
|
-
chatTemplateArgs:
|
|
162
|
+
chatTemplateArgs: opt(stringRecord(ChatTemplateKwargValueSchema, {
|
|
158
163
|
description: 'Arguments sent as chat_template_args when thinkingFormat is "baseten". Use $var with "thinking.enabled", "thinking.effort", or "thinking.budget" for pi-controlled values.',
|
|
159
164
|
})),
|
|
160
|
-
openRouterRouting:
|
|
161
|
-
vercelGatewayRouting:
|
|
162
|
-
zaiToolStream:
|
|
165
|
+
openRouterRouting: opt(OpenRouterRoutingSchema),
|
|
166
|
+
vercelGatewayRouting: opt(VercelGatewayRoutingSchema),
|
|
167
|
+
zaiToolStream: opt(bool({
|
|
163
168
|
description: "Whether z.ai supports top-level tool_stream for streaming tool call deltas.",
|
|
164
169
|
default: false,
|
|
165
170
|
})),
|
|
166
|
-
thinkingTokenBudgetField:
|
|
171
|
+
thinkingTokenBudgetField: opt(thinkingTokenBudgetField({
|
|
167
172
|
description: '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.',
|
|
168
173
|
})),
|
|
169
|
-
supportsThinkingTokenBudget:
|
|
174
|
+
supportsThinkingTokenBudget: opt(bool({
|
|
170
175
|
description: 'Alias for thinkingTokenBudgetField: "thinking_token_budget" (vLLM). Prefer thinkingTokenBudgetField.',
|
|
171
176
|
default: false,
|
|
172
177
|
})),
|
|
@@ -178,7 +183,7 @@ export const OpenAICompletionsCompatSchema = Type.Object({
|
|
|
178
183
|
description: "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.",
|
|
179
184
|
default: false,
|
|
180
185
|
}),
|
|
181
|
-
supportsMidConvoToolAdditions:
|
|
186
|
+
supportsMidConvoToolAdditions: opt(bool({
|
|
182
187
|
description: "Whether system messages can introduce additional tools mid-conversation. Requires supportsMidConvoSystemMessages. The generated catalog enables this for capable models.",
|
|
183
188
|
default: false,
|
|
184
189
|
})),
|
|
@@ -186,7 +191,7 @@ export const OpenAICompletionsCompatSchema = Type.Object({
|
|
|
186
191
|
description: "Whether the provider supports the strict field in tool definitions. Generated capable models enable it explicitly.",
|
|
187
192
|
default: false,
|
|
188
193
|
}),
|
|
189
|
-
cacheControlFormat:
|
|
194
|
+
cacheControlFormat: opt(stringLiteral("anthropic", {
|
|
190
195
|
description: "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.",
|
|
191
196
|
})),
|
|
192
197
|
sendSessionAffinityHeaders: optionalCompatBoolean({
|
|
@@ -198,14 +203,15 @@ export const OpenAICompletionsCompatSchema = Type.Object({
|
|
|
198
203
|
supportsLongCacheRetention: optionalCompatBoolean({
|
|
199
204
|
description: '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.',
|
|
200
205
|
}),
|
|
201
|
-
vllmPriority:
|
|
206
|
+
vllmPriority: opt(num({
|
|
202
207
|
description: "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.",
|
|
203
208
|
})),
|
|
204
|
-
}
|
|
209
|
+
};
|
|
210
|
+
export const OpenAICompletionsCompatSchema = openObject(OpenAICompletionsCompatProperties, {
|
|
205
211
|
description: "Compatibility settings for OpenAI-compatible completions APIs. Use this to override URL-based auto-detection for custom providers.",
|
|
206
212
|
additionalProperties: true,
|
|
207
213
|
});
|
|
208
|
-
|
|
214
|
+
const OpenAIResponsesCompatProperties = {
|
|
209
215
|
supportsDeveloperRole: optionalCompatBoolean({
|
|
210
216
|
description: "Whether the provider supports the developer role instead of system.",
|
|
211
217
|
default: true,
|
|
@@ -228,29 +234,33 @@ export const OpenAIResponsesCompatSchema = Type.Object({
|
|
|
228
234
|
description: "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.",
|
|
229
235
|
default: false,
|
|
230
236
|
}),
|
|
231
|
-
supportsAdditionalTools:
|
|
237
|
+
supportsAdditionalTools: opt(bool({
|
|
232
238
|
description: "Whether the model supports message-anchored additional_tools input items.",
|
|
233
239
|
default: false,
|
|
234
240
|
})),
|
|
235
|
-
supportsToolSearch:
|
|
241
|
+
supportsToolSearch: opt(bool({
|
|
236
242
|
description: "Whether the model supports client-executed tool search for transcript-anchored additions.",
|
|
237
243
|
default: false,
|
|
238
244
|
})),
|
|
239
|
-
supportsExplicitPromptCacheMode:
|
|
245
|
+
supportsExplicitPromptCacheMode: opt(bool({
|
|
240
246
|
description: "Whether the model accepts prompt_cache_options. Older OpenAI models reject the parameter.",
|
|
241
247
|
default: false,
|
|
242
248
|
})),
|
|
243
|
-
supportsMidConvoEffort:
|
|
249
|
+
supportsMidConvoEffort: opt(bool({
|
|
244
250
|
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
251
|
default: false,
|
|
246
252
|
})),
|
|
247
|
-
supportsMaxOutputTokens:
|
|
253
|
+
supportsMaxOutputTokens: opt(bool({
|
|
248
254
|
description: "Whether the provider accepts max_output_tokens. Some Codex-protocol gateways reject it.",
|
|
249
255
|
default: true,
|
|
250
256
|
})),
|
|
251
|
-
}
|
|
252
|
-
export const
|
|
253
|
-
|
|
257
|
+
};
|
|
258
|
+
export const OpenAIResponsesCompatSchema = openObject(OpenAIResponsesCompatProperties, {
|
|
259
|
+
description: "Compatibility settings for OpenAI Responses APIs.",
|
|
260
|
+
additionalProperties: true,
|
|
261
|
+
});
|
|
262
|
+
const AnthropicMessagesCompatProperties = {
|
|
263
|
+
supportsEagerToolInputStreaming: opt(bool({
|
|
254
264
|
description: "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.",
|
|
255
265
|
default: true,
|
|
256
266
|
})),
|
|
@@ -261,30 +271,30 @@ export const AnthropicMessagesCompatSchema = Type.Object({
|
|
|
261
271
|
sendSessionAffinityHeaders: optionalCompatBoolean({
|
|
262
272
|
description: "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.",
|
|
263
273
|
}),
|
|
264
|
-
sessionAffinityFormat:
|
|
274
|
+
sessionAffinityFormat: opt(stringLiteral("openrouter", {
|
|
265
275
|
description: "Session-affinity format. openrouter sends x-session-id; when unset, sends x-session-affinity.",
|
|
266
276
|
})),
|
|
267
|
-
supportsCacheControlOnTools:
|
|
277
|
+
supportsCacheControlOnTools: opt(bool({
|
|
268
278
|
description: "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.",
|
|
269
279
|
default: true,
|
|
270
280
|
})),
|
|
271
|
-
supportsTemperature:
|
|
281
|
+
supportsTemperature: opt(bool({
|
|
272
282
|
description: "Whether the model accepts the Anthropic temperature request field. Claude Opus 4.7+ rejects non-default values.",
|
|
273
283
|
default: true,
|
|
274
284
|
})),
|
|
275
|
-
forceAdaptiveThinking:
|
|
285
|
+
forceAdaptiveThinking: opt(bool({
|
|
276
286
|
description: "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.",
|
|
277
287
|
default: false,
|
|
278
288
|
})),
|
|
279
|
-
allowEmptySignature:
|
|
289
|
+
allowEmptySignature: opt(bool({
|
|
280
290
|
description: "Whether to replay empty thinking signatures instead of converting thinking to text.",
|
|
281
291
|
default: false,
|
|
282
292
|
})),
|
|
283
|
-
supportsStrictTools:
|
|
293
|
+
supportsStrictTools: opt(bool({
|
|
284
294
|
description: "Whether the provider supports Anthropic strict tool schemas. Generated Anthropic models enable it explicitly.",
|
|
285
295
|
default: false,
|
|
286
296
|
})),
|
|
287
|
-
supportsMidConvoEffort:
|
|
297
|
+
supportsMidConvoEffort: opt(bool({
|
|
288
298
|
description: "Whether the exact model transport supports effort-only system messages and thinking binding controls.",
|
|
289
299
|
default: false,
|
|
290
300
|
})),
|
|
@@ -292,35 +302,51 @@ export const AnthropicMessagesCompatSchema = Type.Object({
|
|
|
292
302
|
description: "Whether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt.",
|
|
293
303
|
default: false,
|
|
294
304
|
}),
|
|
295
|
-
supportsMidConvoToolChanges:
|
|
305
|
+
supportsMidConvoToolChanges: opt(bool({
|
|
296
306
|
description: "Whether the exact model accepts mid-conversation tool_addition and tool_removal blocks. Requires supportsMidConvoSystemMessages.",
|
|
297
307
|
default: false,
|
|
298
308
|
})),
|
|
299
|
-
allowedFallbackModels:
|
|
309
|
+
allowedFallbackModels: opt(arr(AnthropicAllowedFallbackModelSchema, {
|
|
300
310
|
maxItems: 3,
|
|
301
311
|
description: "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.",
|
|
302
312
|
})),
|
|
303
|
-
}
|
|
304
|
-
export const
|
|
313
|
+
};
|
|
314
|
+
export const AnthropicMessagesCompatSchema = openObject(AnthropicMessagesCompatProperties, {
|
|
315
|
+
description: "Compatibility settings for Anthropic Messages-compatible APIs.",
|
|
316
|
+
additionalProperties: true,
|
|
317
|
+
});
|
|
318
|
+
const BedrockCompatProperties = {
|
|
305
319
|
supportsStrictMode: optionalCompatBoolean({
|
|
306
320
|
description: "Whether the model supports Bedrock strict tool schemas.",
|
|
307
321
|
default: false,
|
|
308
322
|
}),
|
|
309
|
-
}
|
|
310
|
-
export const
|
|
323
|
+
};
|
|
324
|
+
export const BedrockCompatSchema = openObject(BedrockCompatProperties, {
|
|
325
|
+
description: "Compatibility settings for Amazon Bedrock models.",
|
|
326
|
+
additionalProperties: true,
|
|
327
|
+
});
|
|
328
|
+
const MistralConversationsCompatProperties = {
|
|
311
329
|
supportsMidConvoSystemMessages: optionalCompatBoolean({
|
|
312
330
|
description: "Whether the exact model accepts system messages after the conversation has started. When false, later system messages are folded into the leading system message.",
|
|
313
331
|
default: false,
|
|
314
332
|
}),
|
|
315
|
-
}
|
|
316
|
-
export const
|
|
317
|
-
|
|
333
|
+
};
|
|
334
|
+
export const MistralConversationsCompatSchema = openObject(MistralConversationsCompatProperties, {
|
|
335
|
+
description: "Compatibility settings for the Mistral chat API.",
|
|
336
|
+
additionalProperties: true,
|
|
337
|
+
});
|
|
338
|
+
const SystemOneCompatProperties = {
|
|
339
|
+
imageInput: opt(union([stringLiteral("assets"), stringLiteral("images"), stringLiteral("state-image-urls")], {
|
|
318
340
|
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
341
|
})),
|
|
320
342
|
sendImageOptInHeader: optionalCompatBoolean({
|
|
321
343
|
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
344
|
}),
|
|
323
|
-
}
|
|
345
|
+
};
|
|
346
|
+
export const SystemOneCompatSchema = openObject(SystemOneCompatProperties, {
|
|
347
|
+
description: "Compatibility settings for System One classifier APIs.",
|
|
348
|
+
additionalProperties: true,
|
|
349
|
+
});
|
|
324
350
|
const ProviderCompatPropertyOverrides = {
|
|
325
351
|
supportsDeveloperRole: optionalCompatBoolean({
|
|
326
352
|
description: "Whether the provider supports the developer role instead of system. Defaults are API-specific.",
|
|
@@ -388,8 +414,15 @@ export const CompatSchemasByApi = {
|
|
|
388
414
|
"typesafe-system-one": SystemOneCompatSchema,
|
|
389
415
|
"cloudflare-workers-ai-system-one": SystemOneCompatSchema,
|
|
390
416
|
};
|
|
391
|
-
const ProviderCompatProperties = mergeCompatProperties([
|
|
392
|
-
|
|
417
|
+
const ProviderCompatProperties = mergeCompatProperties([
|
|
418
|
+
OpenAICompletionsCompatProperties,
|
|
419
|
+
OpenAIResponsesCompatProperties,
|
|
420
|
+
AnthropicMessagesCompatProperties,
|
|
421
|
+
BedrockCompatProperties,
|
|
422
|
+
MistralConversationsCompatProperties,
|
|
423
|
+
SystemOneCompatProperties,
|
|
424
|
+
], ProviderCompatPropertyOverrides);
|
|
425
|
+
export const ProviderCompatSchema = openObject(ProviderCompatProperties, {
|
|
393
426
|
description: "Provider and model compatibility overrides.",
|
|
394
427
|
additionalProperties: true,
|
|
395
428
|
});
|