Skip to main content

OpenAI connector for Python

Install with pip install dex-connector-openai==0.1.0. The package requires dex-connectors-sdk==0.2.0 and dex-python-sdk>=1.28.0, and implements the manifest operations createResponse (Mutation) and retrieveResponse (Query) with the same branches, defaults, and failure classification as the Go module.

Operations

Operation Factory Happy branch Optional branches
createResponse new_create_response_step completed failed, providerRejected, uncertain, defect
retrieveResponse new_retrieve_response_step found notFound, providerRejected, invalidResponse, defect

createResponse retries

The Responses API does not deduplicate create requests, so createResponse fences every retry with its own Dex heartbeat checkpoint. Keep the Step's manifest sync Execute durability, and record no other heartbeats in that Step.

  • An attempt that observed a response ID reads that response back instead of creating another one, polling queued and in_progress until five seconds before the Execute deadline.
  • Only an attempt that provably created nothing (503, 429, a connection refused before sending, or a cancelled response) lets the next attempt resend.
  • Every other unconfirmed outcome selects uncertain: 408, 409, a 5xx other than 503, an ambiguous transport failure, a streamed error before a response ID, an unreadable body, or a read-back that cannot confirm the response.

The manifest retry policy allows three attempts within five minutes because a duplicate create is billed.

Streaming and structured output

Passing progress_stream or text_stream to new_create_response_step makes OpenAI stream the response. Lifecycle events become progress, text deltas are appended to the text Stream best effort, and the terminal event selects the branch. maxResponseBytes bounds the whole stream and maxSseEventBytes one event; after either limit the connector drains the stream and reads the stored response back when its ID was observed.

StructuredOutput sends a JSON Schema text.format; the completed output_text is then the JSON value.

Authorization and configuration

Create a Dex Web connection as described in the connector README. The API key travels only in the Authorization header. The modelPicker configuration UI unit (UI_UNIT_MODEL_PICKER, port UI_MODEL_PICKER_PORT_MODEL) lets Dex Web store a per-Step model; a blank model uses the connection's model.

Example

examples/summarize_text records the request, creates a summary with streamed text and a model picker, and records the outcome. Run the Worker with uv run python -m examples.summarize_text.worker after dexcli dev has loaded a project containing the openai-api connection.

Tests

openaimock.Mock scripts both operations and defaults to the manifest's default answers. Run uv run pytest tests for fencing, streaming, read-back, and manifest contract checks. With dexcli dev running, run DEX_FLOW_SERVICE_ADDRESS=127.0.0.1:34701 uv run pytest integration to drive the example through a real Dex Worker with a scripted provider transport. The Python mock checks create requests and strict structured answers with the SDK text generation validator, matching the Go connector's mock contract.

uv run pytest tests/test_conformance.py replays the Go-recorded provider scenarios for both operations. Live OpenAI authorization and provider behavior have not been verified.

Metadata

Release files for dex-connector-openai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dex-connector-openai 0.1.0
File Size Uploaded Provenance Actions
dex_connector_openai-0.1.0.tar.gz 88.0 kB Without provenance Details for dex_connector_openai-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dex-connector-openai 0.1.0
File Interpreter ABI Platform Actions
dex_connector_openai-0.1.0-py3-none-any.whl Python 3 none any Details for dex_connector_openai-0.1.0-py3-none-any.whl

Total release size: 115.0 kB

Release files / dex_connector_openai-0.1.0.tar.gz

Download URL dex_connector_openai-0.1.0.tar.gz
Size 88.0 kB
Tags Source
SHA-256 checksum
How to use checksums
539811afdbe7e464cff8a2c7655aaa69c4a6f4111636b6e5949857b757d1b4c2
BLAKE2b-256 checksum
How to use checksums
58a1a57ae2ab8da8ed3281855fb6d922210584a4d03f463b1a9ac07d8bdff3bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dex_connector_openai-0.1.0-py3-none-any.whl

Download URL dex_connector_openai-0.1.0-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8555b62fda86244aafd785f6fd2f5a996e5bc021dbfddb48ac7e608c23179bd7
BLAKE2b-256 checksum
How to use checksums
667adbfe7dde3e44c3c896b13b0c510b0ce43f9972dd5bbca7fce45a95db4f89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dex-connector-openai 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page