For the complete documentation index, see llms.txt. This page is also available as Markdown.

d1

This documentation is valid for the following list of our models:

  • liquid/d1

Model Overview

d1 is a decision model from Liquid AI: instead of generating text it reads text and images and returns typed answers — yes/no, choice, score — with calibrated probabilities, in one forward pass with no output tokens. It is built for classification, routing, scoring, moderation, visual inspection and LLM-as-judge checks. Context window is 32,768 tokens.

It speaks the same /v1/decisions wire as Jev, so the request shape is identical and you can swap one for the other by changing model.

d1 also judges for the D1 Router, which uses it to decide how hard each chat request is and route accordingly.

How to make the first API call

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 liquid/d1. ▪ 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) and their criteria.

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

API Schema

post
Body
modelstring · enumRequiredPossible values:
stateany ofOptional

The content to evaluate: a string, a JSON object, or an array of texts. Leave it out when the questions stand alone.

Example: Help! My payments have been failing for 3 days.
stringOptional
or
or
imagesstring · uri[] · max: 8Optional

Up to 8 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. At most 10,000 patches across the images, a side at most 100 times the other, and 4.5 MB for the whole request once the images are inlined.

Responses
200Success
application/json
modelstringRequired

Resolved model version that answered.

post/v1/decisions
POST /v1/decisions HTTP/1.1
Host: api.aimlapi.com
Content-Type: application/json
Accept: */*
Content-Length: 274

{
  "model": "liquid/d1",
  "state": "Help! My payments have been failing for 3 days.",
  "questions": {
    "ANY_ADDITIONAL_PROPERTY": {
      "type": "noul",
      "instructions": "text",
      "criteria": {
        "true": "text",
        "false": "text"
      }
    }
  },
  "images": [
    "https://example.com"
  ],
  "assets": {
    "ANY_ADDITIONAL_PROPERTY": null
  }
}
200Success
{
  "model": "text",
  "answers": {
    "ANY_ADDITIONAL_PROPERTY": {
      "type": "noul",
      "noul": 1
    }
  },
  "usage": {
    "input_tokens": 1,
    "output_tokens": 1
  }
}

Code Example

Response

Every key you send under questions comes back under answers with the matching type.

Two things to notice if you are coming from Jev:

  • output_tokens is 0. d1 reaches its answer in a single forward pass rather than emitting tokens, so the whole cost is the input. The call above billed $0.00001 and returned in 369 ms.

  • Probabilities are full precision. d1 returns values like 0.9724147137760725 where Jev rounds to two decimals. Round them yourself before showing them to anyone.

Last updated

Was this helpful?