Skip to main content

AIProjectClient - Your Entry Point — The Foundry SDK

[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4

AIProjectClient - Your Entry Point

💻 The Foundry SDK 8 min 70 BASE XP⌨ HANDS-ON LAB

Connecting to Your Project

The AIProjectClient is the main class you instantiate to interact with your Foundry project.

Python Quick Start

from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential

project = AIProjectClient(
    endpoint="<your-project-endpoint>",
    credential=DefaultAzureCredential()
)

# Get an OpenAI-compatible client
openai_client = project.get_openai_client()
response = openai_client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello from Foundry!"}]
)
print(response.choices[0].message.content)

# Recommended in 2026: OpenAI Responses API (stateful multi-turn & tools)
resp = openai_client.responses.create(
    model="gpt-6.1-sol",
    input="Explain Foundry Agent Service in one concise paragraph."
)
print(resp.output_text)

.NET Quick Start

using Azure.AI.Projects;
using Azure.Identity;

var client = new AIProjectClient(
    new Uri("<your-project-endpoint>"),
    new DefaultAzureCredential()
);

var openAIClient = client.GetOpenAIClient();
🎯 Pro Tip: Find your project endpoint in the Foundry portal under Project Settings → Overview: https://<name>.services.ai.azure.com/api/projects/<project-name>. Note that legacy AIProjectClient.from_connection_string() was removed in azure-ai-projects v1.0 GA / v2.x in favor of direct endpoint + DefaultAzureCredential() initialization.
⌨ HANDS-ON LABInitialize AIProjectClient with DefaultAzureCredential
⭐ +150 XP

Run Python code establishing an authenticated session with your Foundry Project using azure-ai-projects.

1Execute Python code creating an AIProjectClient and printing project properties.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
FOUNDRY VERIFICATION
QUERY 1 // 1
How do you get an OpenAI-compatible client from AIProjectClient?
Import it separately
Call project.get_openai_client()
It's not possible
Use a different SDK