LatentKit

Vision

POST /v1/vision — analyze images with a prompt through the assigned route.

POST /v1/vision sends one image plus a text prompt to a vision-capable model on the assigned route. The route must include a model with the vision capability.

Request

Provide exactly one image source: image_url or image_base64.

curl https://ai.latentkit.com/v1/vision \
  -H "Authorization: Bearer $LATENTKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "What product is shown in this image?",
    "image_url": "https://example.com/product.jpg",
    "max_tokens": 300
  }'
curl https://ai.latentkit.com/v1/vision \
  -H "Authorization: Bearer $LATENTKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Describe this diagram for a changelog entry.",
    "image_base64": "<base64-image-data>",
    "max_tokens": 300
  }'

Fields

FieldDescription
promptQuestion or instruction about the image (required)
image_urlHTTPS image URL on an approved domain (use this or image_base64) — see Image URL safety
image_base64Base64-encoded image data (use this or image_url)
systemOptional system instruction
max_tokensOutput token limit (default 1000)
temperatureSampling temperature (default 0.7)
streamSet true for SSE streaming — see Streaming
response_profilefast, balanced, or deep when the route allows overrides

Sending both image_url and image_base64, or neither, returns a VALIDATION_ERROR.

Image URL safety

Remote image_url input may be disabled for your workspace. When available, the URL must use HTTPS, match an approved host, return a supported image type and declared size, and remain within the service limits. Invalid remote inputs return a 400 validation error.

Use image_base64 when the image should not be publicly reachable or remote URLs are unavailable.

SDK

const analysis = await client.vision.create({
  prompt: 'What product is shown in this image?',
  image_url: 'https://example.com/product.jpg',
  max_tokens: 300,
});

console.log(analysis.content);

Streaming works the same way as chat with client.vision.stream({ ... }).

analysis = client.vision.create(
    prompt="What product is shown in this image?",
    image_url="https://example.com/product.jpg",
    max_tokens=300,
)

print(analysis["content"])

Streaming works the same way as chat with client.vision.stream(...).

Vision inside chat

You can also send image content parts inside POST /v1/chat messages (OpenAI-style image_url content blocks). When a chat request contains image input, LatentKit automatically requires the vision capability on top of text, so only vision-capable route models are eligible.

Response

Vision responses use the same envelope as chat: content holds the model's answer, plus id, provider, model, policy_version_id, and usage. See Response contract.

Billing

Vision usage and availability depend on the selected route model and access type. Check the route and estimated cost in the console before production use.

Troubleshooting

  • NO_HEALTHY_PROVIDER usually means the assigned route has no model with the vision capability. Check Routes and Connections in the console.
  • Free managed allowances cover plain chat, image generation, and embeddings — vision typically requires credits or a BYOK route.

On this page