360  openai-python - configuration reference

361 openai-python — configuration reference

Configuration surfaces for openai-python (safety class: safe; category: o-05-ai-engineering-sdks-dev-env) — detected from the upstream documentation at generation time (8 config-surface markers). The invocation reference stays on the main tool page.

361.1 Configuration files

No config-file paths surfaced in the upstream README at generation time — the tool likely takes options through flags or environment instead; see upstream.

361.2 Environment variables

Variable Upstream context
OPENAI_API_KEY the default and can be omitted api_key=os.environ.get(“OPENAI_API_KEY”), ) response = client.responses.create( model=“gpt
OPENAI_MTLS_PRIVATE_KEY n[“OPENAI_MTLS_CERTIFICATE_CHAIN”], keyfile=os.environ[“OPENAI_MTLS_PRIVATE_KEY”], password=os.getenv(“OPENAI_MTLS_PRIVATE
OPENAI_BASE_URL ttps://mtls.api.openai.com/v1when neitherbase_urlnorOPENAI_BASE_URLis set. The same configured HTTP client presents its | |OPENAI_AUTH_MODE| API-key or X.509 authentication with the application-ownedOPENAI_AUTH_MODEenvironment variable. X.509 workload identity curren | |OPENAI_LOG| ronment variableOPENAI_LOGtoinfo. ```shell $ export OPENAI_LOG=info ``` Or todebugfor more verbose logging. Set it to | |AZURE_OPENAI_API_KEY| t AzureOpenAI # gets the API Key from environment variable AZURE_OPENAI_API_KEY client = AzureOpenAI( # https://learn.microso | |AZURE_OPENAI_ENDPOINT| ollowing options are provided: -azure_endpoint(or theAZURE_OPENAI_ENDPOINTenvironment variable) -azure_deployment-a
AZURE_OPENAI_AD_TOKEN _VERSIONenvironment variable) -azure_ad_token(or theAZURE_OPENAI_AD_TOKENenvironment variable) -azure_ad_token_provide
AWS_BEDROCK_BASE_URL ually exclusive. Pass base_url to bedrock(...) or set AWS_BEDROCK_BASE_URL to override the derived https://bedrock-mantle. | |OPENAI_API_TYPE| ntinues to supportopenai.api_type = “amazon-bedrock”orOPENAI_API_TYPE=amazon-bedrock`. ## Versioning This package generall

Names extracted heuristically from upstream docs — verify each against the tool’s own docs before use.

361.3 Sample configuration (upstream)

import os
from openai import OpenAI

client = OpenAI(
    # This is the default and can be omitted
    api_key=os.environ.get("OPENAI_API_KEY"),
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a coding assistant that talks like a pirate.",
    input="How do I check if a Python object is an instance of a class?",
)

print(response.output_text)
import os
import asyncio
from openai import AsyncOpenAI

client = AsyncOpenAI(
    # This is the default and can be omitted
    api_key=os.environ.get("OPENAI_API_KEY"),
)


async def main() -> None:
    response = await client.responses.create(
        model="gpt-5.5", input="Explain disestablishmentarianism to a smart five year old."
    )
    print(response.output_text)


asyncio.run(main())

ref: pin - verified 2026-10-14