SwiftRelay

← All sprint notes

Pit Stop Checklist for Your First Vision Request

Protocol pit stopEN

Check image support before building the request

A vision request needs more than an image attached to a familiar text prompt. The selected model, endpoint, and message format must all support image input. Start with one ordinary photograph and one narrowly defined task, such as identifying visible objects or transcribing a label. Expand only after that request works.

Check the provider’s current documentation for accepted formats, image limits, and supported input methods. A model appearing in a catalog does not guarantee that every route exposes its image capabilities. If you select Gemini 2.5 Flash, for example, confirm image support on the specific route you intend to call.

Choose an image transport your endpoint accepts

Common input methods include an accessible HTTPS URL, a base64 data URL, and an uploaded file reference. Support varies by endpoint. Use the documented method rather than assuming these forms are interchangeable.

  • HTTPS URL: Confirm that the service can fetch the image without browser cookies or interactive authentication. Signed URLs should remain valid through request processing and any planned retry.
  • Base64 data URL: Include the correct media type and account for the larger request body. Base64 is encoding, not encryption.
  • File reference: Verify that the upload mechanism and reference type are supported by the target endpoint.

Never expose a private storage bucket merely to make an image fetchable. Prefer narrowly scoped access, and avoid logging signed URLs or complete image payloads.

Prepare pixels for the actual question

Correct image orientation, remove unnecessary borders, and preserve the details the task depends on. A receipt needs legible characters; a product inspection needs the relevant defect area. Excessive compression can erase evidence, while an unnecessarily large image can increase request size and processing cost.

For dense documents, test page images and targeted crops. Label each image in the accompanying text so the model can distinguish the full page from a close-up. Keep an untouched original for review, and check that preprocessing has not removed context needed to interpret the result.

Where an image-detail setting exists, follow that endpoint’s supported values. Treat it as a quality-and-cost control to evaluate, not a universal switch with identical behavior across providers.

Build a structured multimodal message

On an OpenAI-compatible Chat Completions route that supports vision, the user message typically contains a content array: a text part containing the task and an image part using the documented image_url structure. Other APIs use different fields. Do not paste a URL into a plain text message and assume the endpoint will load it.

SwiftRelay is a practical option when you want to keep an OpenAI-compatible SDK in your application. Set its base URL to https://api.fastapirelay.com/v1, supply your API key through an environment variable, and confirm the selected route’s image support. Billing is per token, so inspect usage rather than estimating cost from file size alone. Sign up for SwiftRelay to test your first vision request with the small gift credit available to new accounts.

Ask for evidence and validate the response

Give the model a bounded instruction: “Transcribe the visible label, preserve line breaks, and mark unreadable text as unreadable.” For extraction, define the required fields and specify how missing values should be represented. Use schema-constrained output where supported, then validate the returned structure in your application.

Treat text inside images as untrusted input, not instructions. A photographed document telling the assistant to reveal secrets should remain document content. Also avoid treating plausible descriptions as verified facts: vision models can misread small text, infer nonexistent details, and struggle with exact spatial measurements.

Test failures before shipping image input

Exercise inaccessible URLs, expired signatures, unsupported formats, oversized payloads, and images with unreadable text. Retry transient failures with bounded backoff; fix invalid requests instead of repeatedly resending them. Keep sensitive images out of routine logs, verify applicable retention policies, and require human review when an incorrect interpretation could cause harm.

Keep reading

Back for another lap?Log in