---
title: generate_ai_gateway_decision
description: Use generate_ai_gateway_decision with Vercel MCP.
url: "https://vercel.com/docs/agent-resources/vercel-mcp/tools/ai-gateway/generate_ai_gateway_decision"
last_updated: 2018-10-20
related:
  - /docs/ai-gateway/modalities/decision
  - /docs/agent-resources/vercel-mcp/tools/ai-gateway/generate_ai_gateway_text
install_vercel_plugin: npx plugins add vercel/vercel-plugin
search_with_vercel_cli: npx vercel@latest docs search "<query>"
search_kb_with_vercel_cli: npx vercel@latest kb search "<query>"
---

# generate_ai_gateway_decision

Asks a [decision model](/docs/ai-gateway/modalities/decision) on Vercel AI Gateway typed questions about one input, and returns calibrated probabilities instead of free text. The input is text, plus optional JSON data or images. For each question in order, the tool returns a yes probability (predicate), the chosen option with its probabilities (choice), or a score on an ordered scale (score).

Use `generate_ai_gateway_decision` to classify, route, verify, or score. For example, whether a message asks for a refund, which team should handle a ticket, how urgent it is, or whether a screenshot shows an error. Ask every question about the same input in one call. For free-form answers, use [`generate_ai_gateway_text`](/docs/agent-resources/vercel-mcp/tools/ai-gateway/generate_ai_gateway_text) instead.

Each call runs a model on AI Gateway and is billed to the AI Gateway credits of the team in `teamId`, and a fallback rerun is billed too. The call authenticates with your Vercel MCP sign-in, so no AI Gateway API key is needed.

## Parameters

| Parameter           | Type            | Required | Description                                                                                                                                                                                                                                                  |
| ------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `teamId`            | string          | Yes      | The ID (`team_...`) or slug of the team whose AI Gateway credits pay for the call. Use `list_teams` to discover an unknown team. A connection bound to a team is billed to that team.                                                                        |
| `model`             | string          | No       | The decision model ID as `creator/model`, such as `typesafe-ai/jev`. Defaults to `openai/gpt-6-luna-decisions`. Image input needs a model that accepts images. Use `list_ai_gateway_models` with type `evaluation` to find decision models and their prices. |
| `input`             | string          | Yes      | The text every question is asked about, such as a support ticket, a log excerpt, or a code diff. The `input`, `data`, and `questions` together may total at most 200,000 characters.                                                                         |
| `data`              | object \| array | No       | Optional structured data asked about along with `input`, as a JSON object or a non-empty array of objects, such as `{ "order": { "id": "A-1", "status": "refunded" } }`.                                                                                     |
| `images`            | array           | No       | Optional images asked about along with `input`, up to 4. Each is `{ url, detail? }`. See [Image object](#image-object).                                                                                                                                      |
| `questions`         | array           | Yes      | 1 to 20 questions in order. Answers come back in the same order. See [Question object](#question-object).                                                                                                                                                    |
| `zeroDataRetention` | boolean         | No       | Route only to providers with zero data retention. Use when the input is sensitive.                                                                                                                                                                           |
| `fallback`          | object          | No       | Optional confidence fallback that reruns the decision with another model when an answer is uncertain. See [Fallback object](#fallback-object).                                                                                                               |

### Image object

Each entry in `images` describes one image asked about along with `input`.

| Property | Type   | Required | Description                                                                                            |
| -------- | ------ | -------- | ------------------------------------------------------------------------------------------------------ |
| `url`    | string | Yes      | The image as a base64 data URL (`png`, `jpeg`, `webp`, or `gif`). External URLs are not supported.     |
| `detail` | string | No       | How much image detail the model uses. One of `low`, `high`, `auto`, or `original`.                     |

### Question object

Each entry in `questions` is one typed question asked about the same input. Answers come back in the same order. A question the model declines comes back as type `refusal`.

| Property       | Type   | Required | Description                                                                                                                 |
| -------------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `type`         | string | Yes      | `predicate` for yes or no, `choice` to pick one option, or `score` to rate on an ordered scale.                             |
| `instructions` | string | Yes      | The question to ask, up to 2,000 characters.                                                                                |
| `name`         | string | No       | A unique name that keys this question's answer, up to 64 characters.                                                        |
| `choices`      | array  | No       | Required for a `choice` question. 1 to 255 options as `{ value, description? }`, where `value` is a string or boolean.      |
| `levels`       | array  | No       | Required for a `score` question. The scale from lowest to highest as 2 to 10 `{ label, description? }` entries.             |

### Fallback object

Reruns the decision with another model when an answer is uncertain. A rerun is billed too, and fallback answers carry no confidence.

| Property             | Type   | Required | Description                                                                                                                                                  |
| -------------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model`              | string | Yes      | The model that reruns every question when the condition matches.                                                                                             |
| `question`           | string | No       | Names one question to check. Omit it to check every question of the matching type.                                                                           |
| `confidenceBelow`    | number | No       | Rerun when a `choice` or `score` answer has confidence below this, from `0` to `1`. Set exactly one of `confidenceBelow` or `probabilityBetween`.            |
| `probabilityBetween` | array  | No       | Rerun when a `predicate` yes probability is within this inclusive range, such as `[0.4, 0.6]`. Set exactly one of `confidenceBelow` or `probabilityBetween`. |

## Returns

| Field          | Description                     |
| -------------- | ------------------------------- |
| `answers`      | The answers in question order.  |
| `model`        | The model that answered.        |
| `usage`        | Token usage for the call.       |
| `cost`         | The cost of the call.           |
| `generationId` | The ID of the generation.       |

Sample prompt: "Does this support ticket ask for a refund, and how urgent is it?"

## Search the docs from your terminal

Search the Vercel docs and read pages as Markdown with the Vercel CLI. No login required.

```bash
# Find docs pages by keyword
npx vercel@latest docs search "environment variables"
npx vercel@latest docs search "function timeout"

# Print a docs page as Markdown, by path or URL
npx vercel@latest docs inspect <page>
```

## Search guides from your terminal

Search the Knowledge Base and read guides as Markdown with the Vercel CLI. No login required.

```bash
# Find guides by keyword
npx vercel@latest kb search "rewrites and redirects"
npx vercel@latest kb search "AI SDK streaming"

# Show the latest guides
npx vercel@latest kb

# Print a guide as Markdown, by slug or URL
npx vercel@latest kb inspect <guide>
```

---

[View full sitemap](/docs/sitemap)


If you encounter incorrect information, can’t find what you need, need a capability Vercel doesn’t currently offer, or have any other feedback to report, please do it by following the instructions at https://vercel.com/feedback.md.
