Skip to content

OpenAI compatibility

You can use the official OpenAI client libraries to call AI Foundry Hub by simply pointing them at our base URL and supplying your API key.

from openai import OpenAI
client = OpenAI(
base_url="https://api.aifoundryhub.com/v1",
api_key="AI_FOUNDRY_HUB_API_KEY",
)

Most generative-model endpoints - chat completions, streaming, images, embeddings, and audio — are supported out of the box by these clients.

You can initialize an OpenAI-compatible client to talk to AI Foundry Hub by pointing its base URL and API key at our service. For full details on each library, see: