Documentation Index
Fetch the complete documentation index at: https://cognisafeltd.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
How it works
OpenAI uses proxy mode. After callingpatch_openai(), the Python SDK rewrites openai.base_url to point to the Cognisafe Go proxy (http://localhost:8080 by default). All OpenAI client calls then flow through the proxy, which:
- Forwards the request to
https://api.openai.comunchanged - Streams the response back to your application
- Logs the full request and response payload asynchronously — no impact on latency
base_url parameter works automatically — you don’t need to use the official openai Python package.
Setup
Supported capabilities
| Capability | Supported | Notes |
|---|---|---|
| Chat completions | Yes | Full logging of request and response |
| Streaming | Yes | Captured after the stream completes |
| Embeddings | Yes | Prompt and embedding vector logged |
| Function / tool calls | Yes | Tool definitions and call results included in payload |
| Assistants API | Partial | Thread-level logging not yet supported |
Streaming responses are buffered by the proxy and logged once the stream closes. Your application receives the stream in real time — only the logging is deferred to stream completion.
Azure OpenAI
For Azure OpenAI, use the samepatch_openai() call. The proxy sits in front of Azure’s endpoint rather than https://api.openai.com. Set UPSTREAM_URL on the proxy to your Azure resource URL:
Any OpenAI-compatible library
Because the proxy speaks the OpenAI API protocol, any client that accepts a custom base URL works withoutpatch_openai():

