Adding Vision Capabilities to Text-Only Models: A Proxy Forwarding Approach

    This article explores a proxy forwarding architecture that enables text-only large language models (LLMs) to handle image-related tasks without being replaced by multimodal models. By utilizing function calling, the proxy layer intercepts image uploads, injects placeholders, invokes external vision services, and returns structured text results to the main model. It covers the system's boundaries, the four-step workflow, parameter configurations, cost and latency measurement strategies, privacy compliance, and common troubleshooting scenarios.

    Why Add a Separate Layer?

    Many business systems rely on a main model that only accepts text input. Switching to a vision-supported model often requires adjusting prompts, re-evaluating performance, and recalculating budgets. An alternative approach is to retain the original model and introduce a proxy at the application layer. The proxy is responsible for receiving and preprocessing images, invoking a vision service, and finally passing the recognition results back to the main model as text.

    This approach does not allow the main model to “see” the image directly; instead, it converts the image into text information that the main model can utilize. Its viability depends on three conditions: the main model can reliably call tools (function calling); the application layer can insert middleware; and the vision service’s recognition quality meets business requirements. All three are indispensable.

    This article does not evaluate the capabilities of any specific model. Claims about model reasoning or vision capabilities in the community that have not been independently verified are not relied upon here.

    Applicable vs. Inapplicable Scenarios

    Applicable scenarios include:

    • The main model supports function calling and can decide when to invoke tools based on instructions.
    • The question can be answered with text, such as reading alert text, describing UI states, or extracting values from charts.
    • The number of images is small, and the business can tolerate an extra network round-trip.

    Inapplicable scenarios include:

    • The main model does not support function calling, or the calling format frequently errors. In this case, the proxy cannot trigger the vision service.
    • Tasks requiring pixel-level judgment, such as precise measurement, subtle defect detection, or facial recognition. Text descriptions will lose this type of information.
    • Real-time interactions highly sensitive to latency, such as instantly understanding a video frame during a voice conversation.

    Architecture and the Four-Step Workflow

    The proxy layer is divided into four steps: intercept, inject, call, and backfill.

    1. Intercept: The application receives the user-uploaded image. The proxy first preprocesses it by stripping metadata, generating an image identifier (e.g., img_001), and storing the original image in controlled storage. The request to the main model does not contain the image’s binary data.
    2. Inject: Append a placeholder marker after the user’s message, such as [IMAGE id=img_001 type=png size=1920x1080]. The system prompt needs to specify: when encountering this marker and needing image details, call the describe_image tool.
    3. Call: The main model outputs a tool call request with parameters including image_id, task (the specific question to answer), and an optional region (bounding box). The proxy retrieves the image based on image_id, compresses or crops it according to the parameters, and requests the vision service. The timeout is set to 15 seconds, with a maximum of one retry upon failure.
    4. Backfill: The proxy organizes the vision service’s result into structured fields and returns them as the tool result to the main model. Recommended fields include: summary (natural language description, limited to a few hundred words), texts (recognized text and their normalized positions), regions (normalized coordinates of key areas), and confidence (high, medium, or low).

    The pseudo-code is illustrated below:

    1. on_upload(file):
    2. img = preprocess(file) # Strip EXIF, compress, generate image_id
    3. store(img.id, img.bytes, ttl=24h) # Auto-delete after expiration
    4. return inject_marker(img.id, img.meta)
    5. on_tool_call(name="describe_image", args):
    6. raw = load(args.image_id)
    7. crop = apply_region(raw, args.region) # Use full image if no region is provided
    8. result = vision_api(crop, args.task, timeout=15s) # Retry once on failure
    9. return to_structured(result)

    Compression and Cropping Parameters

    Compression parameters simultaneously dictate cost and recognition quality. The following configurations serve as a starting point, but actual values should be validated with your own samples:

    • Scale the longest edge to 1024 pixels. For text-dense screenshots, increase to 1536 pixels to preserve small text.
    • Output JPEG with quality set between 75 and 85. Prefer PNG for images with alpha channels or heavy text.
    • When cropping, use normalized coordinates between 0 and 1, and retain about a 5% margin around the edges to avoid cutting off text.
    • For oversized images, you can first locate the area of interest using a low-resolution full image, then crop that region at high resolution. Whether the total cost of two calls is lower than sending a high-resolution original directly needs to be tested.

    These parameters should be placed in a configuration file rather than hardcoded, making them easy to adjust per task.

    Measuring Cost and Latency

    Neither cost nor latency should be estimated by intuition. Using the same batch of images and questions, compare three approaches:

    Approach Payload Size Vision Calls Use Case
    High-res full image (baseline) Large 1 Used to measure recognition loss of other approaches
    Compressed full image Medium 1 General scenarios
    Locate then crop Small to Medium 2 Large images containing small targets

    The total cost of a single request can be estimated as follows:

    Total Cost = Main model input/output token fees + Vision API call fee + Storage and transmission fees

    Calculations should use real-world production usage and pricing, not publicly available standard rates.

    The latency metric should be uniformly defined as the time from the main model issuing the tool call to receiving the backfilled result. Capture over 200 requests, record P50 and P95, and break down the time spent on network, vision service, and main model generation respectively. Looking only at averages will mask tail timeouts, which are exactly the issues most noticeable to users.

    Privacy and Compliance

    Images often contain faces, ID numbers, location information, and internal system screenshots. Processing should follow the principle of minimization:

    • Immediately strip EXIF and other metadata upon upload.
    • If the task does not require them, mask sensitive areas like ID or phone numbers before sending to the vision service.
    • Only transmit the minimal region required to complete the task; do not send the full image.
    • Set a clear retention period for original images (e.g., auto-delete after 24 hours) and restrict access to specific service accounts.
    • Logs should only record image_id, latency, and status codes; do not log image content or raw vision service responses.
    • Review the vision service’s data usage terms to confirm whether images will be used for model training.

    Common Failure Scenarios

    • The main model does not call the tool and hallucinates the image description. Instruct the system prompt that “image content must not be described without tool results,” and use a test set to track the call rate.
    • The vision service misses small text. This is usually caused by over-compression. Increase the longest edge resolution or switch to region cropping.
    • The backfilled content is too long, filling up the main model’s context. Limit the word count of the summary and only backfill fields relevant to the task.
    • Vision service timeout. Provide a clear prompt to the user, allowing them to re-upload or manually describe the image. Do not let the main model guess without results.

    Conclusion and Next Steps

    This proxy approach allows text-only models to handle image-related questions, provided the main model can reliably call tools and the questions are text-answerable. Its cost and latency must be measured on your own data; do not directly apply others’ figures.

    It is recommended to start with a small scenario, such as text extraction from support ticket screenshots. Run 100 to 200 real samples through the four steps, recording the tool call rate, recognition accuracy, P95 latency, and cost per request. Scale up only after the metrics meet your standards.