Skip to content

Vision & Multimodal Guide

In addition to text completions and image generation, KoboiLLM natively supports Vision Models — AI models capable of “seeing” and analyzing input images. Ideal applications include:

  • Automated captioning and alt-text generation
  • Document processing and simple OCR
  • Product photo and screenshot inspection
  • Visual Question Answering (Visual QA)

The API strictly adheres to the standard OpenAI Chat Completions specification using multimodal array content, making existing OpenAI and LiteLLM SDKs immediately compatible.


Table of Contents

  1. Endpoint & Authentication
  2. Available Vision Models
  3. Quick Start — Sending Image URLs
  4. Sending Local Images (Base64)

1. Endpoint & Authentication

Base URL:

https://api.koboillm.com/v1

Append the endpoint path to the API origin, or configure this base URL in your SDK.

Primary Endpoint: POST /v1/chat/completions — identical to standard chat completions, except that the user message content field is structured as an array containing text and image_url objects.

Authentication: Send Authorization: Bearer sk-xxxxxx. Set the key in your environment:

Terminal window
export LITELLM_API_KEY="sk-xxxxxx"

2. Available Vision Models

The following models natively support image understanding at KoboiLLM:

ProviderEndpoint NameBest Used For
OpenAIopenai/gpt-4o-miniFast & budget-friendly vision — recommended default
OpenAIopenai/gpt-4oHigh-reasoning visual analysis and complex layout reading
Google Geminigemini/gemini-2.5-flashHigh-speed, low-cost multimodal processing
Google Geminigemini/gemini-2.5-proComprehensive document analysis and detailed OCR

For the live model catalog, query /v1/models or check your dashboard at dashboard.koboillm.com.


3. Quick Start — Sending Image URLs

3.1 — cURL

Terminal window
curl -X POST https://api.koboillm.com/v1/chat/completions \
-H "Authorization: Bearer sk-xxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Describe what you see in this image in detail." },
{
"type": "image_url",
"image_url": {
"url": "https://docs.koboillm.com/koboi_llm_logo.png"
}
}
]
}
]
}'

3.2 — Python (OpenAI SDK)

from openai import OpenAI
client = OpenAI(
base_url="https://api.koboillm.com/v1",
api_key="sk-xxxxxx",
)
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe what you see in this image."},
{
"type": "image_url",
"image_url": {"url": "https://docs.koboillm.com/koboi_llm_logo.png"},
},
],
}
],
)
print(response.choices[0].message.content)

4. Sending Local Images (Base64)

For local images stored on disk, encode the image to base64 and supply it as a data URL:

import base64
from openai import OpenAI
client = OpenAI(
base_url="https://api.koboillm.com/v1",
api_key="sk-xxxxxx",
)
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
base64_image = encode_image("document.png")
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Extract all text from this document image."},
{
"type": "image_url",
"image_url": {
"url": f"data:image/png;base64,{base64_image}"
},
},
],
}
],
)
print(response.choices[0].message.content)