zuplo 7.1.1 → 7.1.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.
Files changed (36) hide show
  1. package/docs/ai-gateway/apps.mdx +28 -10
  2. package/docs/ai-gateway/cookbooks/custom-fallback.mdx +96 -0
  3. package/docs/ai-gateway/cookbooks/dynamic-model-routing.mdx +119 -0
  4. package/docs/ai-gateway/custom-policies.mdx +213 -0
  5. package/docs/ai-gateway/custom-providers.mdx +10 -2
  6. package/docs/ai-gateway/fallback.mdx +48 -75
  7. package/docs/ai-gateway/getting-started.mdx +200 -132
  8. package/docs/ai-gateway/integrations/ai-sdk.mdx +71 -28
  9. package/docs/ai-gateway/integrations/claude-code.mdx +32 -8
  10. package/docs/ai-gateway/integrations/codex.mdx +28 -10
  11. package/docs/ai-gateway/integrations/goose.mdx +26 -19
  12. package/docs/ai-gateway/integrations/langchain.mdx +31 -15
  13. package/docs/ai-gateway/integrations/openai.mdx +28 -16
  14. package/docs/ai-gateway/introduction.mdx +73 -32
  15. package/docs/ai-gateway/managing-apps.mdx +62 -17
  16. package/docs/ai-gateway/managing-providers.mdx +23 -7
  17. package/docs/ai-gateway/managing-teams.mdx +29 -12
  18. package/docs/ai-gateway/policies/akamai-ai-firewall.mdx +92 -96
  19. package/docs/ai-gateway/policies/authentication.mdx +44 -0
  20. package/docs/ai-gateway/policies/comet-opik-tracing.mdx +40 -2
  21. package/docs/ai-gateway/policies/fallback-model.mdx +40 -0
  22. package/docs/ai-gateway/policies/galileo-tracing.mdx +36 -22
  23. package/docs/ai-gateway/policies/metering.mdx +47 -0
  24. package/docs/ai-gateway/policies/model-filtering.mdx +49 -0
  25. package/docs/ai-gateway/policies/overview.mdx +28 -0
  26. package/docs/ai-gateway/policies/semantic-cache.mdx +48 -0
  27. package/docs/ai-gateway/policy-chains.mdx +178 -0
  28. package/docs/ai-gateway/policy-templates.mdx +68 -0
  29. package/docs/ai-gateway/providers.mdx +23 -9
  30. package/docs/ai-gateway/source-control.mdx +88 -0
  31. package/docs/ai-gateway/teams.mdx +16 -10
  32. package/docs/ai-gateway/universal-api.mdx +39 -12
  33. package/docs/ai-gateway/usage-limits.mdx +87 -55
  34. package/docs/policies/cdn-cache-control-outbound/doc.md +13 -13
  35. package/package.json +5 -5
  36. package/docs/ai-gateway/guardrails.mdx +0 -65
@@ -1,130 +1,201 @@
1
1
  ---
2
2
  title: Zuplo AI Gateway Getting Started
3
3
  sidebar_label: Getting Started
4
+ description:
5
+ Set up your first AI Gateway project. Connect a Git repository, configure an
6
+ AI provider, create a team and an app, review the app's policy chain, and make
7
+ your first LLM request through Zuplo.
4
8
  ---
5
9
 
6
- This guide will walk you through setting up your first AI Gateway project, from
7
- initial configuration to making your first LLM request through Zuplo.
10
+ This guide walks you through setting up your first AI Gateway project, from
11
+ connecting a Git repository to making your first LLM request through Zuplo.
8
12
 
9
13
  ## Prerequisites
10
14
 
11
15
  - A Zuplo account (sign up free at [zuplo.com](https://zuplo.com))
12
- - API keys for at least one LLM provider (OpenAI, Anthropic, Google, Mistral,
16
+ - An account with a supported Git provider that can create repositories (this
17
+ guide uses GitHub)
18
+ - An API key for at least one LLM provider (OpenAI, Anthropic, Google, Mistral,
13
19
  xAI, etc.)
14
- - An application that needs to call LLM APIs
15
20
 
16
- ## Step 1: Create an AI Gateway Project
21
+ <Stepper>
17
22
 
18
- 1. Log into your Zuplo account
19
- 2. Navigate to **Projects**
20
- 3. Click **New Project**
21
- 4. Click **AI or MCP Gateway** at the bottom of the dialog
22
- 5. Give your project a name (for example, "MyCompany AI Gateway")
23
- 6. Click **Create Project**
23
+ 1. **Create an AI Gateway project**
24
24
 
25
- Your AI Gateway project will be created in seconds. You'll notice the interface
26
- includes Apps, Teams, and a setup guide to help you get started.
25
+ Log into the [Zuplo Portal](https://portal.zuplo.com), navigate to
26
+ **Projects**, and click **New Project**. Choose **Configure an AI gateway**,
27
+ give your project a name (for example, "MyCompany AI Gateway"), and click
28
+ **Create Project**.
27
29
 
28
- ## Step 2: Configure Providers
30
+ 2. **Connect the project to a Git repository**
29
31
 
30
- Providers are the LLM services (like OpenAI or Anthropic) that your applications
31
- will use. You'll configure these once as an administrator, and your team members
32
- can use them without needing direct access to provider API keys.
32
+ Your AI Gateway deploys from source control, so the first step after creating
33
+ the project is connecting it to a repository. The project shows a **Let's Get
34
+ You Deployed** screen until a repository is connected.
33
35
 
34
- ### Adding Your First Provider
36
+ Zuplo supports GitHub, GitLab, Bitbucket, and Azure DevOps. This guide uses
37
+ GitHub, which is the only provider with automatic deployments—see
38
+ [Source Control and Deployment](../concepts/source-control-and-deployment.mdx)
39
+ for the other providers, which deploy through the Zuplo CLI in your own CI/CD
40
+ pipeline.
35
41
 
36
- 1. Click **Add Provider**
37
- 2. Select your AI provider (for example, **OpenAI**)
38
- 3. Enter a name for this provider configuration
39
- 4. Paste your provider's API key
40
- 5. Select which models you want to make available to your teams
41
- 6. Click **Create**
42
+ With GitHub, click **Create New Repo** to open GitHub with the repository
43
+ name prefilled, create the repository, then return to the Zuplo Portal and
44
+ select the repository to connect it. Zuplo adds the gateway's source to the
45
+ repository and deploys it. After that, pushes to your default branch deploy
46
+ to production.
42
47
 
43
- ### Adding Additional Providers
48
+ To work with the gateway's source later—for example, to add
49
+ [custom policies](./custom-policies.mdx)—clone the repository:
44
50
 
45
- Repeat the process above to add more providers. This allows your teams to switch
46
- between providers (OpenAI, Anthropic, etc.) without changing application code.
51
+ ```bash
52
+ git clone https://github.com/your-org/your-gateway-repo.git
53
+ ```
47
54
 
48
- **Example providers you might add:**
55
+ :::note
49
56
 
50
- - OpenAI (for GPT models)
51
- - Anthropic (for Claude models)
52
- - Google (for Gemini models)
53
- - Mistral (for Mistral models)
54
- - xAI (for Grok models)
57
+ If your default branch requires pull requests, Zuplo pushes the gateway
58
+ source to a setup branch and shows you a pull request to merge. The project
59
+ finishes connecting once the pull request lands on the default branch.
55
60
 
56
- See [AI Providers](./providers.mdx) for the full list of supported providers and
57
- capabilities, including OpenAI-compatible custom providers.
61
+ :::
58
62
 
59
- ## Step 3: Create a Team
63
+ See [Source Control](./source-control.mdx) for what the repository contains
64
+ and how deployments work.
60
65
 
61
- Teams allow you to organize users and set hierarchical budget controls. Even if
62
- you're starting solo, you'll need at least one team.
66
+ 3. **Configure a provider**
63
67
 
64
- ### Creating Your Root Team
68
+ Providers are the LLM services (like OpenAI or Anthropic) that your apps use.
69
+ You configure these once as an administrator, and your team members use them
70
+ without needing direct access to provider API keys.
65
71
 
66
- 1. Click **Create Team**
67
- 2. Name your team (for example, "Root" or your company name)
68
- 3. Choose an icon for easy identification
69
- 4. Click **Create Team**
70
- 5. Set organization-wide limits (optional) by selecting the **Usage & Limits**
71
- tab:
72
- - **Budget Limit**: Maximum spend per day (for example, $1,000)
73
- - **Rate Limits**: Request limits if needed
72
+ Open
73
+ [**Settings AI Providers**](https://portal.zuplo.com/+/account/project/ai/settings/data-models)
74
+ and click **Add Provider**. Select your AI provider (for example,
75
+ **OpenAI**), paste your provider's API key, and select which models to make
76
+ available. The **Provider Name** field fills in automatically based on the
77
+ provider you selected—`openai`, for example. Click **Create**.
74
78
 
75
- ### Creating Sub-Teams (Optional)
79
+ :::caution{title="The provider name becomes the model prefix"}
76
80
 
77
- For larger organizations, create sub-teams with their own budgets:
81
+ Apps reference this provider's models as `providerName/model`, so the
82
+ provider name is the prefix in every model string—a provider named `openai`
83
+ serves `openai/gpt-5-mini`. The pre-filled name is usually what you want. To
84
+ use your own, set it now—the name is permanent after creation—and keep it
85
+ short and lowercase.
78
86
 
79
- 1. From your root team, click **Create Sub-Team**
80
- 2. Name the team (for example, "Engineering Team", "Credit Team")
81
- 3. Choose an icon
82
- 4. Set team-specific limits by clicking on **Settings**:
83
- - Daily budgets that are equal to or less than the parent team's limit
84
- - Example: If root is $1,000/day, a sub-team might be $500/day
85
- 5. Click **Save Changes**
87
+ :::
86
88
 
87
- ## Step 4: Create Applications
89
+ Repeat for additional providers. See [AI Providers](./providers.mdx) for the
90
+ full list of supported providers, including OpenAI-compatible custom
91
+ providers.
88
92
 
89
- Applications represent individual projects or services that will use the AI
90
- Gateway. Each app gets its own unique URL and API key.
93
+ 4. **Create a team**
91
94
 
92
- ### Creating Your First App
95
+ Teams organize users and carry hierarchical budget controls and policy
96
+ templates. Even if you're starting solo, you need at least one team.
93
97
 
94
- 1. Click **Apps** followed by **Create App**
95
- 2. Configure your app:
96
- - **App Name**: Descriptive name (for example, "Tennis Chat", "Customer
97
- Support Bot")
98
- - **Team**: Select which team owns this app
99
- - **Provider**: Choose your LLM provider (for example, OpenAI)
100
- - **Completions**: Select the model for chat completions (for example,
101
- GPT-4o)
102
- - **Embeddings**: Select the model for embeddings (optional)
103
- 3. Set application-level budgets:
104
- - **Daily Limit**: (for example, $1/day for a hackathon project)
105
- - **Monthly Limit**: (for example, $10/month)
106
- 4. Enable **Semantic Caching** (optional):
107
- - Caches similar prompts to reduce costs and improve performance
108
- - Best for applications with repeated queries
109
- 5. Click **Create App**
98
+ Open the **Teams** tab and click **Create Team**. Name your team (for
99
+ example, "Root" or your company name), choose an icon, and click **Create
100
+ Team**. To set organization-wide spending limits, open the gateway's
101
+ **Settings → Usage Limits**; for team-specific limits, use the team's **Usage
102
+ & Limits** tab. See [Usage Limits](./usage-limits.mdx).
110
103
 
111
- ### Access Your App Credentials
104
+ 5. **Create an app**
112
105
 
113
- After creating your application, you'll see:
106
+ Apps represent individual projects or services that call the AI Gateway. Each
107
+ app gets its own unique URL and API key.
114
108
 
115
- - **API Key**: Your Zuplo-managed key. You'll need it to integrate with your
116
- application.
109
+ Open the **Apps** tab and click **Create App**. Give the app a descriptive
110
+ name (for example, "Tennis Chat") and select the team that owns it. That's
111
+ the whole dialog—models, budgets, and other behavior are configured on the
112
+ app's policy chain in the next step.
117
113
 
118
- ## Step 5: Integrate with Your Application
114
+ :::tip
119
115
 
120
- Now you'll update your application to use the Zuplo AI Gateway instead of
121
- calling LLM providers directly.
116
+ If the app's team has a policy template, the new app starts with the
117
+ template's policy chain already in place. See
118
+ [Policy Templates](./policy-templates.mdx).
122
119
 
123
- In the examples below, we assume that you are using the official
124
- [Node.js OpenAI SDK](https://platform.openai.com/docs/libraries/node-js-library)
125
- and that you have executed `npm install openai`.
120
+ :::
126
121
 
127
- ### Before: Direct Provider Integration (sample.mjs)
122
+ 6. **Review the app's policy chain**
123
+
124
+ The portal opens the app's **Policies** tab, which shows the app's policy
125
+ chain—the ordered list of policies that run on each request. No policy is
126
+ required: an app with an empty chain works immediately, and each request
127
+ picks its own model as `providerName/model`, from any model your providers
128
+ expose.
129
+
130
+ To restrict that, add the **Model Filtering** policy and give it an allow
131
+ list such as `openai/gpt-5-mini`. Requests may then use only listed models,
132
+ and the first entry becomes the default when a request omits `model`.
133
+
134
+ :::caution{title="An unrestricted app can reach every model you configured"}
135
+
136
+ Without Model Filtering, an app may call any model available through the
137
+ providers assigned to its team, including expensive ones. Add Model Filtering
138
+ for any app that should be limited to a specific set.
139
+
140
+ :::
141
+
142
+ This is also where you add budgets, semantic caching, guardrails, and any
143
+ custom policies. Changes to the chain apply within about a minute—no redeploy
144
+ needed. See [Policy Chains](./policy-chains.mdx).
145
+
146
+ 7. **Get the app's URL and API key**
147
+
148
+ The app page shows its **API URL** and **API Key** at the top right. The API
149
+ URL is the gateway's hostname plus the app's ID—for example
150
+ `https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e`.
151
+ Copy both rather than constructing them.
152
+
153
+ Client libraries expect a base URL ending in `/v1`, so append it: the OpenAI
154
+ SDK examples below use
155
+ `https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e/v1`
156
+ as a stand-in, and requests land on paths like `/v1/chat/completions`.
157
+
158
+ :::note
159
+
160
+ The gateway checks the key only after you add the
161
+ [authentication policy](./policy-chains.mdx#authentication) to the route or
162
+ to the app's chain. Until then the gateway identifies the app from the
163
+ `{app_id}` segment of the URL and accepts the request without a key. The
164
+ examples below send the key so they keep working once you add the policy.
165
+
166
+ :::
167
+
168
+ Export the key so the samples below can read it:
169
+
170
+ ```bash
171
+ export ZUPLO_APP_API_KEY="<the API key from the app page>"
172
+ ```
173
+
174
+ 8. **Send your first request from the Playground**
175
+
176
+ The app's **Playground** tab chats with the app's own gateway URL and API
177
+ key, so it exercises the same policy chain your code will hit—without wiring
178
+ up a client first.
179
+
180
+ Pick a model from the selector, optionally set a system prompt, and send a
181
+ message. The tab shows the cURL for the next request, and **Copy cURL** puts
182
+ it on your clipboard to run in a terminal or adapt it for your client. Expand
183
+ any reply to inspect the request and the raw response.
184
+
185
+ </Stepper>
186
+
187
+ ## Integrate with your own code
188
+
189
+ Once the Playground works, configure your own code with the same URL and key.
190
+
191
+ These examples use the official
192
+ [Node.js OpenAI SDK](https://platform.openai.com/docs/libraries/node-js-library);
193
+ run `npm install openai` first. For other clients, see the integration guides
194
+ for the [OpenAI SDK](./integrations/openai.mdx),
195
+ [AI SDK](./integrations/ai-sdk.mdx), and
196
+ [LangChain](./integrations/langchain.mdx).
197
+
198
+ ### Before: direct provider integration (sample.mjs)
128
199
 
129
200
  ```javascript
130
201
  import OpenAI from "openai";
@@ -135,26 +206,27 @@ const openai = new OpenAI({
135
206
  });
136
207
 
137
208
  const completion = await openai.chat.completions.create({
138
- model: "gpt-4",
209
+ model: "gpt-5-mini",
139
210
  messages: [{ role: "user", content: "Hello!" }],
140
211
  });
141
212
 
142
213
  console.log(completion.choices[0].message.content);
143
214
  ```
144
215
 
145
- ### After: Using Zuplo AI Gateway (sample.mjs)
216
+ ### After: using the Zuplo AI Gateway (sample.mjs)
146
217
 
147
218
  ```javascript
148
219
  import OpenAI from "openai";
149
220
 
150
221
  // New approach - using Zuplo AI Gateway
151
222
  const openai = new OpenAI({
152
- apiKey: process.env.ZUPLO_API_KEY,
153
- baseURL: "https://your-ai-gateway-url.zuplo.app/v1",
223
+ apiKey: process.env.ZUPLO_APP_API_KEY,
224
+ baseURL:
225
+ "https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e/v1",
154
226
  });
155
227
 
156
228
  const completion = await openai.chat.completions.create({
157
- model: "gpt-4",
229
+ model: "openai/gpt-5-mini",
158
230
  messages: [{ role: "user", content: "Hello!" }],
159
231
  });
160
232
 
@@ -163,35 +235,39 @@ console.log(completion.choices[0].message.content);
163
235
 
164
236
  Run the example with `node sample.mjs`.
165
237
 
166
- ### What Changed?
238
+ ### What changed?
167
239
 
168
- 1. **URL**: Replace your provider's URL with your Zuplo Gateway URL
169
- 2. **API Key**: Use your Zuplo API key instead of the provider's key
170
- 3. **Everything else stays the same**: The request format remains compatible
240
+ 1. **URL**: Replace your provider's URL with your app's gateway URL from the app
241
+ page
242
+ 2. **API Key**: Use your app's API key instead of the provider's key—the gateway
243
+ checks it once the authentication policy applies
244
+ 3. **Model**: Reference models as `providerName/model` so the gateway knows
245
+ which provider to route to
246
+ 4. **Everything else stays the same**: The request format remains compatible
171
247
  with OpenAI's API
172
248
 
173
- ## Verify Your Setup
249
+ ## Verify your setup
174
250
 
175
- ### Make Your First Request
251
+ ### Make your first request
176
252
 
177
- Send a test request through your gateway:
253
+ Send a test request through your gateway, using your app's URL and API key:
178
254
 
179
255
  ```bash
180
- curl https://your-ai-gateway-url.zuplo.app/v1/chat/completions \
181
- -H "Authorization: Bearer YOUR_ZUPLO_API_KEY" \
256
+ curl https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e/v1/chat/completions \
257
+ -H "Authorization: Bearer YOUR_APP_API_KEY" \
182
258
  -H "Content-Type: application/json" \
183
259
  -d '{
184
- "model": "gpt-4",
260
+ "model": "openai/gpt-5-mini",
185
261
  "messages": [{"role": "user", "content": "Hello, world!"}]
186
262
  }'
187
263
  ```
188
264
 
189
- ### Check Your Dashboard
265
+ ### Check your dashboard
190
266
 
191
267
  1. Open the [**Apps**](https://portal.zuplo.com/+/account/project/ai/apps) tab
192
268
  of your AI Gateway project
193
269
  2. Click on your app
194
- 3. Click on **Dashboard** to view:
270
+ 3. Click on the app's **Dashboard** tab to view:
195
271
  - Request count
196
272
  - Token usage
197
273
  - Time to first byte
@@ -200,31 +276,23 @@ curl https://your-ai-gateway-url.zuplo.app/v1/chat/completions \
200
276
  You should see your test request appear with token usage and performance
201
277
  metrics.
202
278
 
203
- ## Next Steps
204
-
205
- Now that your AI Gateway is running, explore additional features:
206
-
207
- ### Switch Providers Without Code Changes
208
-
209
- 1. Go to your app settings
210
- 2. Change the **Provider** dropdown (for example, from OpenAI to Anthropic)
211
- 3. Select a new model
212
- 4. Click **Save Changes**
213
-
214
- Your application will now use the new provider without any code changes.
215
-
216
- ## Common Issues
217
-
218
- **Issue**: "Authentication failed" error
219
-
220
- - **Solution**: Verify you're using your Zuplo API key, not your provider's key
221
-
222
- **Issue**: Budget limit reached immediately
223
-
224
- - **Solution**: Check that sub-team limits don't exceed available budget from
225
- parent team
226
-
227
- **Issue**: Semantic caching not working
228
-
229
- - **Solution**: Ensure caching is enabled in your application settings and
230
- prompts are similar enough to match
279
+ ## Next steps
280
+
281
+ - [Policy Chains](./policy-chains.mdx): add budgets, semantic caching, and
282
+ guardrails to your app's chain
283
+ - [Custom Policies](./custom-policies.mdx): write your own policy and add it to
284
+ an app's chain
285
+ - [Policy Templates](./policy-templates.mdx): give every new app in a team a
286
+ consistent starting chain
287
+ - [Usage Limits](./usage-limits.mdx): set spending limits for the gateway,
288
+ teams, and apps
289
+
290
+ ## Common issues
291
+
292
+ | Symptom | Fix |
293
+ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
294
+ | "Authentication failed" error | Verify you're using your app's API key, not your provider's key. This error appears only when the authentication policy applies |
295
+ | 404 "Unsupported AI Gateway endpoint" | The path must end with a supported `/v1/...` operation—usually the URL is missing its `/v1` segment. Use the app's API URL plus `/v1/chat/completions`, for example |
296
+ | 400 error asking for `providerName/model` | Prefix the model with the provider name configured in the portal—`openai/gpt-5-mini`, not `gpt-5-mini` |
297
+ | 403 error listing the allowed models | The app's Model Filtering policy doesn't include the requested model; add it on the app's Policies tab or use a listed one |
298
+ | Budget limit reached immediately | Check the limits at every level—gateway, team, and the app's Budgets and Costs policy—since any level's limit blocks the request |
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  title: AI SDK
3
3
  sidebar_label: AI SDK
4
+ description:
5
+ Route AI SDK requests through the Zuplo AI Gateway by pointing each provider's
6
+ base URL at your app's gateway URL and referencing models as
7
+ providerName/model.
4
8
  ---
5
9
 
6
10
  The [AI SDK](https://ai-sdk.dev/) is a free open-source library that gives you
@@ -10,32 +14,47 @@ community supported providers being added regularly.
10
14
 
11
15
  ## Prerequisites
12
16
 
13
- In order to use the AI Gateway with any AI SDK powered application you will need
14
- to complete these steps first:
17
+ In order to use the AI Gateway with any AI SDK powered app you will need to
18
+ complete these steps first:
15
19
 
16
20
  <Stepper>
17
21
 
18
- 1. Create a [new provider](/ai-gateway/managing-providers) in the AI Gateway for
19
- the provider you want to use with AI SDK
22
+ 1. Create a [new provider](../managing-providers.mdx) in the AI Gateway for the
23
+ provider you want to use with AI SDK
20
24
 
21
- 2. [Set up a new team](/ai-gateway/managing-teams)
25
+ 2. [Set up a new team](../managing-teams.mdx)
22
26
 
23
- 3. Create a [new app](/ai-gateway/managing-apps) to use specifically with AI SDK
24
- and assign it to the team you created
27
+ 3. Create a [new app](../managing-apps.mdx) to use specifically with AI SDK and
28
+ assign it to the team you created
25
29
 
26
- 4. Copy the API Key for the app you created, as well as the Gateway URL
30
+ 4. Copy the **API URL** and **API Key** shown at the top of the app page
27
31
 
28
32
  </Stepper>
29
33
 
30
34
  ## Configure the AI SDK
31
35
 
32
36
  To route all AI SDK requests through Zuplo instead of directly to the API of the
33
- chosen provider, you must set the API `baseUrl` in the SDK configuration to
34
- point to the Gateway URL of your Zuplo AI Gateway.
37
+ chosen provider, you must set `baseURL` in the SDK configuration to point to
38
+ your app's API URL with `/v1` appended. The app page in the Zuplo Portal shows
39
+ the URL, which ends in the app's ID.
35
40
 
36
41
  Additionally, you will need to change the value of `apiKey` to the API key of
37
42
  the app you have configured in Zuplo.
38
43
 
44
+ Models are referenced as `providerName/model`, where `providerName` is the
45
+ provider name configured in your gateway. By default an app can reach any model
46
+ offered by the providers assigned to its [team](../managing-teams.mdx). To limit
47
+ it to a curated set, add the [Model Filtering](../policies/model-filtering.mdx)
48
+ policy to the app—it applies separate rules to completions (`generateText`,
49
+ `streamText`) and embeddings (`embed`), and rejects a capability it doesn't
50
+ configure.
51
+
52
+ Each provider package appends its own operation path to `baseURL`, so pick the
53
+ model factory that targets an endpoint the gateway serves:
54
+ `/v1/chat/completions` for OpenAI-compatible requests, `/v1/messages` for
55
+ Anthropic, `/v1/embeddings`, and `/v1/responses` for OpenAI only. The examples
56
+ below use the right factory for each provider.
57
+
39
58
  ### OpenAI
40
59
 
41
60
  ```typescript
@@ -44,43 +63,45 @@ import { generateText } from "ai";
44
63
 
45
64
  const openai = createOpenAI({
46
65
  apiKey: process.env.ZUPLO_AI_GATEWAY_API_KEY,
47
- baseURL: "https://my-ai-gateway.zuplo.app/v1",
66
+ baseURL:
67
+ "https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e/v1",
48
68
  });
49
69
 
50
70
  const { text } = await generateText({
51
- model: openai.chat("gpt-4o"),
71
+ model: openai.chat("openai/gpt-5-mini"),
52
72
  prompt: "Write a one-sentence bedtime story about a unicorn.",
53
73
  });
54
74
  ```
55
75
 
56
76
  ### Anthropic
57
77
 
78
+ Pass the app's API key as `authToken`, not `apiKey`. The provider sends `apiKey`
79
+ as the `x-api-key` header, which the gateway doesn't read, while `authToken` is
80
+ sent as `Authorization: Bearer`. Setting both throws an `InvalidArgumentError`.
81
+
58
82
  ```typescript
59
83
  import { createAnthropic } from "@ai-sdk/anthropic";
60
84
  import { generateText } from "ai";
61
85
 
62
86
  const anthropic = createAnthropic({
63
- apiKey: process.env.ZUPLO_AI_GATEWAY_API_KEY,
64
- baseURL: "https://my-ai-gateway.zuplo.app/v1",
65
- // Authorization header is also required
66
- headers: {
67
- Authorization: `Bearer ${process.env.ZUPLO_AI_GATEWAY_API_KEY}`,
68
- },
87
+ authToken: process.env.ZUPLO_AI_GATEWAY_API_KEY,
88
+ baseURL:
89
+ "https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e/v1",
69
90
  });
70
91
 
71
92
  const { text } = await generateText({
72
- model: anthropic("claude-sonnet-4-5-20250929"),
93
+ model: anthropic("anthropic/claude-sonnet-4-5-20250929"),
73
94
  prompt: "Write a one-sentence bedtime story about a unicorn.",
74
95
  });
75
96
  ```
76
97
 
77
98
  ### Google
78
99
 
79
- The `@ai-sdk/google` provider speaks Gemini's native protocol: it sends requests
80
- to `/models/{model}:generateContent` and authenticates with the `x-goog-api-key`
100
+ The `@ai-sdk/google` provider speaks Gemini's native protocol: it posts to a
101
+ `{model}:generateContent` path and authenticates with the `x-goog-api-key`
81
102
  header, neither of which the AI Gateway serves. Use the
82
103
  [OpenAI-compatible provider](https://ai-sdk.dev/providers/openai-compatible-providers)
83
- instead the AI Gateway translates OpenAI-format requests to Google upstream.
104
+ instead—the AI Gateway translates OpenAI-format requests to Google upstream.
84
105
 
85
106
  ```typescript
86
107
  import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
@@ -89,11 +110,12 @@ import { generateText } from "ai";
89
110
  const gateway = createOpenAICompatible({
90
111
  name: "zuplo-ai-gateway",
91
112
  apiKey: process.env.ZUPLO_AI_GATEWAY_API_KEY,
92
- baseURL: "https://my-ai-gateway.zuplo.app/v1",
113
+ baseURL:
114
+ "https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e/v1",
93
115
  });
94
116
 
95
117
  const { text } = await generateText({
96
- model: gateway("gemini-2.5-flash"),
118
+ model: gateway("google/gemini-2.5-flash"),
97
119
  prompt: "Write a one-sentence bedtime story about a unicorn.",
98
120
  });
99
121
  ```
@@ -106,28 +128,49 @@ import { generateText } from "ai";
106
128
 
107
129
  const mistral = createMistral({
108
130
  apiKey: process.env.ZUPLO_AI_GATEWAY_API_KEY,
109
- baseURL: "https://my-ai-gateway.zuplo.app/v1",
131
+ baseURL:
132
+ "https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e/v1",
110
133
  });
111
134
 
112
135
  const { text } = await generateText({
113
- model: mistral("mistral-large-latest"),
136
+ model: mistral("mistral/mistral-large-latest"),
114
137
  prompt: "Write a one-sentence bedtime story about a unicorn.",
115
138
  });
116
139
  ```
117
140
 
118
141
  ### xAI
119
142
 
143
+ Call `xai.chat(...)` rather than `xai(...)`. The bare callable targets xAI's
144
+ Responses API, and the gateway serves `/v1/responses` for the OpenAI provider
145
+ only—an xAI model sent there returns a `400`.
146
+
120
147
  ```typescript
121
148
  import { createXai } from "@ai-sdk/xai";
122
149
  import { generateText } from "ai";
123
150
 
124
151
  const xai = createXai({
125
152
  apiKey: process.env.ZUPLO_AI_GATEWAY_API_KEY,
126
- baseURL: "https://my-ai-gateway.zuplo.app/v1",
153
+ baseURL:
154
+ "https://my-gateway-main-2e18f50.zuplo.app/config_fe0a04972d2848e0a94ae4b8bcd1497e/v1",
127
155
  });
128
156
 
129
157
  const { text } = await generateText({
130
- model: xai("grok-4"),
158
+ model: xai.chat("xai/grok-4"),
131
159
  prompt: "Write a one-sentence bedtime story about a unicorn.",
132
160
  });
133
161
  ```
162
+
163
+ ## Provider options the gateway doesn't forward
164
+
165
+ On the OpenAI-shaped endpoints (`/v1/chat/completions`, `/v1/embeddings`, and
166
+ `/v1/responses`) the gateway rebuilds the upstream request from a per-provider
167
+ parameter list instead of forwarding your body as-is. Standard AI SDK settings—
168
+ messages, `temperature`, `topP`, `maxOutputTokens`, `stopSequences`, `tools`,
169
+ `toolChoice`, `responseFormat`, `presencePenalty`, and `frequencyPenalty`—are
170
+ forwarded. Options outside that list are dropped without a warning. For example,
171
+ `seed` and `providerOptions.mistral.safePrompt` don't reach Mistral, and
172
+ `temperature` is capped at Mistral's maximum of `1`.
173
+
174
+ Anthropic is different: `/v1/messages` is a native passthrough, so
175
+ `@ai-sdk/anthropic` requests reach Anthropic unchanged apart from the model and
176
+ credential, which the gateway sets from your app configuration.