A screenshot or photo can tell a local language model things a text prompt leaves out. An image request to LM Studio sends both the picture and the question to a vision model, which returns its description as an assistant reply.

A vision model needs an image encoder to turn pixels into input the language model can use. For SmolVLM FP16, LM Studio loads SmolVLM-500M-Instruct-f16.gguf and its projector mmproj-SmolVLM-500M-Instruct-f16.gguf from the same folder. Both files come from the same publisher revision and belong in ggml-org\SmolVLM-500M-Instruct-GGUF under the LM Studio models directory.

PowerShell sends the PNG as a data URL to LM Studio on the same Windows computer. The requests assume a loaded vision model and a local server listening on 127.0.0.1:1234. The SmolVLM setup on Windows ARM64 uses llama.cpp-win-arm64@2.82.0 with the model loaded as vision-local. With API-token authentication enabled, both requests need the LM Studio bearer token in their headers.

Steps to send an image request to LM Studio:

  1. List the local API's model IDs from PowerShell.
    $baseUrl = 'http://127.0.0.1:1234/v1'
    (Invoke-RestMethod -Uri "$baseUrl/models").data.id
  2. Save the linked test PNG as image.png in your PowerShell working directory.
  3. Encode the PNG as a Base64 data URL.
    $imagePath = (Resolve-Path -LiteralPath '.\image.png').Path
    $imageBase64 = [Convert]::ToBase64String([IO.File]::ReadAllBytes($imagePath))
    $imageUrl = "data:image/png;base64,$imageBase64"

    The data:image/png;base64, prefix tells the server how to decode the bytes that follow it.

  4. Build the chat request with the model ID from the first step.
    $body = @{
        model = 'vision-local'
        messages = @(
            @{
                role = 'user'
                content = @(
                    @{
                        type = 'text'
                        text = 'Describe the main shape and its color.'
                    }
                    @{
                        type = 'image_url'
                        image_url = @{ url = $imageUrl }
                    }
                )
            }
        )
        temperature = 0
        max_tokens = 96
        stream = $false
    } | ConvertTo-Json -Depth 8

    Replace vision-local if your model has a different ID. The user message's content array has one text part for the question and one image_url part for the data URL. -Depth 8 keeps the nested fields when PowerShell serializes the body.

  5. Send the JSON to LM Studio's chat completions endpoint.
    ($response = Invoke-WebRequest -UseBasicParsing -Method Post -Uri "$baseUrl/chat/completions" -ContentType 'application/json' -Body $body).StatusCode

    A successful request shows HTTP 200. A message about unsupported images points to the loaded model or its projector. A message about invalid image data points to the data URL or the bytes in the PNG.
    Related: LM Studio Chat Completions reference

  6. Check that the model's reply describes the image you sent.
    ($response.Content | ConvertFrom-Json).choices[0].message.content
     Red circle on a white background.

    The test image has a red circle on a white background. The wording may vary, but the reply should match visible details such as the shape and color.

Share this guide