Migration of Image embedding model (Embed-v4) after the deprecation of Azure Inference SDK

Do, Nam 20 Reputation points
2026-06-01T08:51:22.4866667+00:00

Hi, I'm using Cohere Embed-v4 deploying on Azure foundry to embed images. Currently using Azure inference SDK to do so.

However, it would be deprecated in August, and the advice is to migrate to OpenAI inference SDK. But seems like the inference SDK from OpenAI doesn't support image embedding and cannot be used with Cohere models like Embed-v4.

So, is there another way I can still use resources on Azure to do image embedding, or I have to use a 3rd party subcription to do it?

Foundry Models
Foundry Models

A catalog of AI models in Microsoft Foundry that you can discover, compare, and deploy using Azure’s built‑in tools for evaluation, fine‑tuning, and inference


Answer accepted by question author
Jerald Felix 18,760 Reputation points Volunteer Moderator
2026-06-03T06:57:32.7733333+00:00

Hello Do, Nam,

Greetings! Thanks for raising this question in Q&A forum.

You are right to be concerned this is a genuine gap in the migration guidance. The Azure AI Inference beta SDK is deprecated and will be retired on August 26, 2026, and the advice is to switch to the OpenAI/v1 API with a stable OpenAI SDK. However, you are also correct that the OpenAI SDK does not support image embedding natively, and it does not speak Cohere's native embed format. So you are not missing anything — this is a real limitation of the recommended migration path for image-specific embedding use cases.

The good news is that you do not need a third-party subscription. Here are the alternatives that keep you fully within Azure:

Option 1: Use the Cohere Python SDK Directly (Best Option)

You can use the Cohere SDK client to consume Cohere models that are deployed via Azure AI Foundry, leveraging the SDK's features including embeddings. The Cohere SDK works with your Azure-deployed Embed v4 endpoint and fully supports image embedding. Install it and point it to your Azure endpoint like this:

import cohere

co = cohere.Client(
    api_key="<your-azure-api-key>",
    base_url="https://<your-endpoint>.inference.ai.azure.com"
)

# Image embedding using Cohere SDK
response = co.embed(
    model="embed-v-4-0",
    images=["<base64-encoded-image-or-url>"],
    input_type="image",
    embedding_types=["float"]
)

print(response.embeddings)

This avoids the deprecated Azure AI Inference SDK entirely and is fully supported.

Option 2: Use the REST API Directly via v1/embed Route

Cohere exposes two routes for Embed v4 inference on Azure: v1/embeddings which adheres to the Azure AI Generative Messages API schema, and v1/embed which supports Cohere's native API schema. For image embedding, use the /v1/embed route directly with a simple HTTP call:

import requests, base64

with open("your_image.jpg", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode("utf-8")

response = requests.post(
    "https://<your-endpoint>.inference.ai.azure.com/v1/embed",
    headers={
        "Authorization": "<your-azure-api-key>",
        "Content-Type": "application/json"
    },
    json={
        "model": "embed-v-4-0",
        "images": [image_b64],
        "input_type": "image",
        "embedding_types": ["float"]
    }
)
print(response.json())

This approach bypasses both the deprecated Azure SDK and the OpenAI SDK limitation entirely.

Option 3: Keep Watching the Azure AI Inference SDK Migration Guide

Microsoft is aware that image embedding via Cohere is a use case that does not map cleanly onto the OpenAI SDK. Check the official migration guide at https://learn.microsoft.com/en-us/azure/ai-foundry periodically, as updated guidance specific to multimodal Cohere models may be published before the August 2026 deadline.

In summary you do not need a third-party subscription at all. Switch to the Cohere Python SDK pointed at your Azure endpoint (Option 1), which is the cleanest long-term solution and fully replaces the deprecated Azure AI Inference SDK for image embedding with Embed v4.

If this answer helps you kindly accept the answer which will help others who have similar questions.

Best Regards,

Jerald Felix.

Was this answer helpful?

2 people found this answer helpful.

2 additional answers

Sort by: Oldest
  1. Do, Nam 20 Reputation points
    2026-06-04T04:44:20.9133333+00:00

    Hi @Jerald Felix

    Thanks for the response. I gave this a check, the first option doesn't work as it raises the error: "An expected StartArray node was found when reading from JSON reader. A 'PrimitiveValue' node was expected."

    I assume this is a conflict in the payload of cohere SDK and azure endpoint.

    The second options works with route /images/embeddings but since the SDK is removed, would Microsoft removes the route for this as well?

    Was this answer helpful?

    0 comments No comments

  2. Anshika Varshney 15,625 Reputation points Microsoft External Staff Moderator
    2026-06-11T21:50:28.1533333+00:00

    Hi @Do, Nam ,

    You’re absolutely right that the Azure Inference SDK changes can be a bit confusing, especially for image embedding scenarios like Cohere Embed‑v4.

    To clarify, the older OpenAI-style SDKs mainly focus on text-based scenarios and don’t fully support image embeddings. However, you can still continue using Embed‑v4 fully within Azure without needing any external services.

    Here are the supported approaches:

    1. Use Azure AI Foundry + new Azure AI Inference APIs

    The recommended path is to continue using your existing Embed‑v4 deployment in Azure AI Foundry and switch to the newer Azure AI Inference SDK or REST API.

    • These newer clients fully support image embeddings
    • You just need to:
      • Point to your Foundry endpoint
      • Use your deployment name
      • Call the image embedding API

    For example (Python):

    from azure.ai.inference import ModelClient
    from azure.identity import DefaultAzureCredential
    
    client = ModelClient(
        endpoint="https://<your-endpoint>.cognitiveservices.azure.com",
        credential=DefaultAzureCredential()
    )
    
    with open("image.jpg", "rb") as f:
        image_bytes = f.read()
    
    result = client.begin_image_embeddings(
        deployment_id="your-embed-v4-deployment",
        image=image_bytes
    ).result()
    
    print(result.embeddings)
    

    The same approach works with REST, C#, or JavaScript.

    1. Optional: Container-based deployment

    If you need more control, you can deploy the model as a container (Azure ML / ACI) and call it via endpoint. This uses the same inference pattern but gives you more flexibility in hosting.

    You do not need to move away from Azure. The only change required is to move from the older Azure Inference/OpenAI SDK to the new Azure AI Inference SDK or REST API, which supports image embeddings.

    I Hope this helps. Do let me know if you have any further queries.

    Thankyou!

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.