Python OpenAI SDK
The official OpenAI Python SDK works against Corveil unchanged — point base_url at your Corveil host and use a Corveil virtual API key.
Mode
Direct mode only. The SDK sends your Corveil key as the standard Authorization header.
1. Install
bash
pip install openai2. Minimal example
python
from openai import OpenAI
client = OpenAI(
base_url="https://your-corveil-host/v1",
api_key="sk-citadel-your-key-here",
)
resp = client.chat.completions.create(
model="or-claude-haiku-4.5",
messages=[{"role": "user", "content": "Hello from Corveil"}],
)
print(resp.choices[0].message.content)Environment variables
If you'd rather not hard-code values, the SDK reads OPENAI_BASE_URL and OPENAI_API_KEY automatically:
bash
export OPENAI_BASE_URL="https://your-corveil-host/v1"
export OPENAI_API_KEY="sk-citadel-your-key-here"Troubleshooting
- 404 / wrong path: Make sure
base_urlincludes the/v1suffix - 401 Unauthorized: Confirm the Corveil key has access to the requested model