Skip to content

Azure AI Foundry: using the VIDAI Control Plane as the backend

Azure AI Foundry agents, Prompt Flow flows, and any Python code running in a Foundry compute reach the model via a standard OpenAI client. Point that client at the control plane and every call — chat, tool, structured output — routes through us.

TL;DR

In a Foundry Prompt Flow's python node, or in any deployed Foundry Python app:

from openai import OpenAI

client = OpenAI(
    base_url="https://your-vidai-server.example.com/v1",
    api_key="your-vidai-key",   # store in a Foundry connection
)

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "reply with: ok"}],
)
print(resp.choices[0].message.content)

Prerequisites

  • An Azure AI Foundry project.
  • Control plane base URL and an API key from API Keys.
  • Store the API key as a Custom Connection in your Foundry project so flows can reference it by name instead of pasting a literal.

Custom Connection

Project → Settings → Connections → Create → Custom keys:

  • Name: vidai_control_plane
  • Endpoint: https://your-vidai-server.example.com/v1
  • Keys: api_key = your-vidai-key

Then in a Prompt Flow python node:

from openai import OpenAI
from promptflow.connections import CustomConnection

def run(conn: CustomConnection, prompt: str) -> str:
    client = OpenAI(
        base_url=conn.configs["endpoint"],
        api_key=conn.secrets["api_key"],
    )
    resp = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": prompt}],
    )
    return resp.choices[0].message.content

Attribution

Every call from the flow (or deployed app) authenticates with the single VIDAI API key on the connection. Create an application on the Applications page named after the Foundry project, mint an agent inside it, and use that agent's key. The Foundry project's spend becomes a distinct line item on the Chargeback tab.

Foundry Agents

Foundry's Agent Service consumes a model via its own agent config. When you build an agent in Foundry using custom tools / Cloud Functions, wire the downstream LLM calls the same way as in Prompt Flow — an OpenAI client pointed at the control plane inside the tool implementation.

Verify it works

from openai import OpenAI

client = OpenAI(
    base_url="https://your-vidai-server.example.com/v1",
    api_key="your-vidai-key",
)
print(client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "reply with exactly: ok"}],
).choices[0].message.content)

A row appears on Request Logs attributed to your Foundry project's API key.

If something's off

Raise an issue at github.com/vidaiUK/vidai-quickstart/issues with the flow / agent config (masking the key) and the failing run. We'll get it sorted.

Where to go next