> For the complete documentation index, see [llms.txt](https://docs.aimlapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aimlapi.com/api-references/decision-models/heygen/decision-1.md). Agents can also search and read this documentation through its [MCP server](https://docs.aimlapi.com/~gitbook/mcp).

# HeyGen Decision 1

Model id: heygen/decision-1. HeyGen Decision 1 answers typed questions about text, images, video and audio in one request (yes/no, choice, score) with a calibrated probability for every answer and no

{% columns %}
{% column width="66.66666666666666%" %}
{% hint style="info" %}
This documentation is valid for the following list of our models:

* `heygen/decision-1`
  {% endhint %}
  {% endcolumn %}

{% column width="33.33333333333334%" %} <a href="https://aimlapi.com/app/heygen/decision-1" class="button primary">Try in Playground</a>
{% endcolumn %}
{% endcolumns %}

## Model Overview

HeyGen Decision 1 is HeyGen's decision model: instead of generating text it returns typed answers (yes/no, choice, score) with a calibrated probability for every answer. One request can carry up to 400 named questions about the same text, up to 100 images, 10 videos and 10 audio clips, which makes it a fit for moderation, identity checks, routing, triage and QA. Context window is 131,072 tokens.

[HeyGen Decision 1 Turbo](https://docs.aimlapi.com/api-references/decision-models/heygen/decision-1-turbo.md) takes the same request and is the faster, cheaper option: on the support ticket below it used 765 input tokens against 1,002 here.

It uses the same `/v1/decisions` request as [Jev](https://docs.aimlapi.com/api-references/decision-models/typesafe/jev.md) and [d1](https://docs.aimlapi.com/api-references/decision-models/liquid-ai/d1.md) for text: `state` and an object of typed `questions`. Media differ: images go in **`images`**, videos in **`videos`** and audio in **`audios`**, not in `assets` (see [Images](#images) and [Video and audio](#video-and-audio)).

{% hint style="success" %}
[Create AI/ML API Key](https://aimlapi.com/app/keys)
{% endhint %}

<details>

<summary>How to make the first API call</summary>

**1️⃣ Required setup (don’t skip this)**\
▪ **Create an account:** Sign up on the AI/ML API website (if you don’t have one yet).\
▪ **Generate an API key:** In your account dashboard, create an API key and make sure it’s **enabled** in the UI.

**2️ Copy the code example**\
At the bottom of this page, pick the snippet for your preferred programming language (Python / Node.js) and copy it into your project.

**3️ Update the snippet for your use case**\
▪ **Insert your API key:** replace `<YOUR_AIMLAPI_KEY>` with your real AI/ML API key.\
▪ **Select a model:** set the `model` field to `heygen/decision-1`.\
▪ **Provide input:** put the content to evaluate in `state` and describe what to decide in `questions`.

**4️ (Optional) Tune the request**\
See the API schema below for the three question types (`noul`, `choice`, `score`), their `criteria`, and the `images`, `videos` and `audios` fields.

**5️ Run your code**\
Run the updated code in your development environment.

{% hint style="success" %}
For a detailed walkthrough, use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up).
{% endhint %}

</details>

## API Schema

## POST /v1/decisions

>

```json
{"openapi":"3.0.0","info":{"title":"AIML API","version":"1.0.0"},"servers":[{"url":"https://api.aimlapi.com"}],"paths":{"/v1/decisions":{"post":{"operationId":"_v1_decisions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["heygen/decision-1"]},"state":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"The content to evaluate: a string, a JSON object, or an array of texts."},"questions":{"type":"object","additionalProperties":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["noul"],"description":"A yes/no question; the answer is the probability of \"yes\"."},"instructions":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"What to decide about the state. A plain question, or structured guidance as a JSON object/array (the question in one field, data it refers to in others)."},"criteria":{"type":"object","properties":{"true":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"When the answer is \"yes\"."},"false":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"When the answer is \"no\"."}},"description":"Optional descriptions of what \"true\" and \"false\" mean for this question: text, or a JSON object/array."}},"required":["type","instructions"]},{"type":"object","properties":{"type":{"type":"string","enum":["choice"],"description":"Pick exactly one option from `criteria`."},"instructions":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"What to decide about the state. A plain question, or structured guidance as a JSON object/array (the question in one field, data it refers to in others)."},"criteria":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}},{"nullable":true}]},"description":"Option key → description: text, a JSON object/array, or `null` when the key says it all. The answer is one of these keys plus a probability for each.","minProperties":2,"maxProperties":255}},"required":["type","instructions","criteria"]},{"type":"object","properties":{"type":{"type":"string","enum":["score"],"description":"Rate the state against an ordered scale of levels."},"instructions":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"What to decide about the state. A plain question, or structured guidance as a JSON object/array (the question in one field, data it refers to in others)."},"criteria":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}]},"minItems":2,"maxItems":10,"description":"Ordered level descriptions (text or a JSON object/array each), lowest first. The answer is an expected level index (may be fractional) plus a probability per level."}},"required":["type","instructions","criteria"]}]},"description":"Map of question key → typed question. Every key comes back in `answers` with a typed result.","minProperties":1,"maxProperties":400},"images":{"type":"array","items":{"type":"string","format":"uri","description":"A JPEG, PNG or WebP image: a base64 `data:` URL (`data:image/png;base64,…`) or an http(s) URL."},"maxItems":100,"description":"Up to 100 images of the state, in order: every question sees all of them, so refer to an image by its position. Each one counts as input tokens — 1.5 per 32×32-pixel patch (a 1024×1024 image is 1,536) — again for every question. 16.0 MiB for the whole request once the images are inlined. Images are never resized: one outside these limits is refused with a 400 that says what to change."},"assets":{"type":"object","additionalProperties":{"nullable":true},"description":"Not supported here: This model takes no `assets`: send its images in `images`. A non-empty map is refused."},"videos":{"type":"array","items":{"type":"string","format":"uri"},"minItems":1,"maxItems":10,"description":"Up to 10 videos of the state, in order, each a public https:// URL that answers without a redirect or authentication, with a `video/*` Content-Type — up to 50 MiB each; the model reads sampled frames (a 16-second clip is about 11,000 tokens). Every question sees all of them; their tokens are billed as input tokens."},"audios":{"type":"array","items":{"type":"string","format":"uri"},"minItems":1,"maxItems":10,"description":"Up to 10 audio clips of the state, in order, each a public https:// URL that answers without a redirect or authentication, with a `audio/*` Content-Type — MP3 or WAV; a 5-second voice clip is about 300 tokens. Every question sees all of them; their tokens are billed as input tokens."}},"required":["model","state","questions"],"title":"heygen/decision-1"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"Resolved model version that answered."},"answers":{"type":"object","additionalProperties":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["noul"]},"noul":{"type":"number","description":"Probability that the answer is \"yes\" (0–1)."}},"required":["type","noul"]},{"type":"object","properties":{"type":{"type":"string","enum":["choice"]},"choice":{"type":"string","description":"The selected option key from `criteria`."},"confidence":{"type":"number","description":"Calibrated confidence in the choice (0–1)."},"probabilities":{"type":"object","additionalProperties":{"type":"number"},"description":"Probability of each option; sums to 1."}},"required":["type","choice","confidence","probabilities"]},{"type":"object","properties":{"type":{"type":"string","enum":["score"]},"score":{"type":"number","description":"Expected level on the ordered scale (may be fractional, e.g. 1.34)."},"confidence":{"type":"number","description":"Calibrated confidence in the score (0–1)."},"legend":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}]},"description":"Level index → level description, as the request gave it (text, or a JSON object/array)."},"probabilities":{"type":"object","additionalProperties":{"type":"number"},"description":"Probability of each option; sums to 1."}},"required":["type","score","confidence","legend","probabilities"]},{"type":"object","properties":{"type":{"type":"string","enum":["box"]},"box":{"type":"object","properties":{"top":{"type":"number"},"bottom":{"type":"number"},"left":{"type":"number"},"right":{"type":"number"}},"required":["top","bottom","left","right"],"description":"The edges of the box around the target, each a fraction (0–1) from the top-left corner: `left` and `right` of the width, `top` and `bottom` of the height."},"confidence":{"type":"number","description":"How sure the model is of the box (0–1)."}},"required":["type","box","confidence"]}]},"description":"One typed answer per question key from the request."},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}},"required":["input_tokens","output_tokens"],"description":"Token usage reported by the provider."}},"required":["model","answers","usage"]}}}}}}}}}
```

## Code Example

{% tabs %}
{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests
import json

response = requests.post(
    "https://api.aimlapi.com/v1/decisions",
    headers={
        # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
        "Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
        "Content-Type": "application/json",
    },
    json={
        "model": "heygen/decision-1",
        "state": "Help! My payments have been failing for 3 days and nobody answers support.",
        "questions": {
            "is_urgent": {
                "type": "noul",
                "instructions": "Does this convey urgency?",
            },
            "department": {
                "type": "choice",
                "instructions": "Which team should handle this?",
                "criteria": {
                    "billing": "Payments, invoicing, refunds",
                    "technical": "Bugs, outages, integrations",
                    "sales": "Pricing, upgrades, new accounts",
                },
            },
            "frustration": {
                "type": "score",
                "instructions": "How frustrated is the customer?",
                "criteria": ["Calm", "Frustrated", "Very angry"],
            },
        },
    },
)

print(json.dumps(response.json(), indent=2, ensure_ascii=False))
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code overflow="wrap" %}

```javascript
async function main() {
  const response = await fetch('https://api.aimlapi.com/v1/decisions', {
    method: 'POST',
    headers: {
      // insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
      'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: 'heygen/decision-1',
      state: 'Help! My payments have been failing for 3 days and nobody answers support.',
      questions: {
        is_urgent: {
          type: 'noul',
          instructions: 'Does this convey urgency?',
        },
        department: {
          type: 'choice',
          instructions: 'Which team should handle this?',
          criteria: {
            billing: 'Payments, invoicing, refunds',
            technical: 'Bugs, outages, integrations',
            sales: 'Pricing, upgrades, new accounts',
          },
        },
        frustration: {
          type: 'score',
          instructions: 'How frustrated is the customer?',
          criteria: ['Calm', 'Frustrated', 'Very angry'],
        },
      },
    }),
  });

  console.log(JSON.stringify(await response.json(), null, 2));
}

main();
```

{% endcode %}
{% endtab %}
{% endtabs %}

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json
{
  "model": "heygen-decision-1",
  "answers": {
    "is_urgent": {
      "type": "noul",
      "noul": 0.97
    },
    "department": {
      "type": "choice",
      "choice": "billing",
      "confidence": 0.99,
      "probabilities": {
        "billing": 0.99,
        "sales": 0.0,
        "technical": 0.01
      }
    },
    "frustration": {
      "type": "score",
      "score": 1.04,
      "confidence": 0.82,
      "legend": {
        "0": "Calm",
        "1": "Frustrated",
        "2": "Very angry"
      },
      "probabilities": {
        "0": 0.04,
        "1": 0.88,
        "2": 0.08
      }
    }
  },
  "usage": {
    "input_tokens": 1002,
    "output_tokens": 0
  },
  "meta": {
    "model": "heygen/decision-1",
    "provider": "heygen",
    "usage": {
      "credits_used": 281,
      "usd_spent": 0.0
    }
  }
}
```

{% endcode %}

</details>

Every key you send under `questions` comes back under `answers` with the matching type. The top-level `model` is the build that answered (`heygen-decision-1`); `meta.model` is the id you called. Output tokens are always 0: the model returns probabilities, not text.

## Images

Send up to 100 images in **`images`**, in order. Each entry is a JPEG, PNG or WebP image as an http(s) URL or a base64 `data:` URL (`data:image/png;base64,…`). Every question sees all of them, so refer to an image by its position ("image 1", "image 2") in `instructions`. `assets`, which [Jev 1.14](https://docs.aimlapi.com/api-references/decision-models/typesafe/jev-1.14.md) uses for images, is refused by this model, and there is no `box` question.

{% code overflow="wrap" %}

```python
import json, requests

response = requests.post(
    "https://api.aimlapi.com/v1/decisions",
    headers={
        "Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
        "Content-Type": "application/json",
    },
    json={
        "model": "heygen/decision-1",
        "state": "A photo uploaded as a profile picture.",
        "images": ["https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"],
        "questions": {
            "has_animal": {"type": "noul", "instructions": "Is there an animal in image 1?"},
            "animal": {
                "type": "choice",
                "instructions": "Which animal is in image 1?",
                "criteria": {"cat": None, "dog": None, "bird": None, "none": "No animal"},
            },
            "ok_as_avatar": {"type": "noul", "instructions": "Is image 1 safe to show as a public profile picture?"},
        },
    },
)

print(json.dumps(response.json(), indent=2, ensure_ascii=False))
```

{% endcode %}

{% code overflow="wrap" %}

```json
{
  "model": "heygen-decision-1",
  "answers": {
    "has_animal": {
      "type": "noul",
      "noul": 1.0
    },
    "animal": {
      "type": "choice",
      "choice": "cat",
      "confidence": 1.0,
      "probabilities": {
        "bird": 0.0,
        "cat": 1.0,
        "dog": 0.0,
        "none": 0.0
      }
    },
    "ok_as_avatar": {
      "type": "noul",
      "noul": 0.98
    }
  },
  "usage": {
    "input_tokens": 3697,
    "output_tokens": 0
  },
  "meta": {
    "model": "heygen/decision-1",
    "provider": "heygen",
    "usage": {
      "credits_used": 1036,
      "usd_spent": 0.0
    }
  }
}
```

{% endcode %}

A `choice` option can be `null` when its key says it all, as `cat`, `dog` and `bird` do above.

{% hint style="warning" %}
Images are billed as input tokens: 1.5 tokens per 32×32-pixel patch (a 1024×1024 image is 1,536), counted again for every question. The request above billed 3,697 input tokens against 1,002 for the text-only one. Images are never resized: one outside the limits, or a request over 16 MiB once the images are inlined, is refused with a `400` that says what to change.
{% endhint %}

## Video and audio

Send up to 10 videos in **`videos`** and up to 10 audio clips in **`audios`**, in order, next to `images` or on their own. Each entry is a public `https://` URL that answers without a redirect or a login, with a `video/*` or `audio/*` Content-Type (a video up to 50 MiB). Base64 `data:` URLs are not taken for video and audio. Refer to them by position ("video 1", "audio 1") in `instructions`. The model reads the images, then the videos, then `state`.

{% code overflow="wrap" %}

```python
import json, requests

response = requests.post(
    "https://api.aimlapi.com/v1/decisions",
    headers={
        "Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
        "Content-Type": "application/json",
    },
    json={
        "model": "heygen/decision-1",
        "state": "A clip uploaded to a nature channel.",
        "videos": ["https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"],
        "questions": {
            "scene": {
                "type": "choice",
                "instructions": "What does video 1 mainly show?",
                "criteria": {
                    "flower": "A flower or plant up close",
                    "animal": "A mammal or bird",
                    "city": "Streets or buildings",
                    "people": "People",
                },
            },
            "safe": {"type": "noul", "instructions": "Is video 1 safe to show to all ages?"},
        },
    },
)

print(json.dumps(response.json(), indent=2, ensure_ascii=False))
```

{% endcode %}

{% code overflow="wrap" %}

```json
{
  "model": "heygen-decision-1",
  "answers": {
    "safe": {
      "type": "noul",
      "noul": 0.98
    },
    "scene": {
      "type": "choice",
      "choice": "flower",
      "confidence": 0.97,
      "probabilities": {
        "animal": 0.01,
        "city": 0.0,
        "flower": 0.98,
        "people": 0.01
      }
    }
  },
  "usage": {
    "input_tokens": 5448,
    "output_tokens": 0
  },
  "meta": {
    "model": "heygen/decision-1",
    "provider": "heygen",
    "usage": {
      "credits_used": 1526,
      "usd_spent": 0.0
    }
  }
}
```

{% endcode %}

Audio goes the same way, in `audios`:

{% code overflow="wrap" %}

```python
json={
    "model": "heygen/decision-1",
    "state": "A sound uploaded to a sound-effects library.",
    "audios": ["https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3"],
    "questions": {
        "speech": {"type": "noul", "instructions": "Does someone speak in audio 1?"},
        "sound": {
            "type": "choice",
            "instructions": "What is audio 1?",
            "criteria": {
                "speech": "A person talking",
                "music": "Music",
                "animal": "An animal or creature sound",
                "noise": "Machine or background noise",
            },
        },
    },
}
```

{% endcode %}

{% code overflow="wrap" %}

```json
{
  "model": "heygen-decision-1",
  "answers": {
    "sound": {
      "type": "choice",
      "choice": "animal",
      "confidence": 0.92,
      "probabilities": {
        "animal": 0.94,
        "music": 0.02,
        "noise": 0.03,
        "speech": 0.02
      }
    },
    "speech": {
      "type": "noul",
      "noul": 0.06
    }
  },
  "usage": {
    "input_tokens": 261,
    "output_tokens": 0
  },
  "meta": {
    "model": "heygen/decision-1",
    "provider": "heygen",
    "usage": {
      "credits_used": 74,
      "usd_spent": 0.0
    }
  }
}
```

{% endcode %}

{% hint style="warning" %}
Video and audio are billed as input tokens and, like images, counted again for every question: the 5-second clip above billed 5,448 input tokens for its two questions (a 16-second clip is about 11,000 per question), and the audio clip 261. A video or audio URL that is not `https://`, or more than 10 of either, is refused with a `400` before the request reaches HeyGen.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aimlapi.com/api-references/decision-models/heygen/decision-1.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
