Skip to content

Commit cd1c754

Browse files
authored
fix: ai gateway custom provider API URLs (#26707)
* fix: ai gateway custom provider API URLs * fix: update dashboard links and sample provider name
1 parent 9407000 commit cd1c754

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/content/docs/ai-gateway/configuration/custom-providers.mdx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ To create a new custom provider using the API:
5353
2. Send a `POST` request to create a new custom provider:
5454

5555
```bash title="Create Custom Provider"
56-
curl -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers" \
56+
curl -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers" \
5757
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
5858
-H "Content-Type: application/json" \
5959
-d '{
6060
"name": "My Custom Provider",
61-
"slug": "my-custom-provider",
61+
"slug": "some-provider",
6262
"base_url": "https://api.myprovider.com",
6363
"description": "Custom AI provider for internal models",
6464
"enable": true
@@ -88,7 +88,7 @@ curl -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-p
8888
"account_id": "abc123def456",
8989
"account_tag": "my-account",
9090
"name": "My Custom Provider",
91-
"slug": "my-custom-provider",
91+
"slug": "some-provider",
9292
"base_url": "https://api.myprovider.com",
9393
"description": "Custom AI provider for internal models",
9494
"enable": true,
@@ -113,7 +113,7 @@ A default SVG logo is automatically generated for each custom provider. The logo
113113
To create a new custom provider using the dashboard:
114114

115115
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
116-
2. Go to [**Compute & AI** > **AI Gateway** > **Custom Providers**](https://dash.cloudflare.com/?to=/:account/ai-gateway/custom-providers).
116+
2. Go to [**Compute & AI** > **AI Gateway** > **Custom Providers**](https://dash.cloudflare.com/?to=/:account/ai/ai-gateway/custom-providers).
117117
3. Select **Add Custom Provider**.
118118
4. Enter the following information:
119119
- **Provider Name**: Display name for your provider
@@ -132,7 +132,7 @@ To create a new custom provider using the dashboard:
132132
Retrieve all custom providers with optional filtering and pagination:
133133

134134
```bash title="List all providers"
135-
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers" \
135+
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers" \
136136
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
137137
```
138138

@@ -148,13 +148,13 @@ curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers
148148

149149
List only enabled providers:
150150
```bash
151-
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers?enable=true" \
151+
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers?enable=true" \
152152
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
153153
```
154154

155155
Search for specific providers:
156156
```bash
157-
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers?search=custom" \
157+
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers?search=custom" \
158158
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
159159
```
160160

@@ -167,7 +167,7 @@ curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers
167167
{
168168
"id": "550e8400-e29b-41d4-a716-446655440000",
169169
"name": "My Custom Provider",
170-
"slug": "my-custom-provider",
170+
"slug": "some-provider",
171171
"base_url": "https://api.myprovider.com",
172172
"enable": true,
173173
"created_at": 1700000000,
@@ -189,7 +189,7 @@ curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers
189189
To view all your custom providers:
190190

191191
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
192-
2. Go to [**Compute & AI** > **AI Gateway** > **Custom Providers**](https://dash.cloudflare.com/?to=/:account/ai-gateway/custom-providers).
192+
2. Go to [**Compute & AI** > **AI Gateway** > **Custom Providers**](https://dash.cloudflare.com/?to=/:account/ai/ai-gateway/custom-providers).
193193
3. You will see a list of all your custom providers with their names, slugs, base URLs, and status.
194194

195195
</TabItem>
@@ -203,7 +203,7 @@ To view all your custom providers:
203203
Retrieve details for a specific custom provider by its ID:
204204

205205
```bash title="Get provider by ID"
206-
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers/{provider_id}" \
206+
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers/{provider_id}" \
207207
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
208208
```
209209

@@ -217,7 +217,7 @@ curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers
217217
"account_id": "abc123def456",
218218
"account_tag": "my-account",
219219
"name": "My Custom Provider",
220-
"slug": "my-custom-provider",
220+
"slug": "some-provider",
221221
"base_url": "https://api.myprovider.com",
222222
"description": "Custom AI provider for internal models",
223223
"enable": true,
@@ -243,7 +243,7 @@ curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers
243243
Update an existing custom provider. All fields are optional - only include the fields you want to change:
244244

245245
```bash title="Update provider"
246-
curl -X PATCH "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers/{provider_id}" \
246+
curl -X PATCH "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers/{provider_id}" \
247247
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
248248
-H "Content-Type: application/json" \
249249
-d '{
@@ -268,15 +268,15 @@ curl -X PATCH "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-
268268

269269
Enable a provider:
270270
```bash
271-
curl -X PATCH "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers/{provider_id}" \
271+
curl -X PATCH "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers/{provider_id}" \
272272
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
273273
-H "Content-Type: application/json" \
274274
-d '{"enable": true}'
275275
```
276276

277277
Update provider URL:
278278
```bash
279-
curl -X PATCH "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers/{provider_id}" \
279+
curl -X PATCH "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers/{provider_id}" \
280280
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
281281
-H "Content-Type: application/json" \
282282
-d '{"base_url": "https://api.newprovider.com"}'
@@ -292,7 +292,7 @@ Updates to custom providers automatically invalidate any cached entries related
292292
To update an existing custom provider:
293293

294294
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
295-
2. Go to [**Compute & AI** > **AI Gateway** > **Custom Providers**](https://dash.cloudflare.com/?to=/:account/ai-gateway/custom-providers).
295+
2. Go to [**Compute & AI** > **AI Gateway** > **Custom Providers**](https://dash.cloudflare.com/?to=/:account/ai/ai-gateway/custom-providers).
296296
3. Find the custom provider you want to update and select **Edit**.
297297
4. Update the fields you want to change (name, slug, base URL, etc.).
298298
5. Select **Save** to apply your changes.
@@ -308,7 +308,7 @@ To update an existing custom provider:
308308
Delete a custom provider:
309309

310310
```bash title="Delete provider"
311-
curl -X DELETE "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom-providers/{provider_id}" \
311+
curl -X DELETE "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/custom-providers/{provider_id}" \
312312
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
313313
```
314314

@@ -320,7 +320,7 @@ curl -X DELETE "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom
320320
"result": {
321321
"id": "550e8400-e29b-41d4-a716-446655440000",
322322
"name": "My Custom Provider",
323-
"slug": "my-custom-provider"
323+
"slug": "some-provider"
324324
}
325325
}
326326
```
@@ -335,7 +335,7 @@ Deleting a custom provider will immediately stop all requests routed through it.
335335
To delete a custom provider:
336336

337337
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
338-
2. Go to [**Compute & AI** > **AI Gateway** > **Custom Providers**](https://dash.cloudflare.com/?to=/:account/ai-gateway/custom-providers).
338+
2. Go to [**Compute & AI** > **AI Gateway** > **Custom Providers**](https://dash.cloudflare.com/?to=/:account/ai/ai-gateway/custom-providers).
339339
3. Find the custom provider you want to delete and select **Delete**.
340340
4. Confirm the deletion when prompted.
341341

@@ -351,7 +351,7 @@ Deleting a custom provider will immediately stop all requests routed through it.
351351
Once you've created a custom provider, you can route requests through AI Gateway. When referencing your custom provider, you must prefix the slug with `custom-`.
352352

353353
:::note[Custom provider prefix]
354-
All custom provider slugs must be prefixed with `custom-` when making requests through AI Gateway. For example, if your provider slug is `my-custom-provider`, you must use `custom-my-custom-provider` in your requests.
354+
All custom provider slugs must be prefixed with `custom-` when making requests through AI Gateway. For example, if your provider slug is `some-provider`, you must use `custom-some-provider` in your requests.
355355
:::
356356

357357
### Via Unified API
@@ -362,7 +362,7 @@ curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat/chat/
362362
-H "cf-aig-authorization: Bearer $CF_AIG_TOKEN" \
363363
-H "Content-Type: application/json" \
364364
-d '{
365-
"model": "custom-my-custom-provider/model-name",
365+
"model": "custom-some-provider/model-name",
366366
"messages": [{"role": "user", "content": "Hello!"}]
367367
}'
368368
```
@@ -372,7 +372,7 @@ In the Unified API, specify the model using the format: `custom-{slug}/{model-na
372372
### Via provider-specific endpoint
373373

374374
```bash title="Direct provider endpoint"
375-
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/custom-my-custom-provider/your-endpoint \
375+
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/custom-some-provider/your-endpoint \
376376
-H "Authorization: Bearer $PROVIDER_API_KEY" \
377377
-H "cf-aig-authorization: Bearer $CF_AIG_TOKEN" \
378378
-H "Content-Type: application/json" \

0 commit comments

Comments
 (0)