Skip to documentation

Python

Use the OpenAI Python SDK with the NotHoly endpoint.

Updated November 3, 2026

Before you begin

Open a fresh terminal, configure a scoped key and list the models available to your account before using the client. The shared setup includes Bash and PowerShell commands.

Install and configure

Install the official openai package in your virtual environment. Set NOTHOLY_API_KEY and NOTHOLY_MODEL privately. The generated example disables automatic retries and sets an explicit output allowance. A successful generation consumes account credits.

Stream and call tools

Use the Chat Completions reference for incremental text and function calls. Accumulate tool arguments until the terminal tool call is complete; validate them before execution. Python streaming helpers require separate client-version verification.

Client configuration

Select a published model to generate configuration. Confirm your account can use it with GET /v1/models before sending a request.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["NOTHOLY_API_KEY"],
    base_url="https://api.notholy.com/v1",
    max_retries=0,
)
response = client.chat.completions.create(
    model="notholy-pulse",
    messages=[{"role": "user", "content": "Explain least privilege."}],
    max_tokens=2048,
)
print(response.choices[0].message.content)

Configuration reference: a generated snippet is not a full client certification. Check the compatibility notes above. Keep API keys in your private environment.