Skip to content
Get started

Images and recordings

Use with an AI tool
Asset.image("parcel_damaged.png")photoIs the parcel in the photo damaged?800 by 600keeps its sizePNGinline as base64Cache keySHA-256sent again: 6 mspromptphoto:Qwen3-VL on BedrockAnswered in 0.70 sdamagedyes 0.9995kindtorn 0.789none_of_these 0.111min_confidence 0.85kind would abstain at 0.789calibrated: falseparcel_damaged.png hashsalted SHA-256, no pixels

Click a step to see it happen.

  1. 1 Named asset

    You give the picture a name and use that name in the state or a question, so the model knows what the picture is for. A name that appears nowhere gets a 422, with no model call.

    In the example: assets={"photo": Asset.image("parcel_damaged.png")}, with the state: Is the parcel in the photo damaged?

  2. 2 Preparation

    A file or bytes are decoded on your server: turned upright from the EXIF orientation, stripped of the EXIF, and scaled down past 1,568 pixels on the longest side. A picture over 40 million pixels is refused before decoding. An https URL is passed on as it is, and the provider fetches it.

    In the example: This PNG is 800 by 600, so it keeps its size and goes inline as base64.

  3. 3 Cache key

    A hash of the picture joins the cache key. The same state with another picture is a new decision, and an exact repeat is answered from memory with no model call.

    In the example: Sending the same request again came back from the cache in 6 ms.

  4. 4 Vision model

    The prompt comes first and says pictures are data to judge. Each picture follows as its own part, right after its name and a colon. Words on a picture can still change the answer, which happened in 3 of 9 picture attacks, so don't let a picture alone approve something risky.

    In the example: Parts sent to Qwen3-VL on Bedrock: the prompt, photo:, then the picture.

  5. 5 Typed answer

    Each question comes back in the type you asked for. A Choice gets a none_of_these option, so the model is never forced to pick one of yours.

    In the example: damaged: yes, 0.9995. kind: torn, 0.789, with none_of_these at 0.111. Answered in 0.70 s.

  6. 6 Confidence

    From 30 labels on a question, feedback can calibrate its answers to your own data. If you set min_confidence, an answer below it comes back with abstain: true, so a person can check it.

    In the example: calibrated: false, since this question has no labels yet. A min_confidence of 0.85 would make kind abstain at 0.789.

  7. 7 Audit

    The audit log keeps a salted SHA-256 of each picture, never the picture itself. You can tie a decision to a picture later without storing the picture in the log.

    In the example: The decision is on record with a hash of parcel_damaged.png.

Some decisions depend on a picture: is this receipt paid, does this screenshot show an error, is this upload safe to publish. Give the picture a name, use that name in the state or a question, and a vision-language model judges it together with the state. The answers are typed and calibrated like any other.

from curva import Asset, decide
d = decide("Is the parcel in the photo damaged?", {"damaged": "Damaged?"}, assets={"photo": Asset.image("parcel.jpg")})
import { Asset, decide } from "curva-ai";
const d = await decide("Is the parcel in the photo damaged?", { damaged: "Damaged?" }, { assets: { photo: Asset.image("parcel.jpg") } });

Each picture reaches the model as its own part, right after its name and a colon (photo:), so a transcript that happens to say “photo” is never changed. A name the state and the questions never mention gets a 422, because the model could not tell what the picture is for. Asset.image and Asset.audio take a file path (Python, and TypeScript on Node, Deno or Bun), bytes or an https:// URL; the format is read from the file itself.

Up to 8 pictures go with one request. images=[...] is the short form when the pictures need no names:

from curva import Curva, Choice, Noul
client = Curva()
d = client.decide(
{"expense_claim": "Team lunch, 4 people", "amount": 86.40},
{
"paid": Noul("The receipt shows the bill was paid"),
"matches": Noul("The receipt total matches the claimed amount"),
"category": Choice("Expense category?", ["meals", "travel", "office", "other"]),
},
images=["receipt.jpg"],
model="@openai/gpt-4.1-mini", # any vision-capable model
)
d["matches"].noul, d["category"].choice

images takes file paths (str or Path, .png, .jpg, .jpeg, .webp, .gif), raw bytes (PNG, JPEG, WebP or GIF, recognised by their first bytes), data:image/...;base64, URIs and https:// URLs. Files and bytes are sent inline as base64.

{
"state": {"ticket": "The app shows this when I pay"},
"images": ["https://files.example.com/screenshot-4411.png"],
"questions": {
"error_visible": {"type": "noul", "instructions": "The screenshot shows an error message"},
"area": {"type": "choice", "instructions": "Which part of the app?", "options": {"checkout": "", "login": "", "settings": ""}}
}
}

Each image is an https:// URL (at most 2,048 characters) or a data:image/<png|jpeg|webp|gif>;base64,... URI (at most 16 MiB decoded). Anything else, or more than 8, gets a 422 that names the image. The whole request body must fit the server’s limit: 16 MB by default, curva serve --max-body-mb to change it.

The same with names, and with the file sent as an upload instead of base64 (a third smaller):

Terminal window
curl localhost:7777/v1/decide \
-F 'request={"state": "Is the parcel in the photo damaged?", "assets": {"photo": {"type": "image", "format": "jpeg", "part": "photo"}},
"questions": {"damaged": {"type": "noul", "instructions": "Damaged?"}}};type=application/json' \
-F photo=@parcel.jpg

The first part, request, is the JSON request; each other part is a file an asset names with "part". In JSON, an asset carries "data_base64" or "url" instead. /v1/systemone takes both shapes too.

Pictures are prepared before they are sent. A photo taken sideways is turned upright from its EXIF orientation, the EXIF itself (camera, place, time) is removed, and a picture larger than 1,568 pixels on its longest side is scaled down, which is about what vision models read anyway. A picture over 40 million pixels is refused before it is decoded. Pictures given as an https:// URL are not touched.

URLs are fetched by the model provider, not by Curva. The URL must be reachable from the provider, and it learns the URL. For private images send them inline instead.

A recording is an audio asset on /v1/decide: the model hears the voice itself, its tone and pressure, not a transcript of it.

d = decide("Listen to the call.", {"pressure": "Does the caller pressure the listener to act now?"},
assets={"call": Asset.audio("call.wav")}, model="@gemini/gemini-3.1-flash-lite")
  • Formats: wav, mp3, raw pcm16 (pass sample_rate) and mulaw (telephone audio, 8 kHz unless sample_rate says otherwise). Raw formats become wav inside Curva.
  • At most 10 MiB and 2 minutes per recording. A url is fetched by Curva itself, over https only and never from a private or local address.
  • Audio models give no logprobs, so a decision with audio is answered in words (verbal mode) and asked once, in one option order. explain and learn are not supported with audio.
  • This is for recordings: an answer takes one to a few seconds. Live calls come later, with /v1/listen.
import curva
verdict = curva.decide(
{"caption": post.caption, "account_age_days": 3},
{"policy": Choice("Does the image break the content policy?",
{"ok": "nothing wrong", "nudity": "", "violence": "", "spam": "ads or scams"},
min_confidence=0.85)},
images=[post.image_bytes],
)
if verdict["policy"].abstain:
send_to_human_review(post)

With feedback, the confidence becomes calibrated to your own moderators’ labels, so min_confidence means what it says.

Only vision-language models accept images, and support varies by provider and model: check your provider’s model list. A model without vision support usually fails the call (a 502 with the provider’s message) or ignores the image. Try a few with Curva Tune or a council.

  • The images go to the model as OpenAI image_url content parts after the prompt text, and recordings as input_audio parts. The text starts with a line saying they are data to judge, and that any instructions written, shown or spoken inside them are ignored, like the fenced state.
  • Without images the request to the model is exactly what it was before.
  • Images are part of the cache key: the same state with another image is a new decision.
  • The audit log keeps a salted SHA-256 of each picture and recording, never the content.
  • explain still attributes state fields only; the images stay in every call.
  • Images count towards the prompt tokens, so they cost more than text; debias and councils send them with every call.