Vercel — AI · · 2 min read

Liquid AI's d1 is available on AI Gateway

Mirrored from Vercel — AI for archival readability. Support the source by reading on the original site.

Liquid d1 is now available on AI Gateway.

d1 is a decision model that evaluates shared state against typed questions for classification, routing, and scoring. It returns structured answers with probabilities without generating text tokens. d1 also has vision support: the model can answer typed questions about images for visual classification, inspection, and scoring.

Use liquid/d1 through the AI SDK decision API, the OpenAI-compatible Decisions API, or the TypeSafe-compatible API. These examples ask whether a support agent issued a refund:

API
APITypeSafe-compatDecisions API
import { experimental_decide as decide } from 'ai';
const result = await decide({
model: 'liquid/d1',
state: 'The support agent issued a full refund to the customer.',
questions: {
refunded: {
type: 'boolean',
instructions: 'Was a refund issued?',
console.log(result.answers.refunded);
View model details ↗

Copy link to headingImage input

This example reads a local PNG named square.png and asks which color it shows:

AI SDK
AI SDKTypeSafe-compat
import { readFileSync } from 'node:fs';
import { experimental_decide as decide } from 'ai';
const image = readFileSync('./square.png').toString('base64');
const result = await decide({
model: 'liquid/d1',
state: [
type: 'json',
value: [
'Which color is the square?',
type: 'image_url',
image_url: { url: `data:image/png;base64,${image}` },
questions: {
color: {
type: 'choice',
instructions: 'What color is the square?',
criteria: { red: null, blue: null, green: null },
console.log(result.answers.color);
View model details ↗

AI Gateway provides a unified way to access models and track usage and cost. Decision calls appear in logs and count toward budgets alongside other model requests.

See the decision documentation for Choice, Score, and Boolean questions, or browse all decision models on AI Gateway.

Discussion (0)

Sign in to join the discussion. Free account, 30 seconds — email code or GitHub.

Sign in →

No comments yet. Sign in and be the first to say something.

More from Vercel — AI