Vakt is designed as a transparent proxy. This means you can use your existing Azure OpenAI SDKs without code rewrites—just a configuration change.
Using the standard Azure.AI.OpenAI library.
var endpoint = new Uri("https://my-resource.openai.azure.com/");
var credentials = new AzureKeyCredential("my-azure-api-key");
var client = new OpenAIClient(endpoint, credentials);Point the client to your local Vakt Gateway (default: http://localhost:5000).
// 1. Change Endpoint to Vakt
var endpoint = new Uri("http://localhost:5000/");
// 2. Keep your real Azure Key (Vakt forwards it)
var credentials = new AzureKeyCredential("my-azure-api-key");
var client = new OpenAIClient(endpoint, credentials);Using the official openai python package.
import os
from openai import AzureOpenAI
client = AzureOpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
api_version="2024-02-01",
azure_endpoint="https://my-resource.openai.azure.com"
)import os
from openai import AzureOpenAI
client = AzureOpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
api_version="2024-02-01",
# Point to Vakt local address
azure_endpoint="http://localhost:5000"
)from langchain_openai import AzureChatOpenAI
llm = AzureChatOpenAI(
azure_deployment="gpt-4",
api_version="2024-02-01",
azure_endpoint="https://my-resource.openai.azure.com"
)from langchain_openai import AzureChatOpenAI
llm = AzureChatOpenAI(
azure_deployment="gpt-4",
api_version="2024-02-01",
# Point to Vakt
azure_endpoint="http://localhost:5000"
)Since localhost often uses self-signed certificates in dev, you might see SSL errors.
C# Fix:
Allow the dev certificate in your HttpClient handler or trust the dotnet dev certs (dotnet dev-certs https --trust).
Python Fix: For testing only, you can disable SSL verification (not recommended for production):
import httpx
client = AzureOpenAI(
...,
http_client=httpx.Client(verify=False)
)