> ## Documentation Index
> Fetch the complete documentation index at: https://portkey-docs-feat-rerank-documentation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Embeddings

> Get embeddings from Vertex AI

Vertex AI offers wide ranging support for embedding text, images and videos.
Portkey provides a standardized interface for embedding multiple modalities.

***

## Gemini Embedding Models

The `gemini-embedding-2-preview` model supports embedding across multiple modalities — **text**, **image**, **video**, and **audio** — through a single unified endpoint.

| Input Type | Supported Formats                    |
| ---------- | ------------------------------------ |
| Text       | Plain string or structured object    |
| Image      | GCS URI, HTTPS URL, base64, data URI |
| Video      | GCS URI, HTTPS URL, base64           |
| Audio      | GCS URI, HTTPS URL, base64           |

Additional supported parameters: `task_type`, `dimensions`

### Embedding Text

<CodeGroup>
  ```python Python theme={"system"}
  from portkey_ai import Portkey

  client = Portkey(
      api_key="YOUR_PORTKEY_API_KEY",
      provider="@PROVIDER",
      vertex_region="us-central1",
  )

  embeddings = client.embeddings.create(
      model="gemini-embedding-2-preview",
      input="What is the meaning of life?",
  )
  ```

  ```javascript NodeJS theme={"system"}
  import { Portkey } from 'portkey-ai';

  const portkey = new Portkey({
      apiKey: "YOUR_API_KEY",
      provider: "@YOUR_PROVIDER",
      vertexRegion: "us-central1",
  });

  const embedding = await portkey.embeddings.create({
      input: "What is the meaning of life?",
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```

  ```sh cURL theme={"system"}
  curl --location 'https://api.portkey.ai/v1/embeddings' \
  --header 'Content-Type: application/json' \
  --header 'x-portkey-api-key: PORTKEY_API_KEY' \
  --header 'x-portkey-provider: @PORTKEY_PROVIDER' \
  --header 'x-portkey-vertex-region: us-central1' \
  --data '{
      "model": "gemini-embedding-2-preview",
      "input": "What is the meaning of life?"
  }'
  ```

  ```python OpenAI Python theme={"system"}
  from openai import OpenAI
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders

  portkey_client = OpenAI(
      api_key="NOT_REQUIRED",
      base_url=PORTKEY_GATEWAY_URL,
      default_headers=createHeaders(
          provider="@PORTKEY_PROVIDER",
          api_key="PORTKEY_API_KEY",
          vertex_region="us-central1",
      )
  )

  embeddings = portkey_client.embeddings.create(
      model="gemini-embedding-2-preview",
      input="What is the meaning of life?",
  )
  ```

  ```js OpenAI NodeJS theme={"system"}
  import OpenAI from 'openai';
  import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

  const portkeyClient = new OpenAI({
    apiKey: "NOT_REQUIRED",
    baseURL: PORTKEY_GATEWAY_URL,
    defaultHeaders: createHeaders({
      apiKey: "PORTKEY_API_KEY",
      provider: "@PORTKEY_PROVIDER",
      vertexRegion: "us-central1",
    })
  });

  const embedding = await portkeyClient.embeddings.create({
      input: "What is the meaning of life?",
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```
</CodeGroup>

### Embedding Images

<CodeGroup>
  ```python Python theme={"system"}
  from portkey_ai import Portkey

  client = Portkey(
      api_key="YOUR_PORTKEY_API_KEY",
      provider="@PROVIDER",
      vertex_region="us-central1",
  )

  embeddings = client.embeddings.create(
      model="gemini-embedding-2-preview",
      input=[
          {
              "image": {
                  "url": "gs://your-bucket/image.png",
                  "mime_type": "image/png"
              }
          }
      ],
  )
  ```

  ```javascript NodeJS theme={"system"}
  import { Portkey } from 'portkey-ai';

  const portkey = new Portkey({
      apiKey: "YOUR_API_KEY",
      provider: "@YOUR_PROVIDER",
      vertexRegion: "us-central1",
  });

  const embedding = await portkey.embeddings.create({
      input: [
          {
              image: {
                  url: "gs://your-bucket/image.png",
                  mime_type: "image/png"
              }
          }
      ],
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```

  ```sh cURL theme={"system"}
  curl --location 'https://api.portkey.ai/v1/embeddings' \
  --header 'Content-Type: application/json' \
  --header 'x-portkey-api-key: PORTKEY_API_KEY' \
  --header 'x-portkey-provider: @PORTKEY_PROVIDER' \
  --header 'x-portkey-vertex-region: us-central1' \
  --data '{
      "model": "gemini-embedding-2-preview",
      "input": [
          {
              "image": {
                  "url": "gs://your-bucket/image.png",
                  "mime_type": "image/png"
              }
          }
      ]
  }'
  ```

  ```python OpenAI Python theme={"system"}
  from openai import OpenAI
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders

  portkey_client = OpenAI(
      api_key="NOT_REQUIRED",
      base_url=PORTKEY_GATEWAY_URL,
      default_headers=createHeaders(
          provider="@PORTKEY_PROVIDER",
          api_key="PORTKEY_API_KEY",
          vertex_region="us-central1",
      )
  )

  embeddings = portkey_client.embeddings.create(
      model="gemini-embedding-2-preview",
      input=[
          {
              "image": {
                  "url": "gs://your-bucket/image.png",
                  "mime_type": "image/png"
              }
          }
      ],
  )
  ```

  ```js OpenAI NodeJS theme={"system"}
  import OpenAI from 'openai';
  import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

  const portkeyClient = new OpenAI({
    apiKey: "NOT_REQUIRED",
    baseURL: PORTKEY_GATEWAY_URL,
    defaultHeaders: createHeaders({
      apiKey: "PORTKEY_API_KEY",
      provider: "@PORTKEY_PROVIDER",
      vertexRegion: "us-central1",
    })
  });

  const embedding = await portkeyClient.embeddings.create({
      input: [
          {
              image: {
                  url: "gs://your-bucket/image.png",
                  mime_type: "image/png"
              }
          }
      ],
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```
</CodeGroup>

You can also pass images as base64:

```json theme={"system"}
{
    "input": [
        {
            "image": {
                "base64": "iVBORw0KGgoAAAANSUhEUgAA...",
                "mime_type": "image/png"
            }
        }
    ]
}
```

Or as a data URI:

```json theme={"system"}
{
    "input": [
        {
            "image": {
                "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
            }
        }
    ]
}
```

### Embedding Videos

<CodeGroup>
  ```python Python theme={"system"}
  from portkey_ai import Portkey

  client = Portkey(
      api_key="YOUR_PORTKEY_API_KEY",
      provider="@PROVIDER",
      vertex_region="us-central1",
  )

  embeddings = client.embeddings.create(
      model="gemini-embedding-2-preview",
      input=[
          {
              "video": {
                  "url": "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  "mime_type": "video/mp4"
              }
          }
      ],
  )
  ```

  ```javascript NodeJS theme={"system"}
  import { Portkey } from 'portkey-ai';

  const portkey = new Portkey({
      apiKey: "YOUR_API_KEY",
      provider: "@YOUR_PROVIDER",
      vertexRegion: "us-central1",
  });

  const embedding = await portkey.embeddings.create({
      input: [
          {
              video: {
                  url: "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  mime_type: "video/mp4"
              }
          }
      ],
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```

  ```sh cURL theme={"system"}
  curl --location 'https://api.portkey.ai/v1/embeddings' \
  --header 'Content-Type: application/json' \
  --header 'x-portkey-api-key: PORTKEY_API_KEY' \
  --header 'x-portkey-provider: @PORTKEY_PROVIDER' \
  --header 'x-portkey-vertex-region: us-central1' \
  --data '{
      "model": "gemini-embedding-2-preview",
      "input": [
          {
              "video": {
                  "url": "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  "mime_type": "video/mp4"
              }
          }
      ]
  }'
  ```

  ```python OpenAI Python theme={"system"}
  from openai import OpenAI
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders

  portkey_client = OpenAI(
      api_key="NOT_REQUIRED",
      base_url=PORTKEY_GATEWAY_URL,
      default_headers=createHeaders(
          provider="@PORTKEY_PROVIDER",
          api_key="PORTKEY_API_KEY",
          vertex_region="us-central1",
      )
  )

  embeddings = portkey_client.embeddings.create(
      model="gemini-embedding-2-preview",
      input=[
          {
              "video": {
                  "url": "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  "mime_type": "video/mp4"
              }
          }
      ],
  )
  ```

  ```js OpenAI NodeJS theme={"system"}
  import OpenAI from 'openai';
  import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

  const portkeyClient = new OpenAI({
    apiKey: "NOT_REQUIRED",
    baseURL: PORTKEY_GATEWAY_URL,
    defaultHeaders: createHeaders({
      apiKey: "PORTKEY_API_KEY",
      provider: "@PORTKEY_PROVIDER",
      vertexRegion: "us-central1",
    })
  });

  const embedding = await portkeyClient.embeddings.create({
      input: [
          {
              video: {
                  url: "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  mime_type: "video/mp4"
              }
          }
      ],
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```
</CodeGroup>

### Embedding Audio

<CodeGroup>
  ```python Python theme={"system"}
  from portkey_ai import Portkey

  client = Portkey(
      api_key="YOUR_PORTKEY_API_KEY",
      provider="@PROVIDER",
      vertex_region="us-central1",
  )

  embeddings = client.embeddings.create(
      model="gemini-embedding-2-preview",
      input=[
          {
              "audio": {
                  "url": "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  "mime_type": "audio/mpeg"
              }
          }
      ],
  )
  ```

  ```javascript NodeJS theme={"system"}
  import { Portkey } from 'portkey-ai';

  const portkey = new Portkey({
      apiKey: "YOUR_API_KEY",
      provider: "@YOUR_PROVIDER",
      vertexRegion: "us-central1",
  });

  const embedding = await portkey.embeddings.create({
      input: [
          {
              audio: {
                  url: "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  mime_type: "audio/mpeg"
              }
          }
      ],
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```

  ```sh cURL theme={"system"}
  curl --location 'https://api.portkey.ai/v1/embeddings' \
  --header 'Content-Type: application/json' \
  --header 'x-portkey-api-key: PORTKEY_API_KEY' \
  --header 'x-portkey-provider: @PORTKEY_PROVIDER' \
  --header 'x-portkey-vertex-region: us-central1' \
  --data '{
      "model": "gemini-embedding-2-preview",
      "input": [
          {
              "audio": {
                  "url": "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  "mime_type": "audio/mpeg"
              }
          }
      ]
  }'
  ```

  ```python OpenAI Python theme={"system"}
  from openai import OpenAI
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders

  portkey_client = OpenAI(
      api_key="NOT_REQUIRED",
      base_url=PORTKEY_GATEWAY_URL,
      default_headers=createHeaders(
          provider="@PORTKEY_PROVIDER",
          api_key="PORTKEY_API_KEY",
          vertex_region="us-central1",
      )
  )

  embeddings = portkey_client.embeddings.create(
      model="gemini-embedding-2-preview",
      input=[
          {
              "audio": {
                  "url": "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  "mime_type": "audio/mpeg"
              }
          }
      ],
  )
  ```

  ```js OpenAI NodeJS theme={"system"}
  import OpenAI from 'openai';
  import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

  const portkeyClient = new OpenAI({
    apiKey: "NOT_REQUIRED",
    baseURL: PORTKEY_GATEWAY_URL,
    defaultHeaders: createHeaders({
      apiKey: "PORTKEY_API_KEY",
      provider: "@PORTKEY_PROVIDER",
      vertexRegion: "us-central1",
    })
  });

  const embedding = await portkeyClient.embeddings.create({
      input: [
          {
              audio: {
                  url: "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  mime_type: "audio/mpeg"
              }
          }
      ],
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```
</CodeGroup>

### Multimodal Embedding (Mixed Inputs)

You can combine multiple input types in a single request:

<CodeGroup>
  ```python Python theme={"system"}
  from portkey_ai import Portkey

  client = Portkey(
      api_key="YOUR_PORTKEY_API_KEY",
      provider="@PROVIDER",
      vertex_region="us-central1",
  )

  embeddings = client.embeddings.create(
      model="gemini-embedding-2-preview",
      input=[
          {
              "video": {
                  "url": "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  "mime_type": "video/mp4"
              }
          },
          {
              "audio": {
                  "url": "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  "mime_type": "audio/mpeg"
              }
          }
      ],
  )
  ```

  ```javascript NodeJS theme={"system"}
  import { Portkey } from 'portkey-ai';

  const portkey = new Portkey({
      apiKey: "YOUR_API_KEY",
      provider: "@YOUR_PROVIDER",
      vertexRegion: "us-central1",
  });

  const embedding = await portkey.embeddings.create({
      input: [
          {
              video: {
                  url: "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  mime_type: "video/mp4"
              }
          },
          {
              audio: {
                  url: "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  mime_type: "audio/mpeg"
              }
          }
      ],
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```

  ```sh cURL theme={"system"}
  curl --location 'https://api.portkey.ai/v1/embeddings' \
  --header 'Content-Type: application/json' \
  --header 'x-portkey-api-key: PORTKEY_API_KEY' \
  --header 'x-portkey-provider: @PORTKEY_PROVIDER' \
  --header 'x-portkey-vertex-region: us-central1' \
  --data '{
      "model": "gemini-embedding-2-preview",
      "input": [
          {
              "video": {
                  "url": "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  "mime_type": "video/mp4"
              }
          },
          {
              "audio": {
                  "url": "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  "mime_type": "audio/mpeg"
              }
          }
      ]
  }'
  ```

  ```python OpenAI Python theme={"system"}
  from openai import OpenAI
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders

  portkey_client = OpenAI(
      api_key="NOT_REQUIRED",
      base_url=PORTKEY_GATEWAY_URL,
      default_headers=createHeaders(
          provider="@PORTKEY_PROVIDER",
          api_key="PORTKEY_API_KEY",
          vertex_region="us-central1",
      )
  )

  embeddings = portkey_client.embeddings.create(
      model="gemini-embedding-2-preview",
      input=[
          {
              "video": {
                  "url": "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  "mime_type": "video/mp4"
              }
          },
          {
              "audio": {
                  "url": "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  "mime_type": "audio/mpeg"
              }
          }
      ],
  )
  ```

  ```js OpenAI NodeJS theme={"system"}
  import OpenAI from 'openai';
  import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

  const portkeyClient = new OpenAI({
    apiKey: "NOT_REQUIRED",
    baseURL: PORTKEY_GATEWAY_URL,
    defaultHeaders: createHeaders({
      apiKey: "PORTKEY_API_KEY",
      provider: "@PORTKEY_PROVIDER",
      vertexRegion: "us-central1",
    })
  });

  const embedding = await portkeyClient.embeddings.create({
      input: [
          {
              video: {
                  url: "gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
                  mime_type: "video/mp4"
              }
          },
          {
              audio: {
                  url: "gs://cloud-samples-data/generative-ai/audio/Chirp-3-Docs-Dive.mp3",
                  mime_type: "audio/mpeg"
              }
          }
      ],
      model: "gemini-embedding-2-preview",
  });

  console.log(embedding);
  ```
</CodeGroup>

### Setting Task Type and Dimensions

You can optionally specify `task_type` and `dimensions` to control the embedding behavior:

```json theme={"system"}
{
    "model": "gemini-embedding-2-preview",
    "input": "What is the meaning of life?",
    "task_type": "RETRIEVAL_DOCUMENT",
    "dimensions": 768
}
```

***

## Legacy Embedding Models

The following sections cover the older Vertex AI embedding models like `textembedding-gecko@003` and `multimodalembedding@001`.

## Embedding Text

<CodeGroup>
  ```python Python theme={"system"}
  from portkey_ai import Portkey

  client = Portkey(
      api_key="YOUR_PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
      provider="@PROVIDER",
  )

  embeddings = client.embeddings.create(
    model="textembedding-gecko@003",
    input_type="classification",
    input="The food was delicious and the waiter...",
    # input=["text to embed", "more text to embed"], # if you would like to embed multiple texts
  )
  ```

  ```javascript NodeJS theme={"system"}
  import { Portkey } from 'portkey-ai';

  const portkey = new Portkey({
      apiKey: "YOUR_API_KEY",
      provider:"@YOUR_PROVIDER"
  });

  const embedding = await portkey.embeddings.create({
      input: 'Name the tallest buildings in Hawaii',
      // input: ['text to embed', 'more text to embed'], // if you would like to embed multiple texts
      model: 'textembedding-gecko@003'
  });

  console.log(embedding);
  ```

  ```sh cURL theme={"system"}
  curl --location 'https://api.portkey.ai/v1/embeddings' \
  --header 'Content-Type: application/json' \
  --header 'x-portkey-api-key: PORTKEY_API_KEY' \
  --header 'x-portkey-provider: PORTKEY_PROVIDER' \
  --data-raw '{
      "model": "textembedding-gecko@003",
      "input": [
          "A HTTP 246 code is used to signify an AI response containing hallucinations or other inaccuracies",
          "246: Partially incorrect response"
      ],
      # "input": "Name the tallest buildings in Hawaii",
      "input_type": "classification"
  }'
  ```

  ```python OpenAI Python theme={"system"}
  from openai import OpenAI
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders

  portkey_client = OpenAI(
      api_key='NOT_REQUIRED',
      base_url=PORTKEY_GATEWAY_URL,
      default_headers=createHeaders(
          provider="openai",
          api_key="PORTKEY_API_KEY"
      )
  )

  embeddings = portkey_client.embeddings.create(
    model="textembedding-gecko@003",
    input_type="classification",
    input="The food was delicious and the waiter...",
    # input=["text to embed", "more text to embed"], # if you would like to embed multiple texts
  )
  ```

  ```js OpenAI NodeJS theme={"system"}
  import OpenAI from 'openai'; // We're using the v4 SDK
  import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

  const portkeyClient = new OpenAI({
    apiKey: 'NOT_REQUIRED', // defaults to process.env["OPENAI_API_KEY"],
    baseURL: PORTKEY_GATEWAY_URL,
    defaultHeaders: createHeaders({
      provider: "vertex-ai",
      apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
      provider:"@PORTKEY_PROVIDER"
    })
  });

  const embedding = await portkeyClient.embeddings.create({
      input: 'Name the tallest buildings in Hawaii',
      // input: ['text to embed', 'more text to embed'], // if you would like to embed multiple texts
      model: 'textembedding-gecko@003'
  });

  console.log(embedding);
  ```
</CodeGroup>

## Embeddings Images

<CodeGroup>
  ```python Python theme={"system"}
  from portkey_ai import Portkey

  client = Portkey(
      api_key="YOUR_PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
      provider="@PROVIDER",
  )

  embeddings = client.embeddings.create(
    model="multimodalembedding@001",
    input=[
            {
                "text": "this is the caption of the image",
                "image": {
                    "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                    # "url": "gcs://..." # if you want to use a url
                }
            }
        ]
  )
  ```

  ```javascript NodeJS theme={"system"}
  import { Portkey } from 'portkey-ai';

  const portkey = new Portkey({
      apiKey: "YOUR_API_KEY",
      provider:"@YOUR_PROVIDER"
  });

  const embedding = await portkey.embeddings.create({
      input: [
            {
                "text": "this is the caption of the image",
                "image": {
                    "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                    // "url": "gcs://..." // if you want to use a url
                }
            }
        ],
      model: 'multimodalembedding@001'
  });

  console.log(embedding);
  ```

  ```sh cURL theme={"system"}
  curl --location 'https://api.portkey.ai/v1/embeddings' \
  --header 'Content-Type: application/json' \
  --header 'x-portkey-api-key: PORTKEY_API_KEY' \
  --header 'x-portkey-provider: PORTKEY_PROVIDER' \
  --data-raw '{
      "model": "multimodalembedding@001",
      "input": [
                    {
                        "text": "this is the caption of the image",
                        "image": {
                            "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B....."
                            # "url": "gcs://..." # if you want to use a url
                        }
                    }
                ]
  }'
  ```

  ```python OpenAI Python theme={"system"}
  from openai import OpenAI
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders

  portkey_client = OpenAI(
      api_key='NOT_REQUIRED',
      base_url=PORTKEY_GATEWAY_URL,
      default_headers=createHeaders(
          provider="openai",
          api_key="PORTKEY_API_KEY"
      )
  )

  embeddings = portkey_client.embeddings.create(
    model="multimodalembedding@001",
    input=[
            {
                "text": "this is the caption of the image",
                "image": {
                    "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                    # "url": "gcs://..." # if you want to use a url
                }
            }
          ]
  )
  ```

  ```js OpenAI NodeJS theme={"system"}
  import OpenAI from 'openai'; // We're using the v4 SDK
  import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

  const portkeyClient = new OpenAI({
    apiKey: 'NOT_REQUIRED', // defaults to process.env["OPENAI_API_KEY"],
    baseURL: PORTKEY_GATEWAY_URL,
    defaultHeaders: createHeaders({
      apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
      provider:"@PORTKEY_PROVIDER"
    })
  });

  const embedding = await portkeyClient.embeddings.create({
      input: [
                {
                    "text": "this is the caption of the image",
                    "image": {
                        "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                        // "url": "gcs://..." // if you want to use a url
                    }
                }
              ],
      model: 'multimodalembedding@001'
  });

  console.log(embedding);
  ```
</CodeGroup>

## Embeddings Videos

<CodeGroup>
  ```python Python theme={"system"}
  from portkey_ai import Portkey

  client = Portkey(
      api_key="YOUR_PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
      provider="@PROVIDER",
  )

  embeddings = client.embeddings.create(
    model="multimodalembedding@001",
    input=[
            {
                "text": "this is the caption of the video",
                "video": {
                    "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                    "start_offset": 0,
                    "end_offset": 10,
                    "interval": 5,
                    # "url": "gcs://..." # if you want to use a url
                }
            }
        ]
  )
  ```

  ```javascript NodeJS theme={"system"}
  import { Portkey } from 'portkey-ai';

  const portkey = new Portkey({
      apiKey: "YOUR_API_KEY",
      provider:"@YOUR_PROVIDER"
  });

  const embedding = await portkey.embeddings.create({
      input: [
            {
                "text": "this is the caption of the video",
                "video": {
                    "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                    "start_offset": 0,
                    "end_offset": 10,
                    "interval": 5,
                    // "url": "gcs://..." // if you want to use a url
                }
            }
        ],
      model: 'multimodalembedding@001'
  });

  console.log(embedding);
  ```

  ```sh cURL theme={"system"}
  curl --location 'https://api.portkey.ai/v1/embeddings' \
  --header 'Content-Type: application/json' \
  --header 'x-portkey-api-key: PORTKEY_API_KEY' \
  --header 'x-portkey-provider: PORTKEY_PROVIDER' \
  --data-raw '{
      "model": "multimodalembedding@001",
      "input": [
                    {
                        "text": "this is the caption of the video",
                        "video": {
                            "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                            "start_offset": 0,
                            "end_offset": 10,
                            "interval": 5
                            # "url": "gcs://..." # if you want to use a url
                        }
                    }
                ]
  }'
  ```

  ```python OpenAI Python theme={"system"}
  from openai import OpenAI
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders

  portkey_client = OpenAI(
      api_key='NOT_REQUIRED',
      base_url=PORTKEY_GATEWAY_URL,
      default_headers=createHeaders(
          provider="openai",
          api_key="PORTKEY_API_KEY"
      )
  )

  embeddings = portkey_client.embeddings.create(
    model="multimodalembedding@001",
    input=[
            {
                "text": "this is the caption of the video",
                "video": {
                    "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                    "start_offset": 0,
                    "end_offset": 10,
                    "interval": 5,
                    # "url": "gcs://..." # if you want to use a url
                }
            }
          ]
  )
  ```

  ```js OpenAI NodeJS theme={"system"}
  import OpenAI from 'openai'; // We're using the v4 SDK
  import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

  const portkeyClient = new OpenAI({
    apiKey: 'NOT_REQUIRED', // defaults to process.env["OPENAI_API_KEY"],
    baseURL: PORTKEY_GATEWAY_URL,
    defaultHeaders: createHeaders({
      apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
      provider:"@PORTKEY_PROVIDER"
    })
  });

  const embedding = await portkeyClient.embeddings.create({
      input: [
                {
                    "text": "this is the caption of the video",
                    "video": {
                        "base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
                        "start_offset": 0,
                        "end_offset": 10,
                        "interval": 5,
                        // "url": "gcs://..." // if you want to use a url
                    }
                }
              ],
      model: 'multimodalembedding@001'
  });

  console.log(embedding);
  ```
</CodeGroup>
