You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/changelog/ai-gateway/2026-03-25-run-api-beta.mdx
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
-
title: Run API now available in beta
3
-
description: AI Gateway introduces the Run API, a new endpoint for running AI models with a simplified request/response pattern.
2
+
title: New Run API for AI Gateway now available in beta
3
+
description: AI Gateway introduces the /run api and support for running third party models in Workers AI bindings
4
4
products:
5
5
- ai-gateway
6
6
date: 2026-03-25
7
7
---
8
8
9
9
AI Gateway now offers a new `/run` endpoint for running AI models. The Run API uses its own request envelope, separate from the OpenAI-compatible `/chat/completions` format, and is designed to support a broader range of model types over time.
10
10
11
-
During the beta, the Run API supports one model — `google/nano-banana` for image generation. Authenticate with [Unified Billing](/ai-gateway/features/unified-billing/) or [BYOK (Gateway Key Store)](/ai-gateway/configuration/bring-your-own-keys/).
11
+
Today, the Run API supports one model — `google/nano-banana` for image generation. Authenticate with [Unified Billing](/ai-gateway/features/unified-billing/) or [BYOK (Gateway Key Store)](/ai-gateway/configuration/bring-your-own-keys/).
12
12
13
13
```bash
14
14
curl -X POST "https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/default/run" \
@@ -22,4 +22,14 @@ curl -X POST "https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/defaul
22
22
}'
23
23
```
24
24
25
+
With this release, the Workers AI binding (`env.AI.run()`) now supports running third-party models proxied through AI Gateway. You can call models like `google/nano-banana` directly from a Cloudflare Worker without managing provider credentials in your code:
26
+
27
+
```ts
28
+
const response =awaitenv.AI.run(
29
+
"google/nano-banana",
30
+
{ prompt: "a cat riding a burrito" },
31
+
{ gateway: { id: "my-gateway" } },
32
+
);
33
+
```
34
+
25
35
Additional models and features will be added in future updates. For more information, refer to the [Run API](/ai-gateway/usage/run-api/) documentation.
Copy file name to clipboardExpand all lines: src/content/docs/ai-gateway/usage/run-api.mdx
+91-6Lines changed: 91 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,32 @@ The Run API supports the following authentication methods for upstream provider
36
36
Passing provider API keys directly in request headers is not supported with the Run API. You must use Unified Billing or BYOK (Gateway Key Store) to authenticate with upstream providers.
37
37
:::
38
38
39
+
## Request
40
+
41
+
```txt
42
+
POST /v1/{account_id}/{gateway_id}/run
43
+
```
44
+
45
+
### Request body
46
+
47
+
| Field | Type | Required | Description |
48
+
| --- | --- | --- | --- |
49
+
|`model`|`string`| Yes | The model to run. Refer to [Supported models](#supported-models) for available values. |
50
+
|`input`|`object`| Yes | Model-specific input parameters. The accepted fields depend on the model. |
51
+
|`provider`|`string`| No | Pin the request to a specific provider instead of using the default. |
52
+
|`background`|`boolean`| No | When `true`, the request returns immediately with a `runId` that you can poll for results. |
53
+
|`webhookUrl`|`string`| No | A URL to receive a callback when the run completes. Only valid when `background` is `true`. |
54
+
55
+
### Input fields for `google/nano-banana`
56
+
57
+
| Field | Type | Required | Description |
58
+
| --- | --- | --- | --- |
59
+
|`prompt`|`string`| Yes | The text prompt describing the image to generate. |
60
+
|`image_input`|`string[]`| No | Up to 3 base64-encoded images to use as input for image-to-image generation. |
61
+
|`aspect_ratio`|`string`| No | Aspect ratio of the output image. One of: `1:1`, `3:2`, `2:3`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`. |
62
+
|`output_format`|`string`| No | Output image format. One of: `jpg`, `png`, `webp`. |
63
+
|`image_size`|`string`| No | Output image resolution. One of: `1K`, `2K`, `4K`. |
64
+
39
65
## Supported models
40
66
41
67
The Run API currently supports a single model:
@@ -46,7 +72,9 @@ The Run API currently supports a single model:
46
72
47
73
More models will be added in future updates.
48
74
49
-
## Example
75
+
## Examples
76
+
77
+
### Basic request
50
78
51
79
<Tabs>
52
80
<TabItemlabel="curl">
@@ -108,7 +136,66 @@ export default {
108
136
</TabItem>
109
137
</Tabs>
110
138
111
-
### Response
139
+
### With input options
140
+
141
+
```bash
142
+
curl -X POST "https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/run" \
0 commit comments