Skip to content

New: DeepSeek V4.1 Flash Derisked. In chat and on the API.

See modelsWhat's newReport a bug
Open chat
All IDE and SDK guides

Microsoft Foundry

Use the Vani API with Microsoft Foundry and Azure OpenAI-compatible clients

Connect Vani to Foundry Agent Service, or point Azure-style code at Vani with the standard OpenAI client.

Base URL
https://api.vani.ai/v1
Auth header
Authorization: Bearer {api_key} (not api-key)
API
Chat Completions
Example model
openai/gpt-6-sol

Checked against the vendor's documentation on 2 October 2026. Need a key? Create one in the API console.

On this pageBefore you start

Before you start

  • Foundry: a Foundry project and the Foundry User role (or higher). Bring-your-own-model works with prompt agents in the Agent SDK.
  • Azure clients: use the standard OpenAI client with a base URL. The AzureOpenAI / AzureOpenAIClient classes send an api-key header and /openai/deployments/…?api-version= paths, which Vani does not support.
  • Prefer Chat Completions clients: Vani's Responses API is stateless.

Foundry Agent Service

  1. In Microsoft Foundry go to Manage › Resource details › Admin-connected models › Add.
  2. Connection type: Other source. Connection name: vani. Base URL: https://api.vani.ai/v1 (Foundry appends chat/completions).
  3. Authentication: API key. Set the header name to Authorization and the value to Bearer {api_key} (or x-api-key with {api_key}). Do not keep the default api-key header.
  4. Model configuration: add openai/gpt-6-sol as the model name (it is sent as model), with a display name and an empty version. Repeat for openai/gpt-6-sol-fast and deepseek/deepseek-v4.1-flash.
  5. Advanced: leave the API version empty and keep Include deployment name in URL path off. Click Add.
  6. Use the model from a prompt agent as <connection-name>/<model-name>, for example vani/openai/gpt-6-sol.
Text

Add model connection

Connection type      : Other source
Connection name      : vani
Base URL             : https://api.vani.ai/v1
Authentication       : API key
API key              : vani_YOUR_API_KEY
API key header name  : Authorization
API key header value : Bearer {api_key}
Model name           : openai/gpt-6-sol
Version              : (empty)
Deployment in path   : off

Note

Vani's model ids contain a slash. Foundry's documentation does not say how it treats a slash inside <connection-name>/<model-name>; if the agent cannot find the model, report it to Vani support with the connection name.

Azure OpenAI-compatible code

Azure OpenAI's v1 API uses the standard OpenAI client with a base URL. The same pattern reaches Vani: change the base URL and key, and use Vani model ids instead of deployment names.

Python

Python (openai)

import os
from openai import OpenAI  # not AzureOpenAI

client = OpenAI(base_url="https://api.vani.ai/v1", api_key=os.environ["VANI_API_KEY"])
resp = client.chat.completions.create(
    model="openai/gpt-6-sol",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
C#

.NET (Microsoft.Extensions.AI)

using System.ClientModel;
using Microsoft.Extensions.AI;
using OpenAI;

IChatClient client = new OpenAIClient(
        new ApiKeyCredential(Environment.GetEnvironmentVariable("VANI_API_KEY")!),
        new OpenAIClientOptions { Endpoint = new Uri("https://api.vani.ai/v1") })
    .GetChatClient("openai/gpt-6-sol")
    .AsIChatClient();

Console.WriteLine(await client.GetResponseAsync("Hello from Vani"));
C#

Semantic Kernel (.NET)

#pragma warning disable SKEXP0010 // custom endpoints are experimental
var builder = Kernel.CreateBuilder();
builder.AddOpenAIChatCompletion(
    modelId: "openai/gpt-6-sol",
    apiKey: Environment.GetEnvironmentVariable("VANI_API_KEY")!,
    endpoint: new Uri("https://api.vani.ai/v1"));
var kernel = builder.Build();
Python

Microsoft Agent Framework (Python)

import asyncio, os
from agent_framework import Agent
from agent_framework.openai import OpenAIChatCompletionClient

async def main():
    agent = Agent(
        client=OpenAIChatCompletionClient(
            base_url="https://api.vani.ai/v1",
            api_key=os.environ["VANI_API_KEY"],
            model="openai/gpt-6-sol-fast",
        ),
        name="VaniAgent",
        instructions="You are a helpful assistant.",
    )
    print(await agent.run("Hello!"))

asyncio.run(main())
Python

AutoGen (maintenance mode)

import os
from autogen_ext.models.openai import OpenAIChatCompletionClient

client = OpenAIChatCompletionClient(
    model="deepseek/deepseek-v4.1-flash",
    base_url="https://api.vani.ai/v1",
    api_key=os.environ["VANI_API_KEY"],
    model_info={"vision": False, "function_calling": True, "json_output": False,
                "family": "unknown", "structured_output": False},
)

Troubleshooting

Foundry: 401 from Vani
Set the API key header name to Authorization with value Bearer {api_key} (or x-api-key with {api_key}). The default api-key header is not accepted.
Foundry: 404 from Vani
The base URL must end in /v1 (https://api.vani.ai/v1). Turn off Include deployment name in URL path and leave the API version empty.
Foundry: the agent reports model not found
Reference the model as <connection-name>/<model-name> and make the connection's model name exactly the Vani id, with an empty version.
Reused Azure OpenAI code returns 401 or 404
Replace AzureOpenAI / AzureOpenAIClient with the standard OpenAI client and a base URL, and use Vani model ids instead of deployment names.
AutoGen asks for model_info
Pass model_info for Vani ids; AutoGen only knows OpenAI's own model names.

Still stuck? Check service status or the API error reference.

Sources