How to Use Decision Models with the Unified GenAI API

Updated:


November 11, 2026

Generative models write text for people to read.

But a lot of AI work in a product is really a decision: is this ticket urgent, which team should handle it, does this reply promise a refund, how well does this candidate match the job?

Asking a chat model, then parsing its prose, adds latency, cost and fragile parsing code.

Decision models are built for that job. Instead of generating text, they score a fixed set of answers and return calibrated probabilities your code can branch on directly. With the Unified GenAI API, you call them through the same genai_prompt endpoint you already use for chat. Add typed questions and you get typed answers back.

What you can ask

Every decision request sends shared input (your messages) plus one or more typed questions. Each question is answered independently against the same input.

Question typeUse it toWhat you get back
BOOLEANCheck whether a statement holds (gates, filters, policy checks)score: the probability (0–1) that the answer is yes
CHOICEPick one option from a fixed list (routing, classification, tool or model selection)value: the top option, probabilities for every option, confidence
SCORERate the input on an ordered scale (severity, priority, rubric grading)score: the probability-weighted level (0 = first level), probabilities per level, confidence
Output tokens are typically zero or near zero, so decisions are fast and inexpensive compared with generating and parsing text.

Step 1: Find a decision model

List the models on a GenAI connection. Decision models have has_questions: true; models that also accept images have has_vision: true.

curl "https://api.unified.to/genai/$CONNECTION_ID/model" \
  -H "Authorization: Bearer $UNIFIED_API_KEY"

Use https://api-eu.unified.to or https://api-au.unified.to for workspaces in the EU or AU regions.

Not every provider flags its decision models in the model list (OpenAI, for example, doesn't). The table under Supported providers lists the decision model IDs for each integration.

Step 2: Ask your questions

Send a POST to /genai/{connection_id}/prompt with your messages and a questions array. Give each question a unique id; its answer comes back with the same id. For CHOICE and SCORE questions, list the options (or levels, lowest first) in options.

curl -X POST "https://api.unified.to/genai/$CONNECTION_ID/prompt" \
  -H "Authorization: Bearer $UNIFIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model_id": "gpt-6-luna",
    "messages": [
      { "role": "USER", "content": "Audio cuts out on the left earcup. Fix it today or I cancel my membership." }
    ],
    "questions": [
      { "id": "is_defect", "type": "BOOLEAN", "instructions": "Does the message describe a hardware defect?" },
      {
        "id": "department",
        "type": "CHOICE",
        "instructions": "Which team should handle this request?",
        "options": ["billing", "technical", "shipping", "other"]
      },
      {
        "id": "churn_risk",
        "type": "SCORE",
        "instructions": "How likely is the customer to churn if this is not resolved now?",
        "options": ["No churn signal", "Mild frustration", "Mentions alternatives", "Threatens to cancel"]
      }
    ]
  }'

The model_id depends on the provider; see the table below. The response contains one answer per question:

{
  "model_id": "gpt-6-luna",
  "answers": [
    { "id": "is_defect", "type": "BOOLEAN", "score": 0.94 },
    {
      "id": "department",
      "type": "CHOICE",
      "value": "technical",
      "probabilities": [
        { "option": "technical", "probability": 0.91 },
        { "option": "billing", "probability": 0.05 },
        { "option": "other", "probability": 0.03 },
        { "option": "shipping", "probability": 0.01 }
      ],
      "confidence": 0.91
    },
    {
      "id": "churn_risk",
      "type": "SCORE",
      "score": 2.97,
      "probabilities": [
        { "option": "No churn signal", "probability": 0.0 },
        { "option": "Mild frustration", "probability": 0.0 },
        { "option": "Mentions alternatives", "probability": 0.03 },
        { "option": "Threatens to cancel", "probability": 0.97 }
      ],
      "confidence": 0.97
    }
  ],
  "tokens_used": 324
}

The values above are illustrative. The original provider response is always available in raw.

Step 3: Act on the answers

Use the answer to choose an action, and the probability or confidence to decide whether to act automatically or escalate:

const res = await fetch(`https://api.unified.to/genai/${connectionId}/prompt`, {
    method: 'POST',
    headers: { Authorization: `Bearer ${process.env.UNIFIED_API_KEY}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ model_id: 'gpt-6-luna', messages, questions }),
});
const { answers } = await res.json();
const byId = Object.fromEntries(answers.map((a) => [a.id, a]));

if (byId.is_defect?.score > 0.9 && byId.department?.confidence >= 0.7) {
    routeTo(byId.department.value);
} else {
    routeTo('human_review');
}

Set thresholds using labeled examples from your own traffic, and weigh the cost of a false positive against a false negative.

Images

Models with has_vision: true can evaluate images. Attach them to a message as base64 data URLs:

{
  "role": "USER",
  "content": "Customer photo for return request #8821.",
  "images": ["data:image/jpeg;base64,/9j/4AAQSk..."]
}

Remote image URLs are not accepted; send the image bytes inline.

Supported providers

IntegrationDecision models (model_id)Limits and notes
OpenAIgpt-6-luna (default when model_id is empty)Up to 200 questions. CHOICE: 2–255 options. SCORE: 2–10 levels. USER messages only. Images as data URLs.
TypeSafeJev, e.g. jev-latest (model_id and questions required)CHOICE: up to 255 options. SCORE: 2–10 levels. Text only. A conversation is sent with its roles.
Cloudflare Workers AIClef: @cf/cloudflare/clef, @cf/cloudflare/clef-flash1–64 questions. Images: PNG, JPEG or WebP data URLs, up to 4 (4 MiB each, 8 MiB total). The same connection also serves chat models.
Zoom AI Serviceszoom-decisions, zoom-decisions-pro1–10 questions. CHOICE: 2–255 options. SCORE: 2–10 levels. Images as data URLs.
Google Geminigemini-decision-1 (default when model_id is empty)Up to 1,000 questions. CHOICE and SCORE: 2–255 options or levels. USER messages only. Images as data URLs.
Requests that break a provider's limits are rejected with a clear 400 before anything is sent. On the generative providers (OpenAI, Cloudflare Workers AI, Google Gemini), a prompt without questions keeps working as a normal chat request.

Tips for good decisions

  • Ask narrow, single-purpose questions. Combine several simple answers with ordinary if statements in your code, rather than packing everything into one question.
  • Add a catch-all option such as other to CHOICE questions. Choice questions always spread probability across your options, even when none fits.
  • Order SCORE levels from lowest to highest and keep adjacent levels clearly distinct. The returned score can fall between levels, so check the per-level probabilities when inputs are borderline.
  • Put independent questions in one request. They share the same input, so asking several at once is cheaper and keeps the context consistent.
  • Handle missing answers. Some providers can decline a single question; it is then left out of answers, while the other questions are still answered.

When to use a generative model instead

Use a regular chat model (a genai_prompt without questions) when you need to write, summarize, extract fields or explain. Decision models and chat models work well together: use a decision model to route or gate a request, and then send the approved requests to a generative model.

Share
All guidesGenAI APIsAccounting Account Type Hierarchy in UnifiedAdvertising Report Metrics by IntegrationAmazon S3: Required IAM PermissionsATS to Vector DB: How to Power Talent Intelligence with Real-Time DataBuilding AI applications with Unified and LangbaseConcur & Concur (Company) — Connection GuideConfigure Greenhouse Native Candidate WebhooksConfigure Salesforce Meetings and Notes for UnifiedConnect Amazon Seller Central to Unified.toConnecting BambooHR via OAuth 2Connecting Google Workspace Integrations with a Service AccountCorrect WelcomeKit Scopes for Jungle IntegrationCreating Ads using the Unified Ads APICreating Walmart Items via UnifiedEnd-Users, Integrations, and ConnectionsEnriching Unified Objects with Custom MetadataEnterprise-managed authorization (EMA) with a static keyEnterprise-managed authorization (EMA) with a workspace secretEnterprise-managed authorization (EMA) with Microsoft Entra IDExtended observability — pushing API logs to ClickHouseExtended observability — pushing API logs to Grafana / LokiExtended Observability - Pushing API Logs to your Datadog InstanceFacebook Messenger Webhook SetupFireflies Integration GuideGetting started with WorkableHandling Delegated vs. Application Scopes in Microsoft IntegrationsHiBob & Unified: connection and time off guideHow long are logs retainedHow to access employees and usersHow to add API support for the Create Activity in CrelateHow to Associate a Connection ID with Your End-UserHow to build a Candidate Assessment product withHow to build a candidate sourcing or job board app with Unified.toHow to build a Discord support bot with Unified.to and LangbaseHow to Build a Fintech Application with Unified's Payments APIHow to Build an E-Commerce Product Integration with UnifiedHow to build an invoicing system with Unified.toHow to build Enterprise Search using RAGHow to configure Bullhorn Redirect URI for creating a connectionHow to configure webhooks in HubSpotHow to configure webhooks in Thrive LearningHow to configure webhooks in Toast for UnifiedHow to Connect Anthropic to Real-Time SaaS Data with Unified.to MCP ServerHow to Connect Cohere to Real-Time SaaS Data with Unified.to MCP ServerHow to Connect Google Gemini to Real-Time SaaS Data with Unified.to MCP ServerHow to connect HiBob (Bob) to Unified with OAuth 2.0How to Connect LLMs to Real-Time SaaS Data with Unified.to MCP ServerHow to Connect OpenAI to Real-Time SaaS Data with Unified.to MCP ServerHow to Connect Zoom and Zoom PhoneHow to create a Connection In Microsoft TeamsHow to create a token-based connection in HighlevelHow to Create a Unified.to Connection to HighLevelHow to Create a Xero Connection in Unified.toHow to create and configure webhooksHow to create Connection with HubspotHow to customize portal URLs for Stripe and GoCardlessHow to filter webhook eventsHow-to Get a Private Support Channel for Your Unified IntegrationHow to get help fromHow to get your 8x8 Connect API Key, Account ID and SMS Subaccount ID (optional): Step-by-step guideHow to get your ADP Workforce Now Oauth2 client ID, Oauth2 client secret, Oauth2 PEM certificate and Oauth2 private key: Step-by-step guideHow to get your Amazon S3 AWS Region, AWS S3 Key and AWS S3 Secret: Step-by-step guideHow to get your Ashby API Key: Step-by-step guideHow to get your Brex API token: Step-by-step guideHow to get your Bullhorn OAuth2 Client ID, OAuth2 Client Secret, API Username and API Password: Step-by-step guideHow to get your Ceridian Dayforce Username, Password and Client Namespace: Step-by-step guideHow to get your Crelate API key: Step-by-step guideHow to get your Dashlane API Key: Step-by-step guideHow to get your Deel Access Token: Step-by-step guideHow to get your Dialpad API Key: Step-by-step guideHow to get your Discord OAuth 2 credentials and bot tokenHow to get your ELMO client ID and client secret: Step-by-step guideHow to get your Gainsight Client ID, Client Secret and Gainsight API Domain: Step-by-step guideHow to get your Greenhouse API Key and Job board token: Step-by-step guideHow to get your Helpscout API Key: Step-by-step guideHow to get your HiBob Service User ID and Service User Token: Step-by-step guideHow to get your HighLevel API Key and Location ID: Step-by-step guideHow to get your HubSpot developer key and OAuth 2 credentials (Legacy Apps)How to get your Humaans API Key: Step-by-step guideHow to get your iCIMS API Username, API Password and Customer ID: Step-by-step guideHow to get your JobDiva Client ID, Username/email and Password: Step-by-step guideHow to get your Jobvite API Key, API Key Secret and Email: Step-by-step guideHow to get your Lever API Key: Step-by-step guideHow to get your Loxo Agency slug, API Key and Agency ID: Step-by-step guideHow to get your Microsoft Active Directory / Entra ID Client ID, Client Secret and Tenant ID: Step-by-step guideHow to get your Microsoft Azure AD OAuth 2 credentialsHow to get your OAuth 2 credentials for GmailHow to get your OAuth 2 credentials for Microsoft Dynamics 365How to get your OAuth 2 credentials in PipeDriveHow to get your OpenAI API Key: Step-by-step guideHow to get your Paycom SID/Username and Token/Password: Step-by-step guideHow to get your PCRecruiter Username, Password, Database ID, App Key and App ID: Step-by-step guideHow to get your SAP SuccessFactors (OpenID Connect) Username, Password, Client ID, Client Secret, Dependency Name, IAS Host and API URL: Step-by-step guideHow to get your SAP SuccessFactors Username, Company ID, Password and API URL: Step-by-step guideHow to get your Shopify Admin API access token and Store ID: Step-by-step guideHow to get your Wayfair Client ID, Client Secret and Vendor Encrypted Key: Step-by-step guideHow to get your Workable API Token and Subdomain: Step-by-step guideHow to get your yotpo APP Key / Store ID and Secret Key: Step-by-step guideHow to Handle Attachments in Invoice, Bill and Credit MemoHow to Manage Google Ad Manager Orders, Line Items and Creatives with theHow to migrate or import your integrations into Unified.toHow to obtain your GitHub OAuth2 credentialsHow to Power Claude with Live Customer Data Using Unified MCPHow to receive assessment orders from an ATS with Unified.toHow to register a Google developer app and get OAuth 2 credentialsHow to register a Salesforce developer app and get OAuth 2 credentialsHow to register a Slack developer account and get OAuth 2 credentialsHow to Register a Workday Developer App and Get OAUTH2 CredentialsHow to Register a Workday Developer App and Get OAUTH2/ SOAP CredentialsHow to Register a ZendeskSell Developer App and Get OAUTH2 CredentialsHow to Register a Zoho Developer App and Get OAUTH2 CredentialsHow to Register an ADP Developer App and Get OAUTH2 CredentialsHow to Register an Atlassian Developer App and Get OAUTH2 CredentialsHow to Register your Facebook OAuth2 ApplicationHow to Register your Google Ads OAuth2 ApplicationHow to Register your MetaAds OAuth2 applicationHow To Request & Write Raw Integration DataHow to Retrieve Microsoft Dynamics 365 Business Central CredentialsHow to set up a custom API URL with a CNAMEHow to Set Up a Google Meet Meeting Bot with UnifiedHow to set up a HiBob marketplace installHow to Set Up a Microsoft Teams Bot with UnifiedHow to Set Up a Microsoft Teams Meeting Bot with UnifiedHow to Set Up a Webex Meeting Bot with UnifiedHow to Set Up a Zoom Meeting Bot with UnifiedHow to set up and configure NotionHow to set up Google Business Profile API access and get OAuth 2 credentialsHow to Set Up LinkedIn Webhooks with UnifiedHow to set up native webhooks for QuickBooks Online with UnifiedHow to set up Slack webhooks using event subscriptionsHow to set up Telegram (bot) with Unified.toHow to set up your scopes in HubSpotHow to setup a Freshbooks developer appHow to setup a TikTok Shop applicationHow to Setup AWS Assume Role for AWS Secret ManagerHow to setup Oracle JD EdwardsHow to Setup Quickbooks DesktopHow to setup Sage 100 with Unified.toHow to test webhooks in the Synthetic Data (Sandbox) environmentHow to troubleshoot unhealthy connectionsHow to troubleshoot unhealthy webhooksHow to use SCIM with the Unified APIHow to use the Passthrough APIHow to Use Unified.to's Generative AI API with OpenAI and ClaudeHow to use User Provisioning and Verification with UnifiedHow virtual webhook retry and recovery worksIntegration set-up guide for LeverManaging custom validation rules in SalesforceNetSuite Authentication Setup for UnifiedNotice of Deprecation of Fields and Objects (Nov 2025)Oracle HCM / Taleo OAuth Credentials GuideRetrieval-Augmented Generation (RAG)SalesForce (External Client Apps) on Multiple OrganizationsSAML Single-Sign-OnScaling MCP Tools with Anthropic's (& OpenAI's) Defer LoadingScaling MCP Tools with Anthropic's Programmatic Tool CallingSet Environments for your Unified.to WorkspaceSetting up a Slack Bot Connection with Unified.toSetting up OAuth 2 Credentials for Greenhouse's APIsTrello Connection Guide in UnifiedUnderstanding OAuth2 Authorization flowsUnderstanding Response Time Headers in the Unified APIUnified Assessment API: Embed Assessments Inside ATS PlatformsUnified's MCP ServerUnified MCP Server with LangChain and LangGraphUnlock real-time data with virtual webhooksUse Unified to sign in your users into your applicationVincere OAuth Setup Guide for UnifiedWorkable: Creating candidates and attaching them to jobsWorkday vs Workday Legacy — Why Unified.to Supports BothWorking with hierarchical tree data in Storage, Messaging, and KMS APIs
Are we missing anything? Let us know
Was this page helpful?