goderash-adapter-openai
Goderash adapter for the OpenAI Python SDK — Chat Completions, Responses, and Assistants APIs.
Drop-in adapter that audits every OpenAI call via Goderash — tamper-evident, hash-chained, regulator-ready. Covers all three modern OpenAI surfaces: Chat Completions, Responses API, and Assistants API.
Install
pip install goderash-adapter-openai
Two integration shapes
1. Wrapper — for Chat Completions and Responses
Wrap your OpenAI client; every .chat.completions.create and .responses.create call emits llm.call.* events automatically.
import os
from openai import OpenAI
from goderash_sdk import GoderashClient
from goderash_adapter_openai import wrap_openai
goderash = GoderashClient(
api_key=os.environ["GODERASH_API_KEY"],
tenant="acme",
agent_id="openai-agent-v1",
)
ctx = goderash.new_context()
client = wrap_openai(
OpenAI(api_key=os.environ["OPENAI_API_KEY"]),
goderash=goderash,
context=ctx,
)
response = client.chat.completions.create(
model="gpt-4.1",
messages=[{"role": "user", "content": "hello"}],
)
# → llm.call.started + llm.call.completed (with token usage)
2. Assistants polling helper
For the Assistants API, audit a completed run end-to-end. Iterates run-step events and emits tool.invoked / tool.completed for every function, code_interpreter, file_search, and retrieval call.
from openai import OpenAI
from goderash_sdk import GoderashClient
from goderash_adapter_openai import audit_assistants_run
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
goderash = GoderashClient(...)
ctx = goderash.new_context()
thread = client.beta.threads.create()
client.beta.threads.messages.create(thread.id, role="user", content="hi")
run = client.beta.threads.runs.create_and_poll(
thread_id=thread.id,
assistant_id=assistant.id,
)
audit_assistants_run(
client=client,
goderash=goderash,
context=ctx,
run=run,
thread_id=thread.id,
)
goderash.flush()
Failed runs also emit tool.failed for any erroring step.
Events emitted
| Surface | Event | When |
|---|---|---|
| Chat / Responses | llm.call.started |
Before request |
| Chat / Responses | llm.call.completed |
After response, with token usage |
| Assistants | tool.invoked |
Per function / code_interpreter / file_search / retrieval call |
| Assistants | tool.completed |
After tool succeeds |
| Assistants | tool.failed |
On run failure |
Compatibility
openai >= 1.50.0- Python
>= 3.10 - Works with any OpenAI model (gpt-4.1, gpt-4o, o1, o3, etc.)
Related packages
goderash-sdk— core SDK + runtime guardsgoderash-adapter-anthropic— Anthropic Messages / Claudegoderash-adapter-langgraph— LangGraph callback
License
Metadata
Release files for goderash-adapter-openai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| goderash_adapter_openai-0.1.1.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| goderash_adapter_openai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / goderash_adapter_openai-0.1.1.tar.gz
| Download URL | goderash_adapter_openai-0.1.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c5963817a06b0a2bb9e9e8dcfcfc53528331fea9f45b39e54605edd7cfaf28a
|
|
BLAKE2b-256 checksum How to use checksums |
f991b528aa258af30f0aa18350f63f3fbada6912d3d2be3779f75132fbd8b9a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / goderash_adapter_openai-0.1.1-py3-none-any.whl
| Download URL | goderash_adapter_openai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7233f6aaa1fcb5425f632a7cce1a0ef5172fa94137820975b1b0307b9234cde3
|
|
BLAKE2b-256 checksum How to use checksums |
3cffe0b56c81f7388816fca2914f260868d17484815f1a3009c14c8fb0fa15f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|