Obiguard’s AI gateway enables integration with leading vision models such as OpenAI’s GPT-4V, Google’s Gemini, and others.
What are vision models?
Vision models are AI systems that integrate visual and language understanding, enabling them to interpret images
alongside natural language text. They are trained on extensive datasets containing both images and text, with training
methods varying based on their specific objectives.
Obiguard implements the OpenAI message format, allowing you to include images in API requests.
You can provide images to the model either by supplying a URL or by embedding the image as a base64-encoded string.
Below is an example with OpenAI’s gpt-4o model:
Copy
from obiguard import Obiguardclient = Obiguard( obiguard_api_key='vk-obg***', # Your Obiguard virtual key here)response = client.chat.completions.create( model="gpt-4o", messages=[{ "role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", }, }, ], }],)print(response)
Copy
from obiguard import Obiguardclient = Obiguard( obiguard_api_key='vk-obg***', # Your Obiguard virtual key here)response = client.chat.completions.create( model="gpt-4o", messages=[{ "role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", }, }, ], }],)print(response)
Copy
from openai import OpenAIfrom obiguard import createHeadersclient = OpenAI( api_key='sk-***', # Your OpenAI API key here default_headers=createHeaders( provider="openai", api_key="vk-obg***", # Your Obiguard virtual key here ))response = client.chat.completions.create( model="gpt-4o", messages=[{ "role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", }, }, ], }],)print(response)