> ## Documentation Index
> Fetch the complete documentation index at: https://docs.obiguard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Vision

> Obiguard’s AI gateway enables integration with leading vision models such as OpenAI’s GPT-4V, Google’s Gemini, and others.

<Note>
  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.
</Note>

## Using Vision Chat Completion

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:

<Tabs>
  <Tab title="Python SDK">
    ```
    from obiguard import Obiguard

    client = 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)
    ```
  </Tab>

  <Tab title="OpenAI Python">
    ```
    from openai import OpenAI
    from obiguard import createHeaders

    client = 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)
    ```
  </Tab>

  <Tab title="cURL">
    ```
    curl https://gateway.obiguard.ai/v1/chat/completions \
    -H "Content-Type: application/json" \
    -H "x-obiguard-virtual-key: $OPENAI_VIRTUAL_KEY" \
    -d '{
      "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"
            }
          }
        ]
      }]
    }'
    ```
  </Tab>
</Tabs>

## Supported Providers and Models

Obiguard integrates with a wide range of vision models from leading providers.
The table below lists some of the supported models.

| Provider     | Models                                                                                             | Functions              |
| ------------ | -------------------------------------------------------------------------------------------------- | ---------------------- |
| OpenAI       | gpt-4-vision-preview, gpt-4o, gpt-4o-mini                                                          | Create Chat Completion |
| Azure OpenAI | gpt-4-vision-preview, gpt-4o, gpt-4o-mini                                                          | Create Chat Completion |
| Gemini       | gemini-1.0-pro-vision, gemini-1.5-flash, gemini-1.5-flash-8b, gemini-1.5-pro                       | Create Chat Completion |
| Anthropic    | claude-3-sonnet, claude-3-haiku, claude-3-opus, claude-3.5-sonnet, claude-3.5-haiku                | Create Chat Completion |
| AWS Bedrock  | anthropic.claude-3-5-sonnet, anthropic.claude-3-5-haiku, anthropic.claude-3-5-sonnet-20240620-v1:0 | Create Chat Completion |
