Skip to content

Integrate with OpenAI SDK

Replace the placeholder values in the following Python snippet with your actual credentials and parameters, then run the script to integrate with F5 AI Security.

python
from openAI import OpenAI

BASE_URL = "{BASE_URL}/openai/{CONNECTION_NAME}"
CAI_TOKEN = "{CAI_TOKEN}"

client = OpenAI(base_url=BASE_URL, api_key=CAI_TOKEN)

response = client.responses.create(
    model="gpt-5-mini",
    input="What is the capital of France?",
)
print(response.output_text)

You can integrate F5 AI Security. We provide a code snippet to help with the process, which requires the following variables:

  • BASE_URL: The URL of the AI Security deployment. Depends on whether your deployment uses AI Security SaaS or your own on-premises system.

  • CAI_TOKEN: See Get Your Authorization Token for instructions on how to obtain an API key.

  • CONNECTION_NAME: Name of the configured OpenAI connection that SDK should use.

Updated at: