zuplo 7.8.24 → 7.9.2
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/docs/ai-gateway/azure-ai.mdx +6 -6
- package/docs/ai-gateway/bedrock-mantle.mdx +4 -4
- package/docs/ai-gateway/bedrock-runtime.mdx +9 -9
- package/docs/ai-gateway/cookbooks/sdk-path-shim.mdx +10 -5
- package/docs/ai-gateway/integrations/ai-sdk.mdx +2 -2
- package/docs/ai-gateway/integrations/claude-code.mdx +3 -3
- package/docs/ai-gateway/integrations/claude-desktop.mdx +2 -2
- package/docs/ai-gateway/integrations/codex.mdx +4 -4
- package/docs/ai-gateway/integrations/github-copilot.mdx +4 -4
- package/docs/ai-gateway/integrations/goose.mdx +3 -3
- package/docs/ai-gateway/integrations/langchain.mdx +3 -3
- package/docs/ai-gateway/integrations/openai.mdx +3 -3
- package/docs/ai-gateway/policy-chains.mdx +9 -5
- package/docs/ai-gateway/universal-api.mdx +3 -3
- package/docs/ai-gateway/usage-limits.mdx +1 -1
- package/docs/ai-gateway/vertex-ai.mdx +1 -1
- package/docs/dedicated/akamai/ai-powered-applications.mdx +3 -3
- package/docs/policies/_index.md +11 -10
- package/docs/policies/{akamai-ai-firewall-v2-inbound → ai-gateway-akamai-firewall-inbound}/doc.md +3 -3
- package/docs/policies/{akamai-ai-firewall-v2-inbound → ai-gateway-akamai-firewall-inbound}/schema.json +5 -6
- package/docs/policies/{ai-gateway-auth-v2-inbound → ai-gateway-auth-inbound}/doc.md +10 -10
- package/docs/policies/{ai-gateway-auth-v2-inbound → ai-gateway-auth-inbound}/schema.json +5 -6
- package/docs/policies/{ai-gateway-configuration-executor-v2-inbound → ai-gateway-configuration-executor-inbound}/doc.md +40 -40
- package/docs/policies/{ai-gateway-configuration-executor-v2-inbound → ai-gateway-configuration-executor-inbound}/intro.md +2 -2
- package/docs/policies/{ai-gateway-configuration-executor-v2-inbound → ai-gateway-configuration-executor-inbound}/schema.json +7 -8
- package/docs/policies/{ai-gateway-configuration-loader-v2-inbound → ai-gateway-configuration-loader-inbound}/doc.md +17 -17
- package/docs/policies/ai-gateway-configuration-loader-inbound/intro.md +6 -0
- package/docs/policies/{ai-gateway-configuration-loader-v2-inbound → ai-gateway-configuration-loader-inbound}/schema.json +7 -8
- package/docs/policies/ai-gateway-dlp-inbound/schema.json +0 -1
- package/docs/policies/{ai-gateway-fallback-model-v2-inbound → ai-gateway-fallback-model-inbound}/doc.md +3 -3
- package/docs/policies/{ai-gateway-fallback-model-v2-inbound → ai-gateway-fallback-model-inbound}/schema.json +5 -6
- package/docs/policies/{galileo-tracing-v2-inbound → ai-gateway-galileo-tracing-inbound}/doc.md +3 -3
- package/docs/policies/{galileo-tracing-v2-inbound → ai-gateway-galileo-tracing-inbound}/schema.json +5 -6
- package/docs/policies/ai-gateway-internal-only-inbound/doc.md +3 -3
- package/docs/policies/ai-gateway-internal-only-inbound/schema.json +0 -1
- package/docs/policies/{ai-gateway-metering-v2-inbound → ai-gateway-metering-inbound}/doc.md +1 -1
- package/docs/policies/{ai-gateway-metering-v2-inbound → ai-gateway-metering-inbound}/schema.json +5 -6
- package/docs/policies/{ai-gateway-model-filtering-v2-inbound → ai-gateway-model-filtering-inbound}/doc.md +7 -5
- package/docs/policies/{ai-gateway-model-filtering-v2-inbound → ai-gateway-model-filtering-inbound}/schema.json +5 -6
- package/docs/policies/ai-gateway-model-override-inbound/doc.md +154 -0
- package/docs/policies/ai-gateway-model-override-inbound/intro.md +5 -0
- package/docs/policies/ai-gateway-model-override-inbound/schema.json +126 -0
- package/docs/policies/{comet-opik-tracing-v2-inbound → ai-gateway-opik-tracing-inbound}/doc.md +3 -3
- package/docs/policies/{comet-opik-tracing-v2-inbound → ai-gateway-opik-tracing-inbound}/schema.json +5 -6
- package/docs/policies/{ai-gateway-semantic-cache-v2-inbound → ai-gateway-semantic-cache-inbound}/schema.json +4 -5
- package/docs/policies/ai-gateway-smart-router-inbound/doc.md +2 -2
- package/docs/policies/ai-gateway-smart-router-inbound/schema.json +0 -1
- package/package.json +5 -5
- package/docs/policies/ai-gateway-configuration-loader-v2-inbound/intro.md +0 -6
- /package/docs/policies/{akamai-ai-firewall-v2-inbound → ai-gateway-akamai-firewall-inbound}/intro.md +0 -0
- /package/docs/policies/{ai-gateway-auth-v2-inbound → ai-gateway-auth-inbound}/intro.md +0 -0
- /package/docs/policies/{ai-gateway-fallback-model-v2-inbound → ai-gateway-fallback-model-inbound}/intro.md +0 -0
- /package/docs/policies/{galileo-tracing-v2-inbound → ai-gateway-galileo-tracing-inbound}/intro.md +0 -0
- /package/docs/policies/{ai-gateway-metering-v2-inbound → ai-gateway-metering-inbound}/intro.md +0 -0
- /package/docs/policies/{ai-gateway-model-filtering-v2-inbound → ai-gateway-model-filtering-inbound}/intro.md +0 -0
- /package/docs/policies/{comet-opik-tracing-v2-inbound → ai-gateway-opik-tracing-inbound}/intro.md +0 -0
- /package/docs/policies/{ai-gateway-semantic-cache-v2-inbound → ai-gateway-semantic-cache-inbound}/doc.md +0 -0
- /package/docs/policies/{ai-gateway-semantic-cache-v2-inbound → ai-gateway-semantic-cache-inbound}/intro.md +0 -0
|
@@ -60,8 +60,10 @@ These Responses API operations do not have a request body:
|
|
|
60
60
|
- `DELETE /v1/responses/:responseId`
|
|
61
61
|
|
|
62
62
|
Because they cannot supply `model`, they require routing to be selected before
|
|
63
|
-
the handler runs.
|
|
64
|
-
|
|
63
|
+
the handler runs. Attach AI Gateway Model Override with a
|
|
64
|
+
`models.completions.default` model, configure a `completions.allowList` in Model
|
|
65
|
+
Filtering so its first entry supplies the default, or use a custom inbound
|
|
66
|
+
policy that calls
|
|
65
67
|
`AIGatewayModelRouting.set(context, { completions: "providerName/model" })`.
|
|
66
68
|
Without preselected routing, the handler returns an OpenAI-compatible 400
|
|
67
69
|
`invalid_request_error` with this configuration guidance.
|
|
@@ -105,10 +107,10 @@ capability to add.
|
|
|
105
107
|
|
|
106
108
|
```json
|
|
107
109
|
{
|
|
108
|
-
"name": "ai-gateway-model-filtering-
|
|
109
|
-
"policyType": "ai-gateway-model-filtering
|
|
110
|
+
"name": "ai-gateway-model-filtering-inbound",
|
|
111
|
+
"policyType": "ai-gateway-model-filtering",
|
|
110
112
|
"handler": {
|
|
111
|
-
"export": "
|
|
113
|
+
"export": "AIGatewayModelFilteringInboundPolicy",
|
|
112
114
|
"module": "$import(@zuplo/runtime)",
|
|
113
115
|
"options": {
|
|
114
116
|
"models": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/ai-gateway-model-filtering-
|
|
3
|
+
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/ai-gateway-model-filtering-inbound.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "AI Gateway Model Filtering",
|
|
6
6
|
"isDeprecated": false,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": true,
|
|
13
|
-
"policyType": "ai-gateway-model-filtering
|
|
13
|
+
"policyType": "ai-gateway-model-filtering",
|
|
14
14
|
"products": ["ai-gateway"],
|
|
15
15
|
"description": "Matches AI Gateway requests against curated allow lists or open block lists, then stores the winning model reference for the route handler.",
|
|
16
16
|
"deprecatedMessage": "",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"required": ["export", "module", "options"],
|
|
23
23
|
"properties": {
|
|
24
24
|
"export": {
|
|
25
|
-
"const": "
|
|
25
|
+
"const": "AIGatewayModelFilteringInboundPolicy",
|
|
26
26
|
"description": "The name of the exported type"
|
|
27
27
|
},
|
|
28
28
|
"module": {
|
|
@@ -30,9 +30,8 @@
|
|
|
30
30
|
"description": "The module containing the policy"
|
|
31
31
|
},
|
|
32
32
|
"options": {
|
|
33
|
-
"x-zuplo-policy-type": "ai-gateway-model-filtering-v2",
|
|
34
33
|
"type": "object",
|
|
35
|
-
"title": "
|
|
34
|
+
"title": "AIGatewayModelFilteringInboundPolicyOptions",
|
|
36
35
|
"description": "Options for allowing or blocking providerName/model references for each AI Gateway capability.",
|
|
37
36
|
"additionalProperties": false,
|
|
38
37
|
"required": ["models"],
|
|
@@ -146,7 +145,7 @@
|
|
|
146
145
|
},
|
|
147
146
|
"examples": [
|
|
148
147
|
{
|
|
149
|
-
"export": "
|
|
148
|
+
"export": "AIGatewayModelFilteringInboundPolicy",
|
|
150
149
|
"module": "$import(@zuplo/runtime)",
|
|
151
150
|
"options": {
|
|
152
151
|
"models": {
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Use this policy when the gateway operator, not the client, decides which model
|
|
2
|
+
an AI Gateway route uses. Each capability picks one mode:
|
|
3
|
+
|
|
4
|
+
- `force` sends every request to the configured model. A model in the request
|
|
5
|
+
body is ignored.
|
|
6
|
+
- `default` supplies the configured model only when the request omits `model`. A
|
|
7
|
+
request that selects a model keeps its selection.
|
|
8
|
+
|
|
9
|
+
`providerName` is the Provider Name configured in the Zuplo Portal. The text
|
|
10
|
+
after the first slash is the provider-specific model ID, so model IDs may
|
|
11
|
+
contain additional slashes.
|
|
12
|
+
|
|
13
|
+
## Choosing a mode
|
|
14
|
+
|
|
15
|
+
Use `force` to:
|
|
16
|
+
|
|
17
|
+
- Pin a route to one vetted model regardless of client input.
|
|
18
|
+
- Repoint existing traffic at a new model without a client release.
|
|
19
|
+
- Expose a stable route like `/fast/v1/chat/completions` whose model you swap
|
|
20
|
+
server-side.
|
|
21
|
+
|
|
22
|
+
Use `default` to:
|
|
23
|
+
|
|
24
|
+
- Let clients omit `model` while keeping full choice for clients that send one.
|
|
25
|
+
- Give Responses management operations (`GET`/`DELETE /v1/responses/*`), which
|
|
26
|
+
have no request body, the routing they require.
|
|
27
|
+
|
|
28
|
+
## Policy order
|
|
29
|
+
|
|
30
|
+
Place Model Override first among the model-selection policies:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
Model Override -> Model Filtering -> Fallback Model -> AI Gateway handler
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- A selection made by an earlier policy is never overwritten. When this policy
|
|
37
|
+
sets the selection, AI Gateway Model Filtering leaves it unchanged, so a
|
|
38
|
+
forced model does not also need an allow-list entry.
|
|
39
|
+
- In `default` mode, a request that selects its own model passes through
|
|
40
|
+
unchanged, and Model Filtering or the handler validates it as usual. The
|
|
41
|
+
default never masks an invalid request model; a malformed value is still
|
|
42
|
+
rejected downstream with a 400 response.
|
|
43
|
+
- AI Gateway Fallback Model placed after this policy enriches the selection with
|
|
44
|
+
`fallback` and `quotaFallback` models. Keep fallback fields in that policy;
|
|
45
|
+
this one accepts plain `providerName/model` strings only.
|
|
46
|
+
- A custom inbound policy placed before this one stays authoritative. For
|
|
47
|
+
example, an experiment policy can select routing for a fraction of traffic and
|
|
48
|
+
let `force` catch the rest.
|
|
49
|
+
|
|
50
|
+
## Options
|
|
51
|
+
|
|
52
|
+
`models` must contain `completions`, `embeddings`, or both. Each capability sets
|
|
53
|
+
exactly one of:
|
|
54
|
+
|
|
55
|
+
- `force` - the model every request uses.
|
|
56
|
+
- `default` - the model used only when the request omits `model`.
|
|
57
|
+
|
|
58
|
+
Values are plain `providerName/model` strings. Unsupported fields and malformed
|
|
59
|
+
references are rejected as configuration errors naming the field. If the policy
|
|
60
|
+
is attached but the route's capability has no rule, the policy passes the
|
|
61
|
+
request through unchanged.
|
|
62
|
+
|
|
63
|
+
## Force example
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"name": "ai-gateway-model-override-inbound",
|
|
68
|
+
"policyType": "ai-gateway-model-override",
|
|
69
|
+
"handler": {
|
|
70
|
+
"export": "AIGatewayModelOverrideInboundPolicy",
|
|
71
|
+
"module": "$import(@zuplo/runtime)",
|
|
72
|
+
"options": {
|
|
73
|
+
"models": {
|
|
74
|
+
"completions": {
|
|
75
|
+
"force": "openai/gpt-5"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Default example
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"models": {
|
|
88
|
+
"completions": {
|
|
89
|
+
"default": "anthropic/claude-haiku-4-5"
|
|
90
|
+
},
|
|
91
|
+
"embeddings": {
|
|
92
|
+
"default": "openai/text-embedding-3-small"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Request behavior
|
|
99
|
+
|
|
100
|
+
| Situation | `force` | `default` |
|
|
101
|
+
| -------------------------------------------------- | -------------------------------- | ----------------------------------------------- |
|
|
102
|
+
| Request omits `model` | Configured model is selected. | Configured model is selected. |
|
|
103
|
+
| Request selects a model | Configured model replaces it. | The request's model continues downstream. |
|
|
104
|
+
| Request model is malformed | Configured model is selected. | Passed through; rejected downstream with a 400. |
|
|
105
|
+
| Bodyless request (Responses management operations) | Configured model is selected. | Configured model is selected. |
|
|
106
|
+
| An earlier policy already selected routing | Skipped; earlier selection wins. | Skipped; earlier selection wins. |
|
|
107
|
+
| Route capability has no rule | Passed through unchanged. | Passed through unchanged. |
|
|
108
|
+
|
|
109
|
+
When the policy selects the configured model, the same routing validation used
|
|
110
|
+
everywhere else applies: the Provider Name must be configured, the model must be
|
|
111
|
+
available for the route's capability, and the Provider Assignment must have
|
|
112
|
+
usable credentials. A configured model that fails this validation is reported as
|
|
113
|
+
this policy's configuration error, naming the exact option such as
|
|
114
|
+
`options.models.completions.force`.
|
|
115
|
+
|
|
116
|
+
## Native routes
|
|
117
|
+
|
|
118
|
+
`/v1/responses` requires a Provider Name backed by OpenAI, and `/v1/messages`
|
|
119
|
+
requires one backed by Anthropic. A configured model that selects an
|
|
120
|
+
incompatible provider type is a configuration error on every request it applies
|
|
121
|
+
to, so the policy reports it as one, naming the option to fix.
|
|
122
|
+
|
|
123
|
+
## Observability
|
|
124
|
+
|
|
125
|
+
Responses report the model that actually served the request in their `model`
|
|
126
|
+
field, so a client can always see that an override applied. The policy also
|
|
127
|
+
writes a debug-level log entry with `requestedModel` and `forcedModel` when a
|
|
128
|
+
forced model replaces a request's differing selection.
|
|
129
|
+
|
|
130
|
+
## Write your own override policy
|
|
131
|
+
|
|
132
|
+
Everything this policy does is built on the public
|
|
133
|
+
`AIGatewayModelRouting.set(context, routing)` primitive. Use a custom inbound
|
|
134
|
+
policy instead when the override depends on request data, for example routing by
|
|
135
|
+
header:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import {
|
|
139
|
+
AIGatewayModelRouting,
|
|
140
|
+
type ZuploContext,
|
|
141
|
+
type ZuploRequest,
|
|
142
|
+
} from "@zuplo/runtime";
|
|
143
|
+
|
|
144
|
+
export default async function overrideModel(
|
|
145
|
+
request: ZuploRequest,
|
|
146
|
+
context: ZuploContext
|
|
147
|
+
) {
|
|
148
|
+
const tier = request.headers.get("x-plan-tier");
|
|
149
|
+
await AIGatewayModelRouting.set(context, {
|
|
150
|
+
completions: tier === "pro" ? "openai/gpt-5" : "openai/gpt-5-mini",
|
|
151
|
+
});
|
|
152
|
+
return request;
|
|
153
|
+
}
|
|
154
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
AI Gateway Model Override pins the model an AI Gateway route uses. Set `force`
|
|
2
|
+
to send every request to one model no matter what the client selects, or
|
|
3
|
+
`default` to supply a model only when the request omits one. Place it before AI
|
|
4
|
+
Gateway Model Filtering and AI Gateway Fallback Model; a selection made by an
|
|
5
|
+
earlier policy is never overwritten.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/ai-gateway-model-override-inbound.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"title": "AI Gateway Model Override",
|
|
6
|
+
"isDeprecated": false,
|
|
7
|
+
"isPaidAddOn": false,
|
|
8
|
+
"isEnterprise": false,
|
|
9
|
+
"isInternal": false,
|
|
10
|
+
"isBeta": true,
|
|
11
|
+
"isHidden": false,
|
|
12
|
+
"requiresAI": true,
|
|
13
|
+
"policyType": "ai-gateway-model-override",
|
|
14
|
+
"products": ["ai-gateway"],
|
|
15
|
+
"description": "Forces one model for every request, or supplies a default model when a request omits one, then stores that selection for the AI Gateway handler.\n\nAn earlier policy's model selection is never overwritten, so a custom routing policy placed before this one stays authoritative.",
|
|
16
|
+
"deprecatedMessage": "",
|
|
17
|
+
"required": ["handler"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"handler": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"default": {},
|
|
22
|
+
"required": ["export", "module", "options"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"export": {
|
|
25
|
+
"const": "AIGatewayModelOverrideInboundPolicy",
|
|
26
|
+
"description": "The name of the exported type"
|
|
27
|
+
},
|
|
28
|
+
"module": {
|
|
29
|
+
"const": "$import(@zuplo/runtime)",
|
|
30
|
+
"description": "The module containing the policy"
|
|
31
|
+
},
|
|
32
|
+
"options": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"title": "AIGatewayModelOverrideInboundPolicyOptions",
|
|
35
|
+
"description": "Options for forcing one model or supplying a default model for each AI Gateway capability.",
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"required": ["models"],
|
|
38
|
+
"properties": {
|
|
39
|
+
"models": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"title": "Models",
|
|
42
|
+
"description": "Override rules grouped by AI Gateway capability.",
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"minProperties": 1,
|
|
45
|
+
"properties": {
|
|
46
|
+
"completions": {
|
|
47
|
+
"title": "Completions Override",
|
|
48
|
+
"description": "Rule for chat completions, Responses, and Anthropic Messages requests.",
|
|
49
|
+
"oneOf": [
|
|
50
|
+
{
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"required": ["force"],
|
|
54
|
+
"properties": {
|
|
55
|
+
"force": {
|
|
56
|
+
"title": "Forced Model",
|
|
57
|
+
"description": "The model every request uses; a request-selected model is ignored.",
|
|
58
|
+
"type": "string",
|
|
59
|
+
"pattern": "^[^/\\s]+/.+$"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "object",
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"required": ["default"],
|
|
67
|
+
"properties": {
|
|
68
|
+
"default": {
|
|
69
|
+
"title": "Default Model",
|
|
70
|
+
"description": "The model used only when a request does not select one.",
|
|
71
|
+
"type": "string",
|
|
72
|
+
"pattern": "^[^/\\s]+/.+$"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"embeddings": {
|
|
79
|
+
"title": "Embeddings Override",
|
|
80
|
+
"description": "Rule for embedding requests.",
|
|
81
|
+
"oneOf": [
|
|
82
|
+
{
|
|
83
|
+
"type": "object",
|
|
84
|
+
"additionalProperties": false,
|
|
85
|
+
"required": ["force"],
|
|
86
|
+
"properties": {
|
|
87
|
+
"force": {
|
|
88
|
+
"title": "Forced Model",
|
|
89
|
+
"description": "The model every request uses; a request-selected model is ignored.",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"pattern": "^[^/\\s]+/.+$"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"type": "object",
|
|
97
|
+
"additionalProperties": false,
|
|
98
|
+
"required": ["default"],
|
|
99
|
+
"properties": {
|
|
100
|
+
"default": {
|
|
101
|
+
"title": "Default Model",
|
|
102
|
+
"description": "The model used only when a request does not select one.",
|
|
103
|
+
"type": "string",
|
|
104
|
+
"pattern": "^[^/\\s]+/.+$"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"examples": [
|
|
116
|
+
{
|
|
117
|
+
"export": "AIGatewayModelOverrideInboundPolicy",
|
|
118
|
+
"module": "$import(@zuplo/runtime)",
|
|
119
|
+
"options": {
|
|
120
|
+
"models": {}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
package/docs/policies/{comet-opik-tracing-v2-inbound → ai-gateway-opik-tracing-inbound}/doc.md
RENAMED
|
@@ -21,10 +21,10 @@ chain that should emit traces:
|
|
|
21
21
|
|
|
22
22
|
```json
|
|
23
23
|
{
|
|
24
|
-
"name": "
|
|
25
|
-
"policyType": "
|
|
24
|
+
"name": "ai-gateway-opik-tracing-inbound",
|
|
25
|
+
"policyType": "ai-gateway-opik-tracing",
|
|
26
26
|
"handler": {
|
|
27
|
-
"export": "
|
|
27
|
+
"export": "AIGatewayOpikTracingInboundPolicy",
|
|
28
28
|
"module": "$import(@zuplo/runtime)",
|
|
29
29
|
"options": {
|
|
30
30
|
"apiKey": "$env(COMET_OPIK_API_KEY)",
|
package/docs/policies/{comet-opik-tracing-v2-inbound → ai-gateway-opik-tracing-inbound}/schema.json
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/
|
|
3
|
+
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/ai-gateway-opik-tracing-inbound.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "Comet Opik Tracing",
|
|
6
6
|
"isDeprecated": false,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": true,
|
|
13
|
-
"policyType": "
|
|
13
|
+
"policyType": "ai-gateway-opik-tracing",
|
|
14
14
|
"products": ["ai-gateway"],
|
|
15
15
|
"description": "Comet Opik Tracing Inbound Policy",
|
|
16
16
|
"deprecatedMessage": "",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"required": ["export", "module", "options"],
|
|
23
23
|
"properties": {
|
|
24
24
|
"export": {
|
|
25
|
-
"const": "
|
|
25
|
+
"const": "AIGatewayOpikTracingInboundPolicy",
|
|
26
26
|
"description": "The name of the exported type"
|
|
27
27
|
},
|
|
28
28
|
"module": {
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
"description": "The module containing the policy"
|
|
31
31
|
},
|
|
32
32
|
"options": {
|
|
33
|
-
"
|
|
34
|
-
"title": "Comet Opik Tracing",
|
|
33
|
+
"title": "AIGatewayOpikTracingInboundPolicyOptions",
|
|
35
34
|
"description": "Track AI Gateway requests and responses using Comet Opik's LLM observability platform.",
|
|
36
35
|
"type": "object",
|
|
37
36
|
"examples": [
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
},
|
|
89
88
|
"examples": [
|
|
90
89
|
{
|
|
91
|
-
"export": "
|
|
90
|
+
"export": "AIGatewayOpikTracingInboundPolicy",
|
|
92
91
|
"module": "$import(@zuplo/runtime)",
|
|
93
92
|
"options": {
|
|
94
93
|
"apiKey": "$env(COMET_OPIK_API_KEY)",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/ai-gateway-semantic-cache-
|
|
3
|
+
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/ai-gateway-semantic-cache-inbound.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "AI Gateway Semantic Cache",
|
|
6
6
|
"isDeprecated": false,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": true,
|
|
13
|
-
"policyType": "ai-gateway-semantic-cache
|
|
13
|
+
"policyType": "ai-gateway-semantic-cache",
|
|
14
14
|
"products": ["ai-gateway"],
|
|
15
15
|
"description": "AI Gateway Semantic Cache policy. This inbound policy looks up the semantic cache on entry and, on a miss, registers a response-sending hook to write the upstream response back into the cache.\n\nCaching parameters (semanticTolerance, expirationSecondsTtl, namespace, recentMessageCount) come from the policy options, and presence in the route's chain is what enables it. An id from the authenticated app configuration always provides the cache namespace so application-supplied options cannot cross tenant partitions. The cache key covers the system prompt plus the last `recentMessageCount` messages (default 1) — applied when storing and when matching — so multi-turn conversations can hit entries cached from earlier, shorter ones.\n\nCache outcomes are reported on the response via the RFC 9211 `Cache-Status` header under the cache name `zp-aigw-sem-cache` (hit: `zp-aigw-sem-cache; hit; detail=\"similarity=0.93\"`; miss: `zp-aigw-sem-cache; fwd=miss; stored`). Responses also include the `x-ai-gateway-cache: HIT|MISS` and `x-ai-gateway-cache-similarity` headers.",
|
|
16
16
|
"deprecatedMessage": "",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"required": ["export", "module", "options"],
|
|
23
23
|
"properties": {
|
|
24
24
|
"export": {
|
|
25
|
-
"const": "
|
|
25
|
+
"const": "AIGatewaySemanticCacheInboundPolicy",
|
|
26
26
|
"description": "The name of the exported type"
|
|
27
27
|
},
|
|
28
28
|
"module": {
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"description": "The module containing the policy"
|
|
31
31
|
},
|
|
32
32
|
"options": {
|
|
33
|
-
"x-zuplo-policy-type": "ai-gateway-semantic-cache-v2",
|
|
34
33
|
"type": "object",
|
|
35
34
|
"title": "AIGatewaySemanticCacheInboundPolicyOptions",
|
|
36
35
|
"description": "Options for the AI Gateway Semantic Cache policy. Configured inline in policies.json; the policy reads nothing from the AI Gateway configuration to decide whether to cache.",
|
|
@@ -106,7 +105,7 @@
|
|
|
106
105
|
},
|
|
107
106
|
"examples": [
|
|
108
107
|
{
|
|
109
|
-
"export": "
|
|
108
|
+
"export": "AIGatewaySemanticCacheInboundPolicy",
|
|
110
109
|
"module": "$import(@zuplo/runtime)",
|
|
111
110
|
"options": {
|
|
112
111
|
"semanticTolerance": 0.2,
|
|
@@ -53,8 +53,8 @@ within one app, or between two — is never mistaken for smart routing that is
|
|
|
53
53
|
simply doing nothing.
|
|
54
54
|
|
|
55
55
|
The classifier application must not run
|
|
56
|
-
[Akamai AI Firewall](/docs/policies/akamai-
|
|
57
|
-
firewall would inspect the internal classification call as if it were a
|
|
56
|
+
[Akamai AI Firewall](/docs/policies/ai-gateway-akamai-firewall-inbound) either.
|
|
57
|
+
That firewall would inspect the internal classification call as if it were a
|
|
58
58
|
completion request — scanning the classifier's system prompt and JSON-only
|
|
59
59
|
response for injection/malicious-content patterns — and a resulting denial makes
|
|
60
60
|
Smart Router fail open, indistinguishable from smart routing quietly doing
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"description": "The module containing the policy"
|
|
31
31
|
},
|
|
32
32
|
"options": {
|
|
33
|
-
"x-zuplo-policy-type": "ai-gateway-smart-router",
|
|
34
33
|
"type": "object",
|
|
35
34
|
"title": "AIGatewaySmartRouterInboundPolicyOptions",
|
|
36
35
|
"description": "Options for the Smart Router policy: classify the last user prompt with a dedicated classifier AI Gateway app, then optionally route by complexity.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zuplo",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The official Zuplo CLI for local development and platform management",
|
|
6
6
|
"homepage": "https://zuplo.com/docs/cli/overview",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"zuplo": "zuplo.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@zuplo/cli": "7.
|
|
36
|
-
"@zuplo/core": "7.
|
|
37
|
-
"@zuplo/runtime": "7.
|
|
38
|
-
"@zuplo/test": "7.
|
|
35
|
+
"@zuplo/cli": "7.9.2",
|
|
36
|
+
"@zuplo/core": "7.9.2",
|
|
37
|
+
"@zuplo/runtime": "7.9.2",
|
|
38
|
+
"@zuplo/test": "7.9.2"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
The AI Gateway Configuration Loader loads each application's configuration into
|
|
2
|
-
the request-scoped channel — reusing the channel from route-level
|
|
3
|
-
`ai-gateway-auth-v2-inbound` when present, otherwise fetching by path `app_id`.
|
|
4
|
-
It does not run the application's policy chain; place
|
|
5
|
-
`ai-gateway-configuration-executor-v2-inbound` after it for that. When this
|
|
6
|
-
loader is omitted, the executor still loads configuration itself.
|
/package/docs/policies/{akamai-ai-firewall-v2-inbound → ai-gateway-akamai-firewall-inbound}/intro.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/docs/policies/{galileo-tracing-v2-inbound → ai-gateway-galileo-tracing-inbound}/intro.md
RENAMED
|
File without changes
|
/package/docs/policies/{ai-gateway-metering-v2-inbound → ai-gateway-metering-inbound}/intro.md
RENAMED
|
File without changes
|
|
File without changes
|
/package/docs/policies/{comet-opik-tracing-v2-inbound → ai-gateway-opik-tracing-inbound}/intro.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|