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/AzureOpenAIClientclasses send anapi-keyheader and/openai/deployments/…?api-version=paths, which Vani does not support. - Prefer Chat Completions clients: Vani's Responses API is stateless.
Foundry Agent Service
- In Microsoft Foundry go to Manage › Resource details › Admin-connected models › Add.
- Connection type: Other source. Connection name:
vani. Base URL:https://api.vani.ai/v1(Foundry appendschat/completions). - Authentication: API key. Set the header name to
Authorizationand the value toBearer {api_key}(orx-api-keywith{api_key}). Do not keep the defaultapi-keyheader. - Model configuration: add
openai/gpt-6-solas the model name (it is sent asmodel), with a display name and an empty version. Repeat foropenai/gpt-6-sol-fastandmeta/muse-spark-1.3. - Advanced: leave the API version empty and keep Include deployment name in URL path off. Click Add.
- Use the model from a prompt agent as
<connection-name>/<model-name>, for examplevani/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 : offNote
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="meta/muse-spark-1.3",
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
Authorizationwith valueBearer {api_key}(orx-api-keywith{api_key}). The defaultapi-keyheader 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/AzureOpenAIClientwith the standard OpenAI client and a base URL, and use Vani model ids instead of deployment names. - AutoGen asks for model_info
- Pass
model_infofor Vani ids; AutoGen only knows OpenAI's own model names.
Still stuck? Check service status or the API error reference.
Sources
- Microsoft Learn: Bring your own model to Foundry Agent Service
- Microsoft Learn: Add a connection to your project
- foundry-samples: Model Gateway connection setup
- Microsoft Learn: Azure OpenAI v1 API
- Microsoft Learn: Agent Framework, OpenAI-compatible endpoints
- Microsoft Learn: Semantic Kernel chat completion
- Microsoft Learn: Microsoft.Extensions.AI quickstart
- AutoGen: autogen_ext.models.openai
Other guides: Xcode · Cursor · VS Code · JetBrains IDEs · OpenAI and Anthropic SDKs