Skip to content
Heimdallm
Marketplace/Documentation
Documentation · Guides

Images & vision

Vision models take images inside an ordinary chat message: the content becomes an array of parts mixing text and images. Send the image as a base64 data URL, or name it by an https: URL and the gateway reads it for you. Either way the endpoint receives the bytes inside the request: no provider is ever sent a URL to fetch.

Finding a vision model

A model that accepts images lists image in its input modalities:

"architecture": { "modality": "text+image->text", "input_modalities": ["text", "image"], ... }

Filter the model list by input, or check architecture.input_modalities in the catalogue.

Sending an image

Encode the file, build a data: URL with its media type, and put it in an image_url part:

import base64, os
from openai import OpenAI

client = OpenAI(base_url=BASE_URL, api_key=os.environ["HEIMDALL_API_KEY"])

with open("chart.png", "rb") as f:
    data_url = "data:image/png;base64," + base64.b64encode(f.read()).decode()

completion = client.chat.completions.create(
    model="huggingfacetb/smolvlm2-2.2b",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What does this chart show?"},
                {"type": "image_url", "image_url": {"url": data_url}},
            ],
        }
    ],
)
print(completion.choices[0].message.content)

The same request as raw JSON:

{
  "model": "huggingfacetb/smolvlm2-2.2b",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "What does this chart show?" },
        {
          "type": "image_url",
          "image_url": { "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...", "detail": "auto" }
        }
      ]
    }
  ]
}
FieldTypeMeaning
image_url.urlstringA data:<media type>;base64,<data> URL carrying the image bytes, or an https: URL.
image_url.detailstringauto (default), low or high — processing detail, where the endpoint distinguishes.

A message may carry several images, interleaved with text parts, up to the model's context. Images sent as data URLs count against the 8 MB request body limit, which is the practical ceiling on their size, since base64 grows the bytes by about a third.

Images by URL

An https: URL in image_url.url is read by the gateway before the request is routed, and the endpoint is sent the picture as a data URL in its place, typed by what the bytes are rather than by what the origin says they are. The read is bounded: at most 16 distinct URLs and 32 MiB per request, an answer within 10 seconds, and public addresses only. A URL that cannot be read within those bounds, or that holds no PNG, JPEG, WebP or GIF picture, is answered 400 naming the part before any provider is called; the full list of bounds is under Media named by URL. Nothing read from a URL is logged, stored or cached.

Pricing

Image inputs are tokenized by the serving model and billed as prompt tokens at the endpoint's prompt price, and nothing else. There is no per-input-image price on this marketplace: the only per-picture meter is image_megapixel, which is charged on the pixels an endpoint RENDERS. As everywhere, an undeclared unit is never silently billed (see Pricing & billing).

DiscoverFind your next modelModel libraryAll models, versions, prices and capabilitiesBenchmarksMeasured quality, cost and time by serving configurationModel requestsAsk for a model, and vote on what is listed nextShowcaseImages, video and 3D made on the marketplaceProvidersCompare independent inference providersActivityMarketplace traffic and usageNetwork statusAvailability, latency and endpoint healthChatConversations, model settings and filesImage, video & 3DGenerate images, video and 3D assetsScene studioStage a shot in 3D, direct it and render it as a videoCoding playgroundBuild software with an AI agent on a machine of your ownOverview & routingIdentity, workspaces and routing preferencesBalance & depositsBalance, deposits, ledger and reserved fundsAPI keysKeys scoped to workspaces, limits and expirationOrganizationsTeams, members and shared workspacesRequest historyRequests, receipts, sandbox sessions and account historyReferralsInvitations and referral earningsPrivacyData settings, exports and deletionDocumentationQuickstart, SDKs, pricing and guidesAPI referenceInteractive endpoint referenceList your modelsProvider guide: requirements, the fee, payouts and what is measuredProvider payoutsMonthly statements, the marketplace fee and payout walletsProvider dashboardApply as a provider, add sources and track earnings