Skip to main content

Goderash adapter for the OpenAI Python SDK (Chat + Responses + Assistants) — tamper-evident, hash-chained, regulator-ready.

Project description

goderash-adapter-openai

Goderash adapter for the OpenAI Python SDK — Chat Completions, Responses, and Assistants APIs.

PyPI version PyPI downloads license

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

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goderash_adapter_openai-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goderash_adapter_openai-0.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file goderash_adapter_openai-0.1.1.tar.gz.

File metadata

  • Download URL: goderash_adapter_openai-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for goderash_adapter_openai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6c5963817a06b0a2bb9e9e8dcfcfc53528331fea9f45b39e54605edd7cfaf28a
MD5 f038295458eea73ba4dc7e0febb06a9c
BLAKE2b-256 f991b528aa258af30f0aa18350f63f3fbada6912d3d2be3779f75132fbd8b9a8

See more details on using hashes here.

File details

Details for the file goderash_adapter_openai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: goderash_adapter_openai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for goderash_adapter_openai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7233f6aaa1fcb5425f632a7cce1a0ef5172fa94137820975b1b0307b9234cde3
MD5 6667c4d269b4965db3c6f83e0b264517
BLAKE2b-256 3cffe0b56c81f7388816fca2914f260868d17484815f1a3009c14c8fb0fa15f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page