zuplo 7.2.3 → 7.2.4

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.
Files changed (157) hide show
  1. package/docs/ai-gateway/integrations/ai-sdk.mdx +3 -2
  2. package/docs/ai-gateway/integrations/claude-code.mdx +3 -2
  3. package/docs/ai-gateway/integrations/codex.mdx +7 -5
  4. package/docs/ai-gateway/integrations/goose.mdx +4 -3
  5. package/docs/ai-gateway/integrations/langchain.mdx +3 -3
  6. package/docs/ai-gateway/integrations/openai.mdx +3 -3
  7. package/docs/ai-gateway/policies/overview.mdx +3 -17
  8. package/docs/ai-gateway/universal-api.mdx +4 -3
  9. package/docs/caching/custom-caching-policy.mdx +1 -1
  10. package/docs/caching/gateway-caching.mdx +3 -3
  11. package/docs/caching/overview.mdx +10 -10
  12. package/docs/dedicated/akamai/ai-powered-applications.mdx +2 -2
  13. package/docs/dev-portal/zudoku/configuration/search.md +5 -0
  14. package/docs/dev-portal/zudoku/openapi-extensions/x-mcp-server.md +30 -0
  15. package/docs/policies/_index.md +12 -7
  16. package/docs/policies/ai-gateway-auth-v2-inbound/doc.md +168 -0
  17. package/docs/policies/ai-gateway-auth-v2-inbound/intro.md +10 -0
  18. package/docs/policies/ai-gateway-auth-v2-inbound/schema.json +74 -0
  19. package/docs/policies/ai-gateway-configuration-executor-v2-inbound/doc.md +442 -0
  20. package/docs/policies/ai-gateway-configuration-executor-v2-inbound/intro.md +14 -0
  21. package/docs/policies/ai-gateway-configuration-executor-v2-inbound/schema.json +60 -0
  22. package/docs/policies/ai-gateway-configuration-loader-v2-inbound/doc.md +105 -0
  23. package/docs/policies/ai-gateway-configuration-loader-v2-inbound/intro.md +6 -0
  24. package/docs/policies/ai-gateway-configuration-loader-v2-inbound/schema.json +60 -0
  25. package/docs/policies/ai-gateway-dlp-inbound/doc.md +127 -0
  26. package/docs/policies/ai-gateway-dlp-inbound/intro.md +5 -0
  27. package/docs/policies/ai-gateway-dlp-inbound/schema.json +4050 -0
  28. package/docs/policies/ai-gateway-fallback-model-v2-inbound/doc.md +10 -2
  29. package/docs/policies/ai-gateway-fallback-model-v2-inbound/intro.md +2 -2
  30. package/docs/policies/ai-gateway-fallback-model-v2-inbound/schema.json +22 -8
  31. package/docs/policies/ai-gateway-metering-v2-inbound/doc.md +19 -16
  32. package/docs/policies/ai-gateway-metering-v2-inbound/intro.md +9 -0
  33. package/docs/policies/ai-gateway-metering-v2-inbound/schema.json +20 -24
  34. package/docs/policies/ai-gateway-model-filtering-v2-inbound/doc.md +6 -5
  35. package/docs/policies/ai-gateway-model-filtering-v2-inbound/intro.md +2 -2
  36. package/docs/policies/ai-gateway-model-filtering-v2-inbound/schema.json +17 -3
  37. package/docs/policies/ai-gateway-semantic-cache-v2-inbound/doc.md +72 -0
  38. package/docs/policies/ai-gateway-semantic-cache-v2-inbound/intro.md +9 -0
  39. package/docs/policies/ai-gateway-semantic-cache-v2-inbound/schema.json +120 -0
  40. package/docs/policies/akamai-ai-firewall-v2-inbound/doc.md +87 -0
  41. package/docs/policies/akamai-ai-firewall-v2-inbound/intro.md +10 -0
  42. package/docs/policies/{akamai-ai-firewall → akamai-ai-firewall-v2-inbound}/schema.json +36 -9
  43. package/docs/policies/akamai-firewall-for-ai-inbound/schema.json +1 -0
  44. package/docs/policies/akamai-firewall-for-ai-outbound/schema.json +1 -0
  45. package/docs/policies/amberflo-metering-inbound/schema.json +1 -0
  46. package/docs/policies/api-key-inbound/schema.json +1 -0
  47. package/docs/policies/audit-log-inbound/schema.json +1 -0
  48. package/docs/policies/auth0-jwt-auth-inbound/schema.json +1 -0
  49. package/docs/policies/authzen-inbound/schema.json +1 -0
  50. package/docs/policies/axiomatics-authz-inbound/schema.json +1 -0
  51. package/docs/policies/basic-auth-inbound/schema.json +1 -0
  52. package/docs/policies/bot-detection-inbound/schema.json +1 -0
  53. package/docs/policies/brownout-inbound/schema.json +1 -0
  54. package/docs/policies/caching-inbound/schema.json +1 -0
  55. package/docs/policies/cdn-cache-control-outbound/schema.json +1 -0
  56. package/docs/policies/change-method-inbound/schema.json +1 -0
  57. package/docs/policies/clear-headers-inbound/schema.json +1 -0
  58. package/docs/policies/clear-headers-outbound/schema.json +1 -0
  59. package/docs/policies/clerk-jwt-auth-inbound/schema.json +1 -0
  60. package/docs/policies/cognito-jwt-auth-inbound/schema.json +1 -0
  61. package/docs/policies/comet-opik-tracing-v2-inbound/doc.md +78 -0
  62. package/docs/policies/comet-opik-tracing-v2-inbound/intro.md +10 -0
  63. package/docs/policies/{comet-opik-tracing-inbound → comet-opik-tracing-v2-inbound}/schema.json +40 -5
  64. package/docs/policies/complex-rate-limit-inbound/schema.json +1 -0
  65. package/docs/policies/composite-inbound/schema.json +1 -0
  66. package/docs/policies/composite-outbound/schema.json +1 -0
  67. package/docs/policies/curity-phantom-token-inbound/schema.json +1 -0
  68. package/docs/policies/data-loss-prevention-inbound/doc.md +22 -6
  69. package/docs/policies/data-loss-prevention-inbound/schema.json +10 -1
  70. package/docs/policies/data-loss-prevention-outbound/doc.md +23 -6
  71. package/docs/policies/data-loss-prevention-outbound/schema.json +10 -1
  72. package/docs/policies/firebase-jwt-inbound/schema.json +1 -0
  73. package/docs/policies/formdata-to-json-inbound/schema.json +1 -0
  74. package/docs/policies/galileo-tracing-v2-inbound/doc.md +72 -0
  75. package/docs/policies/galileo-tracing-v2-inbound/intro.md +8 -0
  76. package/docs/policies/{galileo-tracing-inbound → galileo-tracing-v2-inbound}/schema.json +40 -5
  77. package/docs/policies/geo-filter-inbound/schema.json +1 -0
  78. package/docs/policies/graphql-analytics-outbound/schema.json +1 -0
  79. package/docs/policies/graphql-cache-inbound/schema.json +1 -0
  80. package/docs/policies/graphql-complexity-limit-inbound/schema.json +1 -0
  81. package/docs/policies/graphql-disable-introspection-inbound/schema.json +1 -0
  82. package/docs/policies/graphql-introspection-filter-outbound/schema.json +1 -0
  83. package/docs/policies/http-deprecation-outbound/schema.json +1 -0
  84. package/docs/policies/ip-address-restriction-inbound/schema.json +1 -0
  85. package/docs/policies/jwt-scopes-inbound/schema.json +1 -0
  86. package/docs/policies/ldap-auth-inbound/schema.json +1 -0
  87. package/docs/policies/mcp-auth0-oauth-inbound/schema.json +1 -0
  88. package/docs/policies/mcp-capability-filter-inbound/schema.json +1 -0
  89. package/docs/policies/mcp-clerk-oauth-inbound/schema.json +1 -0
  90. package/docs/policies/mcp-cognito-oauth-inbound/schema.json +1 -0
  91. package/docs/policies/mcp-entra-oauth-inbound/schema.json +1 -0
  92. package/docs/policies/mcp-google-oauth-inbound/schema.json +1 -0
  93. package/docs/policies/mcp-keycloak-oauth-inbound/schema.json +1 -0
  94. package/docs/policies/mcp-logto-oauth-inbound/schema.json +1 -0
  95. package/docs/policies/mcp-oauth-inbound/schema.json +1 -0
  96. package/docs/policies/mcp-okta-oauth-inbound/schema.json +1 -0
  97. package/docs/policies/mcp-onelogin-oauth-inbound/schema.json +1 -0
  98. package/docs/policies/mcp-ping-oauth-inbound/schema.json +1 -0
  99. package/docs/policies/mcp-token-exchange-inbound/schema.json +1 -0
  100. package/docs/policies/mcp-workos-oauth-inbound/schema.json +1 -0
  101. package/docs/policies/mock-api-inbound/schema.json +1 -0
  102. package/docs/policies/moesif-inbound/schema.json +1 -0
  103. package/docs/policies/monetization-inbound/schema.json +1 -0
  104. package/docs/policies/mtls-auth-inbound/schema.json +1 -0
  105. package/docs/policies/okta-fga-authz-inbound/schema.json +1 -0
  106. package/docs/policies/okta-jwt-auth-inbound/schema.json +1 -0
  107. package/docs/policies/open-id-jwt-auth-inbound/schema.json +1 -0
  108. package/docs/policies/openfga-authz-inbound/schema.json +1 -0
  109. package/docs/policies/openmeter-inbound/schema.json +1 -0
  110. package/docs/policies/prompt-injection-outbound/schema.json +1 -0
  111. package/docs/policies/propel-auth-jwt-inbound/schema.json +1 -0
  112. package/docs/policies/query-param-to-header-inbound/schema.json +1 -0
  113. package/docs/policies/quota-inbound/schema.json +1 -0
  114. package/docs/policies/rate-limit-inbound/schema.json +1 -0
  115. package/docs/policies/readme-metrics-inbound/schema.json +1 -0
  116. package/docs/policies/remove-headers-inbound/schema.json +1 -0
  117. package/docs/policies/remove-headers-outbound/schema.json +1 -0
  118. package/docs/policies/remove-query-params-inbound/schema.json +1 -0
  119. package/docs/policies/replace-string-outbound/schema.json +1 -0
  120. package/docs/policies/request-size-limit-inbound/schema.json +1 -0
  121. package/docs/policies/request-validation-inbound/schema.json +1 -0
  122. package/docs/policies/require-origin-inbound/schema.json +1 -0
  123. package/docs/policies/require-user-claims-inbound/schema.json +1 -0
  124. package/docs/policies/secret-masking-outbound/schema.json +1 -0
  125. package/docs/policies/semantic-cache-inbound/schema.json +3 -2
  126. package/docs/policies/set-body-inbound/schema.json +1 -0
  127. package/docs/policies/set-headers-inbound/schema.json +1 -0
  128. package/docs/policies/set-headers-outbound/schema.json +1 -0
  129. package/docs/policies/set-query-params-inbound/schema.json +1 -0
  130. package/docs/policies/set-status-outbound/schema.json +1 -0
  131. package/docs/policies/set-upstream-api-key-inbound/schema.json +1 -0
  132. package/docs/policies/sleep-inbound/schema.json +1 -0
  133. package/docs/policies/stripe-webhook-verification-inbound/schema.json +1 -0
  134. package/docs/policies/supabase-jwt-auth-inbound/schema.json +1 -0
  135. package/docs/policies/traffic-splitting-inbound/schema.json +1 -0
  136. package/docs/policies/upstream-aws-federated-auth-inbound/schema.json +1 -0
  137. package/docs/policies/upstream-aws-service-auth-inbound/schema.json +1 -0
  138. package/docs/policies/upstream-azure-ad-service-auth-inbound/schema.json +1 -0
  139. package/docs/policies/upstream-firebase-admin-auth-inbound/schema.json +1 -0
  140. package/docs/policies/upstream-firebase-user-auth-inbound/schema.json +1 -0
  141. package/docs/policies/upstream-gcp-federated-auth-inbound/schema.json +1 -0
  142. package/docs/policies/upstream-gcp-jwt-inbound/schema.json +1 -0
  143. package/docs/policies/upstream-gcp-service-auth-inbound/schema.json +1 -0
  144. package/docs/policies/upstream-oauth-client-credentials-inbound/schema.json +1 -0
  145. package/docs/policies/upstream-zuplo-jwt-auth-inbound/schema.json +1 -0
  146. package/docs/policies/validate-json-schema-inbound/schema.json +1 -0
  147. package/docs/policies/web-bot-auth-inbound/schema.json +1 -0
  148. package/docs/policies/xml-to-json-outbound/schema.json +1 -0
  149. package/package.json +5 -5
  150. package/docs/ai-gateway/policies/akamai-ai-firewall.mdx +0 -122
  151. package/docs/ai-gateway/policies/authentication.mdx +0 -43
  152. package/docs/ai-gateway/policies/comet-opik-tracing.mdx +0 -177
  153. package/docs/ai-gateway/policies/fallback-model.mdx +0 -40
  154. package/docs/ai-gateway/policies/galileo-tracing.mdx +0 -161
  155. package/docs/ai-gateway/policies/metering.mdx +0 -47
  156. package/docs/ai-gateway/policies/model-filtering.mdx +0 -49
  157. package/docs/ai-gateway/policies/semantic-cache.mdx +0 -48
@@ -1,177 +0,0 @@
1
- ---
2
- title: Comet Opik tracing
3
- sidebar_label: Comet Opik tracing
4
- description:
5
- Send LLM traces from the Zuplo AI Gateway to Comet Opik for observability,
6
- debugging, and evaluation of your AI applications.
7
- ---
8
-
9
- The Comet Opik Tracing policy integrates
10
- [Comet Opik](https://www.comet.com/docs/opik/) with the Zuplo AI Gateway,
11
- enabling comprehensive observability, tracing, and evaluation of your LLM
12
- applications in both development and production environments.
13
-
14
- Comet Opik is an open-source platform designed to help developers track, view,
15
- and evaluate Large Language Model (LLM) traces throughout the application
16
- lifecycle. By integrating Opik with the Zuplo AI Gateway, you gain complete
17
- visibility into your AI operations, from development debugging to production
18
- monitoring.
19
-
20
- ### Key Capabilities
21
-
22
- The Comet Opik integration provides powerful observability and evaluation
23
- features:
24
-
25
- - **Comprehensive trace logging**: Automatically capture LLM calls, inputs,
26
- outputs, and metadata
27
- - **Development debugging**: Annotate and label traces through SDK or UI for
28
- iterative improvement
29
- - **LLM evaluation**: Use LLM-as-a-Judge and heuristic evaluators to score trace
30
- quality
31
- - **Production monitoring**: Track feedback scores, trace counts, tokens, and
32
- performance metrics at scale
33
- - **High-volume ingestion**: Support for up to 40 million traces per day
34
- - **Dataset management**: Store and run evaluations on test datasets
35
-
36
- ## Adding the policy to an app
37
-
38
- The scaffolded gateway declares the Comet Opik Tracing policy in
39
- `config/policies.json`. Configure it once for the gateway, then add it to each
40
- app that should send traces:
41
-
42
- <Stepper>
43
-
44
- 1. In your Comet account, create (or pick) a Comet project and workspace and
45
- generate an API key.
46
-
47
- 2. In your gateway's repository, set the policy's settings and push:
48
-
49
- ```json title="config/policies.json"
50
- {
51
- "name": "comet-opik-tracing-v2-inbound",
52
- "policyType": "comet-opik-tracing-v2-inbound",
53
- "handler": {
54
- "export": "CometOpikTracingV2InboundPolicy",
55
- "module": "$import(@zuplo/runtime)",
56
- "options": {
57
- "apiKey": "your-opik-api-key",
58
- "projectName": "your-project-name",
59
- "workspace": "your-workspace"
60
- }
61
- }
62
- }
63
- ```
64
-
65
- 3. Open the app's **Policies** tab, click **Add Policy**, and add **Comet Opik
66
- Tracing**. Place it at the end of the chain so traces reflect the request the
67
- provider actually receives.
68
-
69
- </Stepper>
70
-
71
- ## Benefits with Zuplo AI Gateway
72
-
73
- Integrating Comet Opik with the Zuplo AI Gateway provides several advantages:
74
-
75
- ### Complete Application Observability
76
-
77
- Track entire LLM workflows including preprocessing, retrieval steps, model
78
- calls, and post-processing through your API gateway, providing end-to-end
79
- visibility.
80
-
81
- ### Development and Production Parity
82
-
83
- Use the same tracing infrastructure in both development and production
84
- environments, ensuring consistent observability throughout your application
85
- lifecycle.
86
-
87
- ### Automatic Trace Capture
88
-
89
- The policy automatically logs all AI Gateway requests and responses without
90
- requiring code changes to your LLM application, simplifying instrumentation.
91
-
92
- ### Performance Insights
93
-
94
- Monitor token usage, latency, error rates, and costs across all your AI
95
- operations with detailed analytics dashboards.
96
-
97
- ### Quality Assurance
98
-
99
- Evaluate LLM outputs using both automated metrics and LLM-as-a-Judge approaches
100
- to maintain quality standards as your application evolves.
101
-
102
- ## How It Works
103
-
104
- ### Trace Logging
105
-
106
- The policy captures comprehensive information about each LLM interaction:
107
-
108
- 1. **Request data**: User prompts, input parameters, and metadata
109
- 2. **Response data**: Model outputs, token counts, and generation details
110
- 3. **Performance metrics**: Latency, processing time, and resource usage
111
- 4. **Custom metadata**: Tags, conversation IDs, and application-specific data
112
-
113
- ### Trace Organization
114
-
115
- Traces are organized hierarchically to represent complex workflows:
116
-
117
- - **Traces**: Top-level records representing complete user interactions
118
- - **Spans**: Nested operations within a trace (retrieval, generation, etc.)
119
- - **Thread IDs**: Group related traces by conversation or session
120
-
121
- ### Evaluation Framework
122
-
123
- Opik provides multiple evaluation approaches:
124
-
125
- #### Heuristic Metrics
126
-
127
- Deterministic evaluation methods including:
128
-
129
- - **Exact match**: Verify outputs match expected values
130
- - **Contains**: Check for presence of specific content
131
- - **Regex patterns**: Validate output structure and format
132
-
133
- #### LLM-as-a-Judge Metrics
134
-
135
- AI-powered evaluation for subjective quality assessment:
136
-
137
- - **Hallucination detection**: Identify factually incorrect outputs
138
- - **Relevance scoring**: Measure response appropriateness
139
- - **Tone and style**: Evaluate alignment with brand guidelines
140
- - **Safety checks**: Detect harmful or inappropriate content
141
-
142
- ## Use Cases
143
-
144
- ### Debugging LLM Applications
145
-
146
- Identify and fix issues in LLM applications by examining detailed trace logs,
147
- including inputs, outputs, and intermediate steps.
148
-
149
- ### A/B Testing AI Models
150
-
151
- Compare performance across different models, prompts, or configurations by
152
- analyzing traces grouped by experiment variants.
153
-
154
- ### Cost Optimization
155
-
156
- Monitor token usage patterns to identify optimization opportunities and reduce
157
- AI operation costs.
158
-
159
- ### Compliance and Auditing
160
-
161
- Maintain detailed audit logs of all AI interactions for regulatory compliance
162
- and security requirements.
163
-
164
- ### Quality Regression Testing
165
-
166
- Track LLM output quality over time using automated evaluations, catching
167
- degradation before it impacts users.
168
-
169
- ### Conversation Analytics
170
-
171
- Analyze multi-turn conversations using thread IDs to understand user journeys
172
- and improve conversational AI experiences.
173
-
174
- **Additional Resources**
175
-
176
- - [Comet Opik Documentation](https://www.comet.com/docs/opik/)
177
- - [Opik Tracing Guide](https://www.comet.com/docs/opik/tracing/log_traces)
@@ -1,40 +0,0 @@
1
- ---
2
- title: Fallback Model
3
- sidebar_label: Fallback Model
4
- description:
5
- Add a backup model for provider errors and timeouts, and a cheaper model for
6
- when a budget runs out.
7
- ---
8
-
9
- `ai-gateway-fallback-model-v2`
10
-
11
- Fallback Model adds two kinds of backup to an app's model selection, per
12
- capability:
13
-
14
- - **`fallback`**—the model to try after a provider error that can be retried, or
15
- after a timeout.
16
- - **`quotaFallback`**—the model to use when a usage limit is hit, instead of
17
- rejecting the request. [Budgets and Costs](./metering.mdx) is what applies
18
- this.
19
-
20
- `fallbackTimeoutSeconds` controls how long the gateway waits before giving up on
21
- the main model and trying the fallback. It defaults to 60 seconds and accepts 1
22
- to 300. A fallback that names the same model as the main one is skipped.
23
-
24
- :::warning
25
-
26
- This policy only enriches a model selection that already exists—it never creates
27
- one. An app whose chain has Fallback Model but no
28
- [Model Filtering](./model-filtering.mdx) does nothing at all: the policy logs a
29
- warning and passes the request through unchanged. Place Fallback Model
30
- immediately after Model Filtering.
31
-
32
- :::
33
-
34
- That ordering is also why a fallback can never widen what an app may reach—the
35
- filter has already accepted or rejected the request by the time this policy
36
- runs.
37
-
38
- For the portal workflow and worked examples see
39
- [Fallback Models](../fallback.mdx); for every option see the
40
- [generated reference](/policies/ai-gateway-fallback-model-v2-inbound).
@@ -1,161 +0,0 @@
1
- ---
2
- title: Galileo tracing
3
- sidebar_label: Galileo tracing
4
- description:
5
- Send LLM traces from the Zuplo AI Gateway to Galileo for monitoring,
6
- debugging, and quality evaluation of your AI applications.
7
- ---
8
-
9
- The Galileo Tracing policy integrates [Galileo AI](https://www.galileo.ai/) with
10
- the Zuplo AI Gateway, providing comprehensive observability, monitoring, and
11
- evaluation of your LLM applications. This policy automatically captures detailed
12
- traces of all AI Gateway requests and responses, enabling you to monitor
13
- performance, debug issues, and optimize your AI operations.
14
-
15
- ## Key Features
16
-
17
- - **Automatic Trace Capture**: Seamlessly logs all LLM requests and responses
18
- without code changes
19
- - **Streaming Support**: Handles both streaming and non-streaming responses
20
- - **Performance Monitoring**: Tracks token usage, latency, and resource
21
- consumption
22
- - **Hierarchical Tracing**: Organizes traces with workflow and LLM spans for
23
- detailed analysis
24
-
25
- ## How It Works
26
-
27
- ### Trace Structure
28
-
29
- The policy creates a hierarchical trace structure for each AI Gateway request:
30
-
31
- 1. **Trace**: Top-level record representing the complete user interaction
32
- 2. **Workflow Span**: Contains the entire AI Gateway workflow
33
- 3. **LLM Span**: Captures the specific LLM API call details
34
-
35
- ### Data Captured
36
-
37
- For each request, the policy automatically captures:
38
-
39
- **Request Information**
40
-
41
- - User prompts and messages
42
- - Model parameters (temperature, `max_tokens`, etc.)
43
- - Request metadata (route, request ID)
44
- - Timestamp and duration
45
-
46
- **Response Information**
47
-
48
- - Model outputs and completions
49
- - Token usage (input, output, total tokens)
50
- - Finish reasons and status
51
- - Performance metrics
52
-
53
- **Metadata**
54
-
55
- - Request ID for correlation
56
- - Route information
57
- - Custom tags for categorization
58
- - Duration in nanoseconds for precise timing
59
-
60
- ## Configuration
61
-
62
- <Stepper>
63
-
64
- 1. ### Obtain Galileo Credentials
65
- 1. Sign up for a
66
- [Galileo](https://galileo.ai?utm_source=zuplo&utm_medium=web) account
67
- 2. Create a new Galileo project in your Galileo dashboard
68
- 3. Generate an API key specifically for use with Zuplo
69
-
70
- :::note
71
-
72
- The `projectId` and `logStreamId` are both found in the URL of the Galileo
73
- log stream you want to use. For example:
74
- `https://app.galileo.ai/your-app/project/3e71c65e-48b6-4f5d-842d-0851c4704f95/log-streams/f8c71402-1f6b-4f5b-b073-1de999e6a8ea`.
75
-
76
- In this case, the `projectId` is `3e71c65e-48b6-4f5d-842d-0851c4704f95` and
77
- the `logStreamId` is `f8c71402-1f6b-4f5b-b073-1de999e6a8ea`.
78
-
79
- :::
80
-
81
- 2. ### Configure the declaration in your gateway's repository
82
-
83
- The scaffolded gateway declares the Galileo Tracing policy in
84
- `config/policies.json`. Set its settings and push:
85
-
86
- ```json title="config/policies.json"
87
- {
88
- "name": "galileo-tracing-v2-inbound",
89
- "policyType": "galileo-tracing-v2-inbound",
90
- "handler": {
91
- "export": "GalileoTracingV2InboundPolicy",
92
- "module": "$import(@zuplo/runtime)",
93
- "options": {
94
- "apiKey": "your-galileo-api-key",
95
- "projectId": "3e71c65e-48b6-4f5d-842d-0851c4704f95",
96
- "logStreamId": "f8c71402-1f6b-4f5b-b073-1de999e6a8ea"
97
- }
98
- }
99
- }
100
- ```
101
-
102
- 3. ### Add the policy to your app
103
-
104
- Open the app's **Policies** tab, click **Add Policy**, and select **Galileo
105
- Tracing**. Place it at the end of the chain so traces reflect the request
106
- the provider actually receives. The app inherits the configuration from the
107
- declaration.
108
-
109
- </Stepper>
110
-
111
- ### Key Metrics
112
-
113
- The policy automatically tracks:
114
-
115
- - **Token Usage**: Input, output, and total token counts
116
- - **Latency**: Request duration in nanoseconds
117
- - **Throughput**: Requests per second and volume
118
- - **Error Rates**: Failed requests and error patterns
119
- - **Model Performance**: Response quality and completion rates
120
-
121
- ### Custom Metadata
122
-
123
- Each trace includes:
124
-
125
- - Request ID for correlation with logs
126
- - Route information for API endpoint analysis
127
- - Custom tags for categorization
128
- - User-defined metadata from the request context
129
-
130
- ## Benefits of using Galileo Tracing
131
-
132
- ### Development Workflow
133
-
134
- - Debug LLM applications with detailed trace inspection
135
- - Test different models and configurations with comparative analytics
136
- - Monitor quality regression during development cycles
137
-
138
- ### Production Monitoring
139
-
140
- - Track performance and costs across all AI operations
141
- - Identify optimization opportunities through usage pattern analysis
142
- - Maintain audit logs for compliance and security requirements
143
-
144
- ### Quality Assurance
145
-
146
- - Evaluate LLM outputs using Galileo's built-in metrics
147
- - Monitor response quality trends over time
148
- - Implement automated quality gates based on trace data
149
-
150
- ## Troubleshooting
151
-
152
- Common issues and solutions:
153
-
154
- - **Authentication Errors**: Check that your Galileo API key is valid and has
155
- proper permissions
156
- - **Configuration Issues**: Ensure the policy declaration's environment
157
- variables are set in your Zuplo project settings
158
-
159
- ## Additional Resources
160
-
161
- - [Galileo AI Documentation](https://www.galileo.ai/docs)
@@ -1,47 +0,0 @@
1
- ---
2
- title: Budgets and Costs
3
- sidebar_label: Budgets and Costs
4
- description:
5
- Record an app's usage and enforce its budgets for spend, tokens, and requests.
6
- ---
7
-
8
- `ai-gateway-metering-v2`
9
-
10
- The **Budgets and Costs** policy records what an app uses and enforces its
11
- budgets. It meters three things—spend, tokens, and requests—each with
12
- independent daily and monthly periods, and each with an optional warning
13
- threshold that notifies without blocking.
14
-
15
- When a limit is exceeded, the policy either routes the request to the model
16
- selection's `quotaFallback` if [Fallback Model](./fallback-model.mdx) supplied
17
- one, or rejects it with `429`.
18
-
19
- An app's own limits aren't the only ones that apply. The policy also checks the
20
- parent team's and the gateway's limits, which are enforced centrally rather than
21
- from this policy's options—so a request can be blocked by a limit that isn't
22
- visible in the app's chain.
23
-
24
- Place Budgets and Costs after [Model Filtering](./model-filtering.mdx) and
25
- [Fallback Model](./fallback-model.mdx), so an exceeded budget can activate the
26
- quota fallback.
27
-
28
- :::caution{title="Budgets fail open by default"}
29
-
30
- `throwOnFailure` defaults to `false`, so if the metering service is unavailable
31
- the request proceeds unmetered—no limit is checked, even for an app that's
32
- already over budget. Set it to `true` to reject the request instead.
33
-
34
- :::
35
-
36
- :::note
37
-
38
- Each limit period carries an `enabled` flag next to its number, and so does each
39
- warning threshold. A period enforces nothing until `enabled` is `true` _and_
40
- `limit` is set. Watch for this when editing options directly, such as in
41
- `config/policies.json` or a [policy template](../policy-templates.mdx).
42
-
43
- :::
44
-
45
- For the portal workflow and the gateway and team levels see
46
- [Usage Limits](../usage-limits.mdx); for every option see the
47
- [generated reference](/policies/ai-gateway-metering-v2-inbound).
@@ -1,49 +0,0 @@
1
- ---
2
- title: Model Filtering
3
- sidebar_label: Model Filtering
4
- description:
5
- Restrict an app to specific models with an allow list or block list, and set
6
- the default model.
7
- ---
8
-
9
- `ai-gateway-model-filtering-v2`
10
-
11
- Model Filtering decides which models an app may use and creates the model
12
- selection the rest of the chain works from. Without it, an app can reach any
13
- model offered by the providers configured for the Zuplo project.
14
-
15
- Configure each capability—completions, embeddings—in one of two modes. The modes
16
- are mutually exclusive per capability.
17
-
18
- - An **allow list** exposes a curated set of models. The first entry is the
19
- default when a request names no model.
20
- - A **block list** permits every available model except the ones named. Each
21
- request must name its model, because a block list supplies no default.
22
-
23
- Models are written as `providerName/model`, where `providerName` is the provider
24
- name configured in your gateway—for example `openai/gpt-5`.
25
-
26
- ## What a rejected request gets
27
-
28
- | Request | Response |
29
- | ------------------------------------------------ | ----------------------------- |
30
- | A model the rules don't allow | `403`, listing what's allowed |
31
- | No `model` named, in block list mode | `400` |
32
- | A capability the policy doesn't configure at all | `403` |
33
- | A provider name that isn't in the catalog | `400` |
34
-
35
- Rejections are returned as problem details, and the `detail` names what the
36
- caller should have sent—the allowed models for a blocked model, or the gateway's
37
- configured provider names for an unrecognized one. The
38
- [Akamai AI Firewall](./akamai-ai-firewall.mdx) is the exception among the
39
- policies here: it answers in the provider's own error format instead.
40
-
41
- Place Model Filtering first in the chain—it creates the model selection that
42
- [Fallback Model](./fallback-model.mdx) and [Budgets and Costs](./metering.mdx)
43
- build on.
44
-
45
- For the portal workflow see
46
- [Restricting models](../managing-apps.mdx#restricting-models); for every option
47
- see the [generated reference](/policies/ai-gateway-model-filtering-v2-inbound).
48
- When model selection needs logic instead of a list, see
49
- [Dynamic model routing](../cookbooks/dynamic-model-routing.mdx).
@@ -1,48 +0,0 @@
1
- ---
2
- title: Semantic cache
3
- sidebar_label: Semantic cache
4
- description:
5
- Return a cached response when a new prompt is close enough to one the app has
6
- already answered.
7
- ---
8
-
9
- `ai-gateway-semantic-cache-v2-inbound`
10
-
11
- The semantic cache answers a request from a previous response when the new
12
- prompt is semantically similar to one already seen, skipping the provider
13
- entirely. One policy handles both halves: it checks the cache on the way in and,
14
- on a miss, stores the provider's response on the way out. There's no separate
15
- outbound policy to add.
16
-
17
- A cache hit answers the request, so entries after it in the chain don't run.
18
- Place it after [Budgets and Costs](./metering.mdx) so hits still count toward
19
- the app's request limits.
20
-
21
- ## Options
22
-
23
- | Option | Default | What it does |
24
- | ----------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------------- |
25
- | `semanticTolerance` | `0.2` | How loose a match to accept. A response is reused at similarity ≥ 1 − tolerance, so `0.2` needs 0.8 |
26
- | `expirationSecondsTtl` | `3600` | How long a cached response stays valid, up to 30 days |
27
- | `maxConversationLength` | `3` | Longest conversation to cache, in messages |
28
- | `endpoints` | Chat Completions, Anthropic Messages | Which API shapes to cache |
29
- | `namespace` | The app's ID | Cache partition. Only applies when the request has no app configuration |
30
-
31
- ## What isn't cached
32
-
33
- - Conversations longer than `maxConversationLength`—three messages by
34
- default—aren't cached at all.
35
- - The Responses API isn't supported. The cache covers Chat Completions and
36
- Anthropic Messages.
37
- - The cache always fails open: if the cache is unavailable, the request goes to
38
- the provider as normal.
39
-
40
- One app can never read another's cached responses. The namespace is fixed to the
41
- app's ID whenever the request resolves to an app, so the `namespace` option only
42
- matters on a gateway that doesn't identify apps.
43
-
44
- ## Reading cache outcomes
45
-
46
- Each response carries the outcome as a `Cache-Status` header under the cache
47
- name `zp-aigw-sem-cache`, alongside `x-ai-gateway-cache` (`HIT` or `MISS`) and
48
- `x-ai-gateway-cache-similarity`.